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
kubectl wait ensures observedGeneration >= generation #97408
Conversation
@KnicKnic: 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/test-infra repository. |
Hi @KnicKnic. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
/ok-to-test |
/retest |
/assign @brianpursley |
/assign @seans3 |
@KnicKnic See kubernetes/kubectl#962 (comment). I'm trying to understand the scenario where the current wait functionality doesn't work. Can you provide an example? |
I originally replied, here, I have moved the post to kubernetes/kubectl#962 (comment) |
Thank you for the very detailed explanation @KnicKnic . I think it makes sense and illustrates the problem. So basically whenever there is an observedGeneration < generation then you know there is some change pending that hasn't been observed yet. You can't be 100% certain that whatever change is pending is relevant to what you are waiting for, but by waiting for the observed generation to catch up to the generation, then you can know that you are looking at the latest status conditions and avoid a potential "false positive" when waiting for that condition. It looks like your PR will handle cases where the resource might not have an observedGeneration (that's good), or in case where the observedGeneration is either at the status or the condition level. I see that observedGeneration is at the status level for deployments, replicasets, and statefulsets. I am not aware of where it is at the condition level. I don't have a problem with that per-se, but would want to get others opinions if this is introducing a new convention that is not already in use. Feel free to correct me if I am wrong about this, because I'm just not too familiar with observedGeneration. Aside from that, I think this seems like an OK change. It looks like you might be missing a test case around testing when observedGeneration is on status, not condition (I'll leave a comment in the review). I'd like to hear some of the other reviewers chime in with their thoughts on this. |
@brianpursley observedGeneration is used in kubernetes(itself) on a condition in not many places
apiMachinery uses it -
One thing about allowing observedgeneration to be different per condition. It allows 2 scenarios (that I can think of).
My scenarios was that I am using ApiMachinery conditions for my controller so I should respect the observedGeneration in those objects. Also to future proof against 1 & 2. |
@dixudx @pwittrock Any thoguhts? |
@brianpursley kubernetes/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go Lines 1369 to 1374 in 77b194a
|
@KnicKnic Thanks, I see that now. I guess I didn't notice that b/c it is in so many other Status types and only one place there. Given that ObservedGeneration can occur at both Status and Condition and it looks like you're handling both cases, I think this looks fine. /lgtm |
/assign @seans3 |
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.
/lgtm
Thanks for investing in the tests.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brianpursley, KnicKnic, seans3 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 |
/retest I think these failures are from Docker Hub rate limiting? I'm still getting caught up from a break so not sure if this has been encountered recently. |
/retest |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Ensures that kubectl wait checks observedGeneration >= generation of the object before completing if observedGeneration exists (on either .status.conditions or .status).
Why is this needed:
script does the following
True
->False
when the controller will update the statusTrue
However if the controller that updates the status has yet to realize the change and reset it to false by the time step 2 runs, kubectl will return immediately as the condition reflects stale state.
Which issue(s) this PR fixes:
Fixes kubernetes/kubectl#962
Special notes for your reviewer:
Does this PR introduce a user-facing change?: