Skip to content

Commit

Permalink
Implement GetInstanceID for other cloud providers
Browse files Browse the repository at this point in the history
  • Loading branch information
feiskyer committed Feb 27, 2019
1 parent 2758133 commit 2e2aab6
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ func (ali *aliCloudProvider) Cleanup() error {
return nil
}

// GetInstanceID gets the instance ID for the specified node.
func (ali *aliCloudProvider) GetInstanceID(node *apiv1.Node) string {
return node.Spec.ProviderID
}

// AliRef contains a reference to ECS instance or .
type AliRef struct {
ID string
Expand Down
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ func (aws *awsCloudProvider) Refresh() error {
return aws.awsManager.Refresh()
}

// GetInstanceID gets the instance ID for the specified node.
func (aws *awsCloudProvider) GetInstanceID(node *apiv1.Node) string {
return node.Spec.ProviderID
}

// AwsRef contains a reference to some entity in AWS world.
type AwsRef struct {
Name string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ func (baiducloud *baiducloudCloudProvider) Refresh() error {
return nil
}

// GetInstanceID gets the instance ID for the specified node.
func (baiducloud *baiducloudCloudProvider) GetInstanceID(node *apiv1.Node) string {
return node.Spec.ProviderID
}

// BaiducloudRef contains a reference to some entity in baiducloud world.
type BaiducloudRef struct {
Name string
Expand Down
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/gce/gce_cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ func (gce *GceCloudProvider) Refresh() error {
return gce.gceManager.Refresh()
}

// GetInstanceID gets the instance ID for the specified node.
func (gce *GceCloudProvider) GetInstanceID(node *apiv1.Node) string {
return node.Spec.ProviderID
}

// GceRef contains s reference to some entity in GCE world.
type GceRef struct {
Project string
Expand Down
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/gke/gke_cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ func (gke *GkeCloudProvider) GetNodeLocations() []string {
return gke.gkeManager.GetNodeLocations()
}

// GetInstanceID gets the instance ID for the specified node.
func (gke *GkeCloudProvider) GetInstanceID(node *apiv1.Node) string {
return node.Spec.ProviderID
}

// MigSpec contains information about what machines in a MIG look like.
type MigSpec struct {
MachineType string
Expand Down
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/kubemark/kubemark_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ func (kubemark *KubemarkCloudProvider) Refresh() error {
return nil
}

// GetInstanceID gets the instance ID for the specified node.
func (kubemark *KubemarkCloudProvider) GetInstanceID(node *apiv1.Node) string {
return node.Spec.ProviderID
}

// Cleanup cleans up all resources before the cloud provider is removed
func (kubemark *KubemarkCloudProvider) Cleanup() error {
return nil
Expand Down
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/kubemark/kubemark_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ func (kubemark *KubemarkCloudProvider) Refresh() error {
return cloudprovider.ErrNotImplemented
}

// GetInstanceID gets the instance ID for the specified node.
func (kubemark *KubemarkCloudProvider) GetInstanceID(node *apiv1.Node) string {
return ""
}

// Cleanup cleans up all resources before the cloud provider is removed
func (kubemark *KubemarkCloudProvider) Cleanup() error {
return cloudprovider.ErrNotImplemented
Expand Down
14 changes: 14 additions & 0 deletions cluster-autoscaler/cloudprovider/mocks/CloudProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,17 @@ func (_m *CloudProvider) Refresh() error {

return r0
}

// GetInstanceID gets the instance ID for the specified node.
func (_m *CloudProvider) GetInstanceID(node *v1.Node) string {
ret := _m.Called()

var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}

return r0
}
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/test/test_cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ func (tcp *TestCloudProvider) Refresh() error {
return nil
}

// GetInstanceID gets the instance ID for the specified node.
func (tcp *TestCloudProvider) GetInstanceID(node *apiv1.Node) string {
return node.Spec.ProviderID
}

// TestNodeGroup is a node group used by TestCloudProvider.
type TestNodeGroup struct {
sync.Mutex
Expand Down

0 comments on commit 2e2aab6

Please sign in to comment.