func init() { … } var labelReconcileInfo … var UpdateNodeSpecBackoff … type CloudNodeController … // NewCloudNodeController creates a CloudNodeController object func NewCloudNodeController( nodeInformer coreinformers.NodeInformer, kubeClient clientset.Interface, cloud cloudprovider.Interface, nodeStatusUpdateFrequency time.Duration, workerCount int32) (*CloudNodeController, error) { … } // Run will sync informer caches and starting workers. // This controller updates newly registered nodes with information // from the cloud provider. This call is blocking so should be called // via a goroutine // //logcheck:context // RunWithContext should be used instead of Run in code which supports contextual logging. func (cnc *CloudNodeController) Run(stopCh <-chan struct{ … } // RunWithContext will sync informer caches and starting workers. // This controller updates newly registered nodes with information // from the cloud provider. This call is blocking so should be called // via a goroutine func (cnc *CloudNodeController) RunWithContext(ctx context.Context, controllerManagerMetrics *controllersmetrics.ControllerManagerMetrics) { … } // runWorker is a long-running function that will continually call the // processNextWorkItem function in order to read and process a message on the // workqueue. func (cnc *CloudNodeController) runWorker(ctx context.Context) { … } // processNextWorkItem will read a single work item off the workqueue and // attempt to process it, by calling the syncHandler. func (cnc *CloudNodeController) processNextWorkItem(ctx context.Context) bool { … } // syncHandler implements the logic of the controller. func (cnc *CloudNodeController) syncHandler(ctx context.Context, key string) error { … } // UpdateNodeStatus updates the node status, such as node addresses func (cnc *CloudNodeController) UpdateNodeStatus(ctx context.Context) error { … } // enqueueNode takes a Node resource and converts it into a key // string which is then put onto the work queue. func (cnc *CloudNodeController) enqueueNode(obj interface{ … } // reconcileNodeLabels reconciles node labels transitioning from beta to GA func (cnc *CloudNodeController) reconcileNodeLabels(nodeName string) error { … } // UpdateNodeAddress updates the nodeAddress of a single node func (cnc *CloudNodeController) updateNodeAddress(ctx context.Context, node *v1.Node, instanceMetadata *cloudprovider.InstanceMetadata) { … } type nodeModifier … // syncNode handles updating existing nodes registered with the cloud taint // and processes nodes that were added into the cluster, and cloud initialize them if appropriate. func (cnc *CloudNodeController) syncNode(ctx context.Context, nodeName string) error { … } // getNodeModifiersFromCloudProvider returns a slice of nodeModifiers that update // a node object with provider-specific information. // All of the returned functions are idempotent, because they are used in a retry-if-conflict // loop, meaning they could get called multiple times. func (cnc *CloudNodeController) getNodeModifiersFromCloudProvider( ctx context.Context, node *v1.Node, instanceMeta *cloudprovider.InstanceMetadata, ) ([]nodeModifier, error) { … } // getInstanceMetadata get providerdID, instance type and nodeAddresses, use Instances if InstancesV2 is off. // ProviderID is expected to be available, but to keep backward compatibility, // we should handle some scenarios where it can be missing. It returns an error // if providerID is missing, except when is not implemented by GetInstanceProviderID. func (cnc *CloudNodeController) getInstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error) { … } // getInstanceAddresses returns InstanceMetadata.NodeAddresses. If InstancesV2 not supported, it won't get instanceType // which avoid an api call compared with getInstanceMetadata. func (cnc *CloudNodeController) getInstanceNodeAddresses(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error) { … } func getCloudTaint(taints []v1.Taint) *v1.Taint { … } func excludeCloudTaint(taints []v1.Taint) []v1.Taint { … } func getNodeAddressesByProviderIDOrName(ctx context.Context, instances cloudprovider.Instances, providerID, nodeName string) ([]v1.NodeAddress, error) { … } func nodeAddressesChangeDetected(addressSet1, addressSet2 []v1.NodeAddress) bool { … } func updateNodeAddressesFromNodeIP(node *v1.Node, nodeAddresses []v1.NodeAddress) ([]v1.NodeAddress, error) { … } // getInstanceTypeByProviderIDOrName will attempt to get the instance type of node using its providerID // then it's name. If both attempts fail, an error is returned. func getInstanceTypeByProviderIDOrName(ctx context.Context, instances cloudprovider.Instances, providerID, nodeName string) (string, error) { … } // getZoneByProviderIDorName will attempt to get the zone of node using its providerID // then it's name. If both attempts fail, an error is returned. func getZoneByProviderIDOrName(ctx context.Context, zones cloudprovider.Zones, providerID, nodeName string) (cloudprovider.Zone, error) { … }