mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #75405 from tghartland/node-init-fix
Recheck for cloud taint before initializing nodes in cloud controller
This commit is contained in:
commit
ec88ec272c
@ -248,6 +248,13 @@ func (cnc *CloudNodeController) initializeNode(node *v1.Node) {
|
|||||||
return err
|
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 == "" {
|
if curNode.Spec.ProviderID == "" {
|
||||||
providerID, err := cloudprovider.GetInstanceProviderID(context.TODO(), cnc.cloud, types.NodeName(curNode.Name))
|
providerID, err := cloudprovider.GetInstanceProviderID(context.TODO(), cnc.cloud, types.NodeName(curNode.Name))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -304,14 +311,14 @@ func (cnc *CloudNodeController) initializeNode(node *v1.Node) {
|
|||||||
// After adding, call UpdateNodeAddress to set the CloudProvider provided IPAddresses
|
// 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
|
// So that users do not see any significant delay in IP addresses being filled into the node
|
||||||
cnc.updateNodeAddress(curNode, instances)
|
cnc.updateNodeAddress(curNode, instances)
|
||||||
|
|
||||||
|
klog.Infof("Successfully initialized node %s with cloud provider", node.Name)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utilruntime.HandleError(err)
|
utilruntime.HandleError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
klog.Infof("Successfully initialized node %s with cloud provider", node.Name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCloudTaint(taints []v1.Taint) *v1.Taint {
|
func getCloudTaint(taints []v1.Taint) *v1.Taint {
|
||||||
|
Loading…
Reference in New Issue
Block a user