Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function name "HostPortBinding" changed to "ForwardedPort #7051

Merged
merged 3 commits into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/docker-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ var dockerEnvCmd = &cobra.Command{
port := constants.DockerDaemonPort
if driver.IsKIC(host.DriverName) { // for kic we need to find what port docker/podman chose for us
hostIP = oci.DefaultBindIPV4
port, err = oci.HostPortBinding(host.DriverName, profile, port)
port, err = oci.ForwardedPort(host.DriverName, profile, port)
if err != nil {
exit.WithCodeT(exit.Failure, "Error getting port binding for '{{.driver_name}} driver: {{.error}}", out.V{"driver_name": host.DriverName, "error": err})
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func startKicServiceTunnel(svc, configName string) {
exit.WithError("error creating clientset", err)
}

port, err := oci.HostPortBinding(oci.Docker, configName, 22)
port, err := oci.ForwardedPort(oci.Docker, configName, 22)
if err != nil {
exit.WithError("error getting ssh port", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var tunnelCmd = &cobra.Command{
}()

if runtime.GOOS == "darwin" && cfg.Driver == oci.Docker {
port, err := oci.HostPortBinding(oci.Docker, cfg.Name, 22)
port, err := oci.ForwardedPort(oci.Docker, cfg.Name, 22)
if err != nil {
exit.WithError("error getting ssh port", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/kic/kic.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (d *Driver) GetSSHHostname() (string, error) {

// GetSSHPort returns port for use with ssh
func (d *Driver) GetSSHPort() (int, error) {
p, err := oci.HostPortBinding(d.OCIBinary, d.MachineName, constants.SSHPort)
p, err := oci.ForwardedPort(d.OCIBinary, d.MachineName, constants.SSHPort)
if err != nil {
return p, errors.Wrap(err, "get ssh host-port")
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/drivers/kic/oci/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func dockerGatewayIP() (net.IP, error) {
return ip, nil
}

// HostPortBinding will return port mapping for a container using cli.
// example : HostPortBinding("docker", "minikube", "22")
// ForwardedPort will return port mapping for a container using cli.
// example : ForwardedPort("docker", "minikube", "22")
// will return the docker assigned port:
// 32769, nil
// only supports TCP ports
func HostPortBinding(ociBinary string, ociID string, contPort int) (int, error) {
func ForwardedPort(ociBinary string, ociID string, contPort int) (int, error) {
var out []byte
var err error

Expand Down
4 changes: 2 additions & 2 deletions pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (k *Bootstrapper) WaitForCluster(cfg config.ClusterConfig, timeout time.Dur
port := cp.Port
if driver.IsKIC(cfg.Driver) {
ip = oci.DefaultBindIPV4
port, err = oci.HostPortBinding(cfg.Driver, cfg.Name, port)
port, err = oci.ForwardedPort(cfg.Driver, cfg.Name, port)
if err != nil {
return errors.Wrapf(err, "get host-bind port %d for container %s", port, cfg.Name)
}
Expand Down Expand Up @@ -339,7 +339,7 @@ func (k *Bootstrapper) restartCluster(cfg config.ClusterConfig) error {
port := n.Port
if driver.IsKIC(cfg.Driver) {
ip = oci.DefaultBindIPV4
port, err = oci.HostPortBinding(cfg.Driver, cfg.Name, port)
port, err = oci.ForwardedPort(cfg.Driver, cfg.Name, port)
if err != nil {
return errors.Wrapf(err, "get host-bind port %d for container %s", port, cfg.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func apiServerURL(h host.Host, cc config.ClusterConfig, n config.Node) (string,
// for kic drivers we use 127.0.0.1 instead of node IP,
// because of Docker on MacOs limitations for reaching to container's IP.
hostname = oci.DefaultBindIPV4
port, err = oci.HostPortBinding(h.DriverName, h.Name, port)
port, err = oci.ForwardedPort(h.DriverName, h.Name, port)
if err != nil {
return "", errors.Wrap(err, "host port binding")
}
Expand Down