Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments to clarify the updated logic in kubelet's status_manager #113718

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions pkg/kubelet/status/status_manager.go
Expand Up @@ -894,12 +894,16 @@ func mergePodStatus(oldPodStatus, newPodStatus v1.PodStatus, couldHaveRunningCon
if kubetypes.PodConditionByKubelet(c.Type) {
podConditions = append(podConditions, c)
} else if kubetypes.PodConditionSharedByKubelet(c.Type) {
// we replace or append all the "shared by kubelet" conditions
if c.Type == v1.AlphaNoCompatGuaranteeDisruptionTarget {
// update the pod disruption condition only if transitioning to terminal phase. In particular, check if
// there might still be running containers to avoid sending an unnecessary PATCH request if the
// actual transition is delayed (see below)
// guard the update of the DisruptionTarget condition with a check to ensure
// it will only be sent once all containers have terminated and the phase
// is terminal. This avoids sending an unnecessary patch request to add
// the condition if the actual status phase transition is delayed.
if transitioningToTerminalPhase && !couldHaveRunningContainers {
// update the LastTransitionTime
// update the LastTransitionTime again here because the older transition
// time set in updateStatusInternal is likely stale as sending of
// the condition was delayed until all pod's containers have terminated.
updateLastTransitionTime(&newPodStatus, &oldPodStatus, c.Type)
if _, c := podutil.GetPodConditionFromList(newPodStatus.Conditions, c.Type); c != nil {
// for shared conditions we update or append in podConditions
Expand Down