// registerWithAPIServer registers the node with the cluster master. It is safe // to call multiple times, but not concurrently (kl.registrationCompleted is // not locked). func (kl *Kubelet) registerWithAPIServer() { … } // tryRegisterWithAPIServer makes an attempt to register the given node with // the API server, returning a boolean indicating whether the attempt was // successful. If a node with the same name already exists, it reconciles the // value of the annotation for controller-managed attach-detach of attachable // persistent volumes for the node. func (kl *Kubelet) tryRegisterWithAPIServer(node *v1.Node) bool { … } // reconcileHugePageResource will update huge page capacity for each page size and remove huge page sizes no longer supported func (kl *Kubelet) reconcileHugePageResource(initialNode, existingNode *v1.Node) bool { … } // Zeros out extended resource capacity during reconciliation. func (kl *Kubelet) reconcileExtendedResource(initialNode, node *v1.Node) bool { … } // updateDefaultResources will set the default resources on the existing node according to the initial node func updateDefaultResources(initialNode, existingNode *v1.Node) bool { … } // updateDefaultLabels will set the default labels on the node func (kl *Kubelet) updateDefaultLabels(initialNode, existingNode *v1.Node) bool { … } // reconcileCMADAnnotationWithExistingNode reconciles the controller-managed // attach-detach annotation on a new node and the existing node, returning // whether the existing node must be updated. func (kl *Kubelet) reconcileCMADAnnotationWithExistingNode(node, existingNode *v1.Node) bool { … } // initialNode constructs the initial v1.Node for this Kubelet, incorporating node // labels, information from the cloud provider, and Kubelet configuration. func (kl *Kubelet) initialNode(ctx context.Context) (*v1.Node, error) { … } // fastNodeStatusUpdate is a "lightweight" version of syncNodeStatus which doesn't hit the // apiserver except for the final run, to be called by fastStatusUpdateOnce in each loop. // It holds the same lock as syncNodeStatus and is thread-safe when called concurrently with // syncNodeStatus. Its return value indicates whether the loop running it should exit // (final run), and it also sets kl.containerRuntimeReadyExpected. func (kl *Kubelet) fastNodeStatusUpdate(ctx context.Context, timeout bool) (completed bool) { … } // syncNodeStatus should be called periodically from a goroutine. // It synchronizes node status to master if there is any change or enough time // passed from the last sync, registering the kubelet first if necessary. func (kl *Kubelet) syncNodeStatus() { … } // updateNodeStatus updates node status to master with retries if there is any // change or enough time passed from the last sync. func (kl *Kubelet) updateNodeStatus(ctx context.Context) error { … } // tryUpdateNodeStatus tries to update node status to master if there is any // change or enough time passed from the last sync. func (kl *Kubelet) tryUpdateNodeStatus(ctx context.Context, tryNumber int) error { … } // updateNode creates a copy of originalNode and runs update logic on it. // It returns the updated node object and a bool indicating if anything has been changed. func (kl *Kubelet) updateNode(ctx context.Context, originalNode *v1.Node) (*v1.Node, bool) { … } // patchNodeStatus patches node on the API server based on originalNode. // It returns any potential error, or an updatedNode and refreshes the state of kubelet when successful. func (kl *Kubelet) patchNodeStatus(originalNode, node *v1.Node) (*v1.Node, error) { … } // markVolumesFromNode updates volumeManager with VolumesInUse status from node. // // In the case of node status update being unnecessary, call with the fetched node. // We must mark the volumes as ReportedInUse in volume manager's dsw even // if no changes were made to the node status (no volumes were added or removed // from the VolumesInUse list). // // The reason is that on a kubelet restart, the volume manager's dsw is // repopulated and the volume ReportedInUse is initialized to false, while the // VolumesInUse list from the Node object still contains the state from the // previous kubelet instantiation. // // Once the volumes are added to the dsw, the ReportedInUse field needs to be // synced from the VolumesInUse list in the Node.Status. // // The MarkVolumesAsReportedInUse() call cannot be performed in dsw directly // because it does not have access to the Node object. // This also cannot be populated on node status manager init because the volume // may not have been added to dsw at that time. // // Or, after a successful node status update, call with updatedNode returned from // the patch call, to mark the volumeInUse as reportedInUse to indicate // those volumes are already updated in the node's status func (kl *Kubelet) markVolumesFromNode(node *v1.Node) { … } // recordNodeStatusEvent records an event of the given type with the given // message for the node. func (kl *Kubelet) recordNodeStatusEvent(eventType, event string) { … } // recordEvent records an event for this node, the Kubelet's nodeRef is passed to the recorder func (kl *Kubelet) recordEvent(eventType, event, message string) { … } // record if node schedulable change. func (kl *Kubelet) recordNodeSchedulableEvent(ctx context.Context, node *v1.Node) error { … } // setNodeStatus fills in the Status fields of the given Node, overwriting // any fields that are currently set. // TODO(madhusudancs): Simplify the logic for setting node conditions and // refactor the node status condition code out to a different file. func (kl *Kubelet) setNodeStatus(ctx context.Context, node *v1.Node) { … } func (kl *Kubelet) setLastObservedNodeAddresses(addresses []v1.NodeAddress) { … } func (kl *Kubelet) getLastObservedNodeAddresses() []v1.NodeAddress { … } // defaultNodeStatusFuncs is a factory that generates the default set of // setNodeStatus funcs func (kl *Kubelet) defaultNodeStatusFuncs() []func(context.Context, *v1.Node) error { … } // Validate given node IP belongs to the current host func validateNodeIP(nodeIP net.IP) error { … } // nodeStatusHasChanged compares the original node and current node's status and // returns true if any change happens. The heartbeat timestamp is ignored. func nodeStatusHasChanged(originalStatus *v1.NodeStatus, status *v1.NodeStatus) bool { … } // nodeConditionsHaveChanged compares the original node and current node's // conditions and returns true if any change happens. The heartbeat timestamp is // ignored. func nodeConditionsHaveChanged(originalConditions []v1.NodeCondition, conditions []v1.NodeCondition) bool { … }