-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
📖 Update tutorial to use cancel context to stop manager #2379
Conversation
Welcome @erikgb! |
Hi @erikgb. Thanks for your PR. I'm waiting for a kubernetes-sigs 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 |
56e04ce
to
7bfac29
Compare
@estroz Do you have any idea why all jobs are failing now? It seems like the control-plane never comes up, but I am not sure why... |
Looking into it. |
Etcd is not starting locally for me either with 1.22 🤷♂️. 1.21.4 works though, so change it to that for now. |
7bfac29
to
ae10777
Compare
|
@estroz Maybe we should postpone the K8s upgrade? The tests for kubebuilder v2 (that are failing) uses controller-tools v0.3.0, and I do not think that version supports K8s version >= 1.20. |
ae10777
to
cee3646
Compare
Sounds good |
cee3646
to
d335014
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: erikgb, estroz 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 |
Not sure what caused the problems with
I got |
This cancels the context to cause the API server to properly shut down at the conclusion of the tests. Ref: kubernetes-sigs/controller-runtime#1571 Ref: kubernetes-sigs/kubebuilder#2379 Signed-off-by: John Strunk <jstrunk@redhat.com>
PR openshift#307 was too optimistic. The original issue worked around by 053f866 still exists actually ; `make test` is now failing with : [FAILED] Unexpected error: <errors.aggregate | len:1, cap:1>: [ <*errors.errorString | 0xc0005ebf80>{ s: "timeout waiting for process kube-apiserver to stop", }, ] timeout waiting for process kube-apiserver to stop occurred This is caused by a missing cancellation of the certwatcher in the controller-runtime. The fix, as documented in [1], is to create a cancellable context, pass it to envtest and cancel it just before tearing down the test. [1] kubernetes-sigs/kubebuilder#2379 Signed-off-by: Greg Kurz <groug@kaod.org>
This PR introduces a cancellable context in the tutorial controller test suite. This context is used to start the manager in the test suite startup, and context is cancelled before initiating the testEnv shutdown in
AfterSuite
. This seems to fix kubernetes-sigs/controller-runtime#1571, and I think this issue should be closed - as not a problem (in controller-runtime).The PR also reverts the workaround for this issue introduced in #2302.
It seems like this pattern is already in use in the webhook test suite, so I also removed some uneeded non-nil error ifs in those files.
Note to reviewer: I am uncertain if more needs to be updated.... It seems like the skaffolding of the controller test suite could include more, but I didn't want to extend it as part of this fix.