From b8f70a84edcce894b8afc9bb2a7aa86920d60d73 Mon Sep 17 00:00:00 2001 From: Guoliang Wang Date: Tue, 29 May 2018 22:57:04 +0800 Subject: [PATCH] cleanup some dead cloudprovider code --- pkg/cloudprovider/providers/aws/aws.go | 21 ------------------- .../providers/gce/gce_loadbalancer.go | 4 ---- pkg/cloudprovider/providers/gce/gce_util.go | 5 ----- .../providers/vsphere/vsphere_util.go | 12 ----------- 4 files changed, 42 deletions(-) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index e95ad50d892..ca19a57e916 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -999,10 +999,6 @@ func updateConfigZone(cfg *CloudConfig, metadata EC2Metadata) error { return nil } -func getInstanceType(metadata EC2Metadata) (string, error) { - return metadata.GetMetadata("instance-type") -} - func getAvailabilityZone(metadata EC2Metadata) (string, error) { return metadata.GetMetadata("placement/availability-zone") } @@ -1920,23 +1916,6 @@ func (c *Cloud) buildSelfAWSInstance() (*awsInstance, error) { return newAWSInstance(c.ec2, instance), nil } -// Gets the awsInstance with for the node with the specified nodeName, or the 'self' instance if nodeName == "" -func (c *Cloud) getAwsInstance(nodeName types.NodeName) (*awsInstance, error) { - var awsInstance *awsInstance - if nodeName == "" { - awsInstance = c.selfAWSInstance - } else { - instance, err := c.getInstanceByNodeName(nodeName) - if err != nil { - return nil, err - } - - awsInstance = newAWSInstance(c.ec2, instance) - } - - return awsInstance, nil -} - // wrapAttachError wraps the error returned by an AttachVolume request with // additional information, if needed and possible. func wrapAttachError(err error, disk *awsDisk, instance string) error { diff --git a/pkg/cloudprovider/providers/gce/gce_loadbalancer.go b/pkg/cloudprovider/providers/gce/gce_loadbalancer.go index 4cb66234661..a83d455d61e 100644 --- a/pkg/cloudprovider/providers/gce/gce_loadbalancer.go +++ b/pkg/cloudprovider/providers/gce/gce_loadbalancer.go @@ -41,10 +41,6 @@ var ( lbSrcRngsFlag cidrs ) -func newLoadBalancerMetricContext(request, region string) *metricContext { - return newGenericMetricContext("loadbalancer", request, region, unusedMetricLabel, computeV1Version) -} - func init() { var err error // LB L7 proxies and all L3/4/7 health checkers have client addresses within these known CIDRs. diff --git a/pkg/cloudprovider/providers/gce/gce_util.go b/pkg/cloudprovider/providers/gce/gce_util.go index 363b5173abe..1e27b8b7cfa 100644 --- a/pkg/cloudprovider/providers/gce/gce_util.go +++ b/pkg/cloudprovider/providers/gce/gce_util.go @@ -138,11 +138,6 @@ func mapNodeNameToInstanceName(nodeName types.NodeName) string { return string(nodeName) } -// mapInstanceToNodeName maps a GCE Instance to a k8s NodeName -func mapInstanceToNodeName(instance *compute.Instance) types.NodeName { - return types.NodeName(instance.Name) -} - // GetGCERegion returns region of the gce zone. Zone names // are of the form: ${region-name}-${ix}. // For example, "us-central1-b" has a region of "us-central1". diff --git a/pkg/cloudprovider/providers/vsphere/vsphere_util.go b/pkg/cloudprovider/providers/vsphere/vsphere_util.go index bc575838e84..c62b4de5371 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere_util.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere_util.go @@ -81,18 +81,6 @@ func getVSphereConfig() (*VSphereConfig, error) { return &cfg, nil } -func getVSphereConn(cfg *VSphereConfig) *vclib.VSphereConnection { - vSphereConn := &vclib.VSphereConnection{ - Username: cfg.Global.User, - Password: cfg.Global.Password, - Hostname: cfg.Global.VCenterIP, - Insecure: cfg.Global.InsecureFlag, - RoundTripperCount: cfg.Global.RoundTripperCount, - Port: cfg.Global.VCenterPort, - } - return vSphereConn -} - // Returns the accessible datastores for the given node VM. func getAccessibleDatastores(ctx context.Context, nodeVmDetail *NodeDetails, nodeManager *NodeManager) ([]*vclib.DatastoreInfo, error) { accessibleDatastores, err := nodeVmDetail.vm.GetAllAccessibleDatastores(ctx)