mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Avoid call to get cloud instances
if a node does not have the taint, we really don't need to make calls to get the list of instances from the cloud provider
This commit is contained in:
parent
27daaab224
commit
84d171fe86
@ -313,18 +313,18 @@ func (cnc *CloudNodeController) MonitorNode() {
|
|||||||
func (cnc *CloudNodeController) AddCloudNode(obj interface{}) {
|
func (cnc *CloudNodeController) AddCloudNode(obj interface{}) {
|
||||||
node := obj.(*v1.Node)
|
node := obj.(*v1.Node)
|
||||||
|
|
||||||
instances, ok := cnc.cloud.Instances()
|
|
||||||
if !ok {
|
|
||||||
utilruntime.HandleError(fmt.Errorf("failed to get instances from cloud provider"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
cloudTaint := getCloudTaint(node.Spec.Taints)
|
cloudTaint := getCloudTaint(node.Spec.Taints)
|
||||||
if cloudTaint == nil {
|
if cloudTaint == nil {
|
||||||
glog.V(2).Infof("This node %s is registered without the cloud taint. Will not process.", node.Name)
|
glog.V(2).Infof("This node %s is registered without the cloud taint. Will not process.", node.Name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instances, ok := cnc.cloud.Instances()
|
||||||
|
if !ok {
|
||||||
|
utilruntime.HandleError(fmt.Errorf("failed to get instances from cloud provider"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err := clientretry.RetryOnConflict(UpdateNodeSpecBackoff, func() error {
|
err := clientretry.RetryOnConflict(UpdateNodeSpecBackoff, func() error {
|
||||||
curNode, err := cnc.kubeClient.CoreV1().Nodes().Get(node.Name, metav1.GetOptions{})
|
curNode, err := cnc.kubeClient.CoreV1().Nodes().Get(node.Name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user