-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Lazily initialize signal handling for hyperkube apiserver and kubelet #76659
Lazily initialize signal handling for hyperkube apiserver and kubelet #76659
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Hi @S-Chan. 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. |
8c0a8f7
to
7a75908
Compare
Signed the CLA |
/assign @mikedanese |
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
/ok-to-test
Just for discussion - thoughts on if there would be a good way to unit test this? I feel like a full e2e test is overkill, but it would be interesting to think about how much lift it would be to write a unit test.
But also, I'm not sure how much that often happens for Kubernetes cmd
.
Thanks @mattjmcnaughton for the review! I feel like it's hard to avoid writing an integration test (maybe overkill) or testing implementation details for this fix. Definitely open to suggestions though. |
On Thu, Apr 18, 2019 at 12:18:24PM -0700, Stephen Chan wrote:
Thanks @mattjmcnaughton for the review!
I feel like it's hard to avoid writing an integration test (maybe overkill) or testing implementation details for this fix. Definitely open to suggestions though.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#76659 (comment)
Yeah, tbh I'm not positive what is the best practice here - I defer to other
members of the community :)
|
/lgtm I'm not sure about test convention for cmd |
cmd/hyperkube/main.go
Outdated
// these have to be functions since the command is polymorphic. Cobra wants you to be top level | ||
// command to get executed | ||
apiserver := func() *cobra.Command { | ||
ret := kubeapiserver.NewAPIServerCommand(stopCh) | ||
ret := kubeapiserver.NewAPIServerCommand(server.SetupSignalHandler) |
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.
Just call kubeapiserver.NewAPIServerCommand(server.SetupSignalHandler)
here and don't modify the other files? You'll get your laziness without mucking with the signatures of the other app packages.
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.
Do you mean kubeapiserver.NewAPIServerCommand(server.SetupSignalHandler())
? This can't be done as all command functions are called during commandFor
.
Why don't we move the SetupSignalHandler call into the commands themselves? Having this indirectional looks complex and it's not even used if I have not missed anything. |
5ce0320
to
71687d6
Compare
@sttts thanks for the suggestion, I've moved SetupSignalHandler into kubelet and apiserver. |
/retest |
/test pull-kubernetes-local-e2e |
/approve Needs a rebase, otherwise looks good. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mikedanese, S-Chan 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 |
… of hyperkube main command
71687d6
to
7cbe2d6
Compare
/test pull-kubernetes-local-e2e |
/lgtm |
/retest Review the full test history for this PR. Silence the bot with an |
@S-Chan: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
https://github.com/kubernetes/kubernetes/pull/63859/files#diff-dfaeb837c577bcd60dd9105c43427a35R52 initializes signal handling for all hyperkube commands. The function returns a stopCh that can be used by subcommands (e.g. apiserver, kubelet). However, not all subcommands make use of the stopCh. These subcommands (kube proxy, controller manager, etc) then require sending SIGTERM/SIGINT twice before exiting. Instead, we can initialize signal handling when the subcommand is actually run.
Which issue(s) this PR fixes:
Fixes #72029
Special notes for your reviewer:
Does this PR introduce a user-facing change?: