Skip to content

Commit f010ee2

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#51087 from oracle/for/upstream/master/ccm-instance-exists
Automatic merge from submit-queue (batch tested with PRs 51174, 51363, 51087, 51382, 51388) Add InstanceExistsByProviderID to cloud provider interface for CCM **What this PR does / why we need it**: Currently, [`MonitorNode()`](https://github.com/kubernetes/kubernetes/blob/02b520f0a40be2056d91fc0661c2b4fdb2694c30/pkg/controller/cloud/nodecontroller.go#L240) in the node controller checks with the CCM if a node still exists by calling `ExternalID(nodeName)`. `ExternalID` is supposed to return the provider id of a node which is not supported on every cloud. This means that any clouds who cannot infer the provider id by the node name from a remote location will never remove nodes that no longer exist. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes kubernetes#50985 **Special notes for your reviewer**: We'll want to create a subsequent issue to track the implementation of these two new methods in the cloud providers. **Release note**: ```release-note Adds `InstanceExists` and `InstanceExistsByProviderID` to cloud provider interface for the cloud controller manager ``` /cc @wlan0 @thockin @andrewsykim @luxas @jhorwit2 /area cloudprovider /sig cluster-lifecycle
2 parents 42cd0ab + fb6a0a9 commit f010ee2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pkg/cloudprovider/providers/openstack/openstack_instances.go

+6
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ func (i *Instances) ExternalID(name types.NodeName) (string, error) {
110110
return srv.ID, nil
111111
}
112112

113+
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
114+
// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
115+
func (i *Instances) InstanceExistsByProviderID(providerID string) (bool, error) {
116+
return false, errors.New("unimplemented")
117+
}
118+
113119
// InstanceID returns the kubelet's cloud provider ID.
114120
func (os *OpenStack) InstanceID() (string, error) {
115121
if len(os.localInstanceID) == 0 {

pkg/volume/cinder/attacher_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,10 @@ func (instances *instances) InstanceTypeByProviderID(providerID string) (string,
650650
return "", errors.New("Not implemented")
651651
}
652652

653+
func (instances *instances) InstanceExistsByProviderID(providerID string) (bool, error) {
654+
return false, errors.New("unimplemented")
655+
}
656+
653657
func (instances *instances) List(filter string) ([]types.NodeName, error) {
654658
return []types.NodeName{}, errors.New("Not implemented")
655659
}

0 commit comments

Comments
 (0)