From 411a1a89d71980e91d80236fdaffa16aaa85981d Mon Sep 17 00:00:00 2001 From: divyenpatel Date: Wed, 26 Jul 2017 20:31:24 -0700 Subject: [PATCH] reverting deprecatin of vcenter port --- pkg/cloudprovider/providers/vsphere/vsphere.go | 6 +++--- pkg/cloudprovider/providers/vsphere/vsphere_test.go | 1 + pkg/cloudprovider/providers/vsphere/vsphere_util.go | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/cloudprovider/providers/vsphere/vsphere.go b/pkg/cloudprovider/providers/vsphere/vsphere.go index fe2ff0acbd..91f8e3734b 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere.go @@ -332,8 +332,8 @@ 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.") + if cfg.Global.VCenterPort == "" { + cfg.Global.VCenterPort = "443" } var c *govmomi.Client @@ -382,7 +382,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/sdk", cfg.Global.VCenterIP)) + u, err := url.Parse(fmt.Sprintf("https://%s:%s/sdk", cfg.Global.VCenterIP, cfg.Global.VCenterPort)) 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 7ab128ecc9..4dd44a6e7b 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere_test.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere_test.go @@ -33,6 +33,7 @@ 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") diff --git a/pkg/cloudprovider/providers/vsphere/vsphere_util.go b/pkg/cloudprovider/providers/vsphere/vsphere_util.go index 75ed698809..a5bd63b15c 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere_util.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere_util.go @@ -61,6 +61,7 @@ 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")