Skip to content

Commit ec88ec2

Browse files
authored
Merge pull request kubernetes#75405 from tghartland/node-init-fix
Recheck for cloud taint before initializing nodes in cloud controller
2 parents 23fb942 + 081ec69 commit ec88ec2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/controller/cloud/node_controller.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ func (cnc *CloudNodeController) initializeNode(node *v1.Node) {
248248
return err
249249
}
250250

251+
cloudTaint := getCloudTaint(curNode.Spec.Taints)
252+
if cloudTaint == nil {
253+
// Node object received from event had the cloud taint but was outdated,
254+
// the node has actually already been initialized.
255+
return nil
256+
}
257+
251258
if curNode.Spec.ProviderID == "" {
252259
providerID, err := cloudprovider.GetInstanceProviderID(context.TODO(), cnc.cloud, types.NodeName(curNode.Name))
253260
if err == nil {
@@ -304,14 +311,14 @@ func (cnc *CloudNodeController) initializeNode(node *v1.Node) {
304311
// After adding, call UpdateNodeAddress to set the CloudProvider provided IPAddresses
305312
// So that users do not see any significant delay in IP addresses being filled into the node
306313
cnc.updateNodeAddress(curNode, instances)
314+
315+
klog.Infof("Successfully initialized node %s with cloud provider", node.Name)
307316
return nil
308317
})
309318
if err != nil {
310319
utilruntime.HandleError(err)
311320
return
312321
}
313-
314-
klog.Infof("Successfully initialized node %s with cloud provider", node.Name)
315322
}
316323

317324
func getCloudTaint(taints []v1.Taint) *v1.Taint {

0 commit comments

Comments
 (0)