diff --git a/pkg/cloudprovider/providers/vsphere/vsphere.go b/pkg/cloudprovider/providers/vsphere/vsphere.go index 16a8134b63a..656e05aee18 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere.go @@ -273,6 +273,9 @@ func newVSphere(cfg VSphereConfig) (*VSphere, error) { if cfg.Global.RoundTripperCount == 0 { cfg.Global.RoundTripperCount = RoundTripperDefaultCount } + if cfg.Global.VCenterPort != "" { + glog.Warningf("port is a deprecated field in vsphere.conf and will be removed in future release.") + } c, err := newClient(context.TODO(), &cfg) if err != nil { @@ -310,7 +313,7 @@ func logout(vs *VSphere) { func newClient(ctx context.Context, cfg *VSphereConfig) (*govmomi.Client, error) { // Parse URL from string - u, err := url.Parse(fmt.Sprintf("https://%s:%s/sdk", cfg.Global.VCenterIP, cfg.Global.VCenterPort)) + u, err := url.Parse(fmt.Sprintf("https://%s/sdk", cfg.Global.VCenterIP)) if err != nil { return nil, err } diff --git a/pkg/cloudprovider/providers/vsphere/vsphere_test.go b/pkg/cloudprovider/providers/vsphere/vsphere_test.go index 89903b639c7..02fdb5006a7 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere_test.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere_test.go @@ -33,7 +33,6 @@ func configFromEnv() (cfg VSphereConfig, ok bool) { var InsecureFlag bool var err error cfg.Global.VCenterIP = os.Getenv("VSPHERE_VCENTER") - cfg.Global.VCenterPort = os.Getenv("VSPHERE_VCENTER_PORT") cfg.Global.User = os.Getenv("VSPHERE_USER") cfg.Global.Password = os.Getenv("VSPHERE_PASSWORD") cfg.Global.Datacenter = os.Getenv("VSPHERE_DATACENTER") @@ -81,10 +80,6 @@ vm-uuid = 1234 t.Errorf("incorrect vcenter ip: %s", cfg.Global.VCenterIP) } - if cfg.Global.VCenterPort != "443" { - t.Errorf("incorrect vcenter port: %s", cfg.Global.VCenterPort) - } - if cfg.Global.Datacenter != "us-west" { t.Errorf("incorrect datacenter: %s", cfg.Global.Datacenter) } diff --git a/pkg/cloudprovider/providers/vsphere/vsphere_util.go b/pkg/cloudprovider/providers/vsphere/vsphere_util.go index c11c9d310c8..111349d7e62 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere_util.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere_util.go @@ -43,7 +43,6 @@ func GetVSphere() (*VSphere, error) { func getVSphereConfig() *VSphereConfig { var cfg VSphereConfig cfg.Global.VCenterIP = os.Getenv("VSPHERE_VCENTER") - cfg.Global.VCenterPort = os.Getenv("VSPHERE_VCENTER_PORT") cfg.Global.User = os.Getenv("VSPHERE_USER") cfg.Global.Password = os.Getenv("VSPHERE_PASSWORD") cfg.Global.Datacenter = os.Getenv("VSPHERE_DATACENTER")