Merge pull request #75405 from tghartland/node-init-fix

Recheck for cloud taint before initializing nodes in cloud controller
This commit is contained in:
Kubernetes Prow Robot 2019-05-14 11:21:19 -07:00 committed by GitHub
commit ec88ec272c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -248,6 +248,13 @@ func (cnc *CloudNodeController) initializeNode(node *v1.Node) {
return err
}
cloudTaint := getCloudTaint(curNode.Spec.Taints)
if cloudTaint == nil {
// Node object received from event had the cloud taint but was outdated,
// the node has actually already been initialized.
return nil
}
if curNode.Spec.ProviderID == "" {
providerID, err := cloudprovider.GetInstanceProviderID(context.TODO(), cnc.cloud, types.NodeName(curNode.Name))
if err == nil {
@ -304,14 +311,14 @@ func (cnc *CloudNodeController) initializeNode(node *v1.Node) {
// After adding, call UpdateNodeAddress to set the CloudProvider provided IPAddresses
// So that users do not see any significant delay in IP addresses being filled into the node
cnc.updateNodeAddress(curNode, instances)
klog.Infof("Successfully initialized node %s with cloud provider", node.Name)
return nil
})
if err != nil {
utilruntime.HandleError(err)
return
}
klog.Infof("Successfully initialized node %s with cloud provider", node.Name)
}
func getCloudTaint(taints []v1.Taint) *v1.Taint {