mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +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:
		@@ -313,18 +313,18 @@ func (cnc *CloudNodeController) MonitorNode() {
 | 
			
		||||
func (cnc *CloudNodeController) AddCloudNode(obj interface{}) {
 | 
			
		||||
	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)
 | 
			
		||||
	if cloudTaint == nil {
 | 
			
		||||
		glog.V(2).Infof("This node %s is registered without the cloud taint. Will not process.", node.Name)
 | 
			
		||||
		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 {
 | 
			
		||||
		curNode, err := cnc.kubeClient.CoreV1().Nodes().Get(node.Name, metav1.GetOptions{})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user