-
Notifications
You must be signed in to change notification settings - Fork 41.6k
[FG:PodObservedGenerationTracking] kubelet sets observedGeneration on pod conditions #130573
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
Conversation
|
Skipping CI for Draft Pull Request. |
|
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/priority important-soon |
|
/assign @liggitt |
|
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the narrow change to the pkg/api helper looks fine... I left one comment about trying to improve the naming of that function in the future to avoid confusing people
once all the implementation changes are reviewed / approved, tag me for API package approval
| // the API server preserving existing values when an incoming update tries to clear it. | ||
| func GetPodObservedGenerationIfEnabledOnCondition(pod *v1.Pod, conditionType v1.PodConditionType) int64 { | ||
| if pod == nil { | ||
| func GetPodObservedGenerationIfEnabledOnCondition(podStatus *v1.PodStatus, generation int64, conditionType v1.PodConditionType) int64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(preexisting / non-blocking)
rereading this, the function name / godoc on this function and the function above are confusing... it sounds like they will return observedGeneration, but they are returning generation
I'm having a hard time coming up with an alternative name that isn't ridiculously long, but I think the current names will lead to callers accidentally using these incorrectly
as a follow-up, consider if we can name these better to make it clearer the thing being returned is the passed-in generation or 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CalculatePodStatusObservedGeneration and CalculatePodConditionObservedGeneration maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll submit a follow up
| Reason: v1.PodReasonTerminationByKubelet, | ||
| Message: message, | ||
| Type: v1.DisruptionTarget, | ||
| ObservedGeneration: podutil.GetPodObservedGenerationIfEnabledOnCondition(&pod.Status, pod.Generation, v1.DisruptionTarget), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to get a little messy, but I don't think we can use pod.Status here. This condition gets passed to evictPod which in turn calls killPodFunc with a status-updating method. This should use the status that's passed in to that function.
Here's what I think you should do:
- Unconditionally set
ObservedGeneration: pod.Generationhere - Before
UpdatePodConditionis called (line 622), update the observed generation withGetPodObservedGenerationIfEnabledOnCondition:
if condition != nil {
+ condition.ObservedGeneration = podutil.GetPodObservedGenerationIfEnabledOnCondition(status, condition.ObservedGeneration, condition.Type)
podutil.UpdatePodCondition(status, condition)
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, you could consider making this part of UpdatePodCondition, but that's a bigger change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, your comment made me think way harder about what is going on here (what I should have been doing to begin with)
fixed!
1625ebf to
fd59aed
Compare
fd59aed to
4c2be4b
Compare
|
/lgtm |
|
LGTM label has been added. Git tree hash: 4c07a7d235b8caf490c38e719cd811ec0b39b39c
|
|
/approve for api helper function signature change |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hashim21223445, liggitt, natasha41575, tallclair The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR has the kubelet set the condition's
observedGenerationfield as discussed in https://kep.k8s.io/5067.Which issue(s) this PR fixes:
Pod generation KEP: https://kep.k8s.io/5067
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: