Skip to content

Commit

Permalink
Merge pull request #7603 from alonyb/w/add-registery-addon
Browse files Browse the repository at this point in the history
Add registry addon feature for docker on mac/windows
  • Loading branch information
medyagh committed Apr 18, 2020
2 parents fe4fdee + a96d8f0 commit 825ba53
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
14 changes: 14 additions & 0 deletions pkg/addons/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ import (

"github.com/golang/glog"
"github.com/pkg/errors"

"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/machine"
Expand Down Expand Up @@ -176,6 +179,17 @@ https://github.com/kubernetes/minikube/issues/7332`, out.V{"driver_name": cc.Dri
return nil
}

if name == "registry" {
if driver.NeedsPortForward(cc.Driver) {
port, err := oci.ForwardedPort(cc.Driver, cc.Name, constants.RegistryAddonPort)
if err != nil {
return errors.Wrap(err, "registry port")
}
out.T(out.Tip, `Registry addon on with {{.driver}} uses {{.port}} please use that instead of default 5000`, out.V{"driver": cc.Driver, "port": port})
out.T(out.Documentation, `For more information see: https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}`, out.V{"driver": cc.Driver})
}
}

cmd, err := machine.CommandRunner(host)
if err != nil {
return errors.Wrap(err, "command runner")
Expand Down
4 changes: 4 additions & 0 deletions pkg/drivers/kic/kic.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ func (d *Driver) Create() error {
ListenAddress: oci.DefaultBindIPV4,
ContainerPort: constants.DockerDaemonPort,
},
oci.PortMapping{
ListenAddress: oci.DefaultBindIPV4,
ContainerPort: constants.RegistryAddonPort,
},
)

exists, err := oci.ContainerExists(d.OCIBinary, params.Name)
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const (
APIServerPort = 8443
// SSHPort is the SSH serviceport on the node vm and container
SSHPort = 22
// RegistryAddonPort os the default registry addon port
RegistryAddonPort = 5000

// APIServerName is the default API server name
APIServerName = "minikubeCA"
Expand Down
4 changes: 1 addition & 3 deletions site/content/en/docs/drivers/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ The Docker driver allows you to install Kubernetes into an existing Docker insta

`sudo mkdir /sys/fs/cgroup/systemd && sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd`.

- Addon 'registry' for mac and windows is not supported yet and it is [a work in progress](https://github.com/kubernetes/minikube/issues/7535).



## Troubleshooting

- On macOS or Windows, you may need to restart Docker for Desktop if a command gets hung

- Run `--alsologtostderr -v=1` for extra debugging information
12 changes: 6 additions & 6 deletions site/content/en/docs/handbook/pushing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ The best method to push your image to minikube depends on the container-runtime
Here is a comparison table to help you choose:


| Method | Supported Runtimes | Issues | Performance |
| Method | Supported Runtimes | | Performance |
|--- |--- |--- |--- |--- |
| [docker-env command](/docs/handbook/pushing/#1pushing-directly-to-the-in-cluster-docker-daemon-docker-env) | only docker | | good |
| [podman-env command](/docs/handbook/pushing/#3-pushing-directly-to-in-cluster-crio-podman-env) | only cri-o | | good |
| [cache add command](/pushing/#2-push-images-using-cache-command) | all | | ok |
| [registry addon](/docs/handbook/pushing/#4-pushing-to-an-in-cluster-using-registry-addon) | all | work in progress for [docker on mac](https://github.com/kubernetes/minikube/issues/7535) | ok |
| [minikube ssh](/docs/handbook/pushing/#5-building-images-inside-of-minikube-using-ssh) | all | | best |
| [docker-env command](/docs/handbook/pushing/#1pushing-directly-to-the-in-cluster-docker-daemon-docker-env) | only docker | good |
| [podman-env command](/docs/handbook/pushing/#3-pushing-directly-to-in-cluster-crio-podman-env) | only cri-o | good |
| [cache add command](/pushing/#2-push-images-using-cache-command) | all | ok |
| [registry addon](/docs/handbook/pushing/#4-pushing-to-an-in-cluster-using-registry-addon) | all | ok |
| [minikube ssh](/docs/handbook/pushing/#5-building-images-inside-of-minikube-using-ssh) | all | best |


* note1 : the default container-runtime on minikube is 'docker'.
Expand Down

0 comments on commit 825ba53

Please sign in to comment.