add config fields for kic SSH and API ports

pull/6390/head
Medya Gh 2020-01-23 23:51:41 -08:00
parent ca0f4c7e20
commit 2bd169f508
2 changed files with 10 additions and 2 deletions

View File

@ -27,11 +27,13 @@ import (
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/viper"
pkgdrivers "k8s.io/minikube/pkg/drivers"
"k8s.io/minikube/pkg/drivers/kic/node"
"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"
)
@ -172,7 +174,12 @@ func (d *Driver) GetSSHHostname() (string, error) {
// GetSSHPort returns port for use with ssh
func (d *Driver) GetSSHPort() (int, error) {
return d.NodeConfig.SSHHostBindPort, nil
cc, err := config.Load(viper.GetString(config.MachineProfile))
if err != nil {
glog.Infof("error loading config file which may be okay on first run : %v ", err)
return 22, nil
}
return int(cc.SSHBindPort), nil
}
// GetURL returns ip of the container running kic control-panel

View File

@ -65,7 +65,8 @@ type MachineConfig struct {
HostOnlyNicType string // Only used by virtualbox
NatNicType string // Only used by virtualbox
Addons map[string]bool
NodeBindPort int32 // Only used by kic
APIBindPort int32 // the host port to bind to apiserver inside the container only used by kic
SSHBindPort int32 // the host port to bind to ssh service inside the container only used by kic
}
// KubernetesConfig contains the parameters used to configure the VM Kubernetes.