Merge pull request #7051 from vikkyomkar/issue-7029
Function name "HostPortBinding" changed to "ForwardedPortpull/7055/head
commit
1be289b5e9
|
@ -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})
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue