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

Lazily initialize signal handling for hyperkube apiserver and kubelet #76659

Conversation

@S-Chan
Copy link
Contributor

commented Apr 16, 2019

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

/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?:

Signal handling is initialized within hyperkube commands that require it (apiserver, kubelet)
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Apr 16, 2019

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.

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Apr 16, 2019

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot requested review from caesarxuchao and dims Apr 16, 2019

@S-Chan S-Chan force-pushed the S-Chan:stephen_chan--lazy_initialize_signal_handling branch from 8c0a8f7 to 7a75908 Apr 16, 2019

@S-Chan

This comment has been minimized.

Copy link
Contributor Author

commented Apr 16, 2019

Signed the CLA

@S-Chan

This comment has been minimized.

Copy link
Contributor Author

commented Apr 17, 2019

/assign @mikedanese

@mattjmcnaughton
Copy link
Contributor

left a comment

/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.

@S-Chan

This comment has been minimized.

Copy link
Contributor Author

commented Apr 18, 2019

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.

@roycaihw

This comment has been minimized.

Copy link
Member

commented Apr 19, 2019

/lgtm

I'm not sure about test convention for cmd

// 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)

This comment has been minimized.

Copy link
@mikedanese

mikedanese Apr 23, 2019

Member

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.

This comment has been minimized.

Copy link
@S-Chan

S-Chan May 6, 2019

Author Contributor

Do you mean kubeapiserver.NewAPIServerCommand(server.SetupSignalHandler())? This can't be done as all command functions are called during commandFor.

@sttts

This comment has been minimized.

Copy link
Contributor

commented Apr 24, 2019

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.

@sttts sttts added priority/important-soon and removed lgtm labels Apr 24, 2019

@justaugustus justaugustus added this to Backlog in SIG Release Apr 28, 2019

@S-Chan S-Chan force-pushed the S-Chan:stephen_chan--lazy_initialize_signal_handling branch 2 times, most recently from 5ce0320 to 71687d6 May 6, 2019

@S-Chan

This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2019

@sttts thanks for the suggestion, I've moved SetupSignalHandler into kubelet and apiserver.

@S-Chan

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2019

/retest

@S-Chan

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2019

/test pull-kubernetes-local-e2e

@mikedanese

This comment has been minimized.

Copy link
Member

commented May 10, 2019

/approve

Needs a rebase, otherwise looks good.

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented May 10, 2019

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@S-Chan S-Chan force-pushed the S-Chan:stephen_chan--lazy_initialize_signal_handling branch from 71687d6 to 7cbe2d6 May 10, 2019

@S-Chan

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2019

/test pull-kubernetes-local-e2e

@mikedanese

This comment has been minimized.

Copy link
Member

commented May 10, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label May 10, 2019

@fejta-bot

This comment has been minimized.

Copy link

commented May 10, 2019

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 21bec91 into kubernetes:master May 10, 2019

19 of 20 checks passed

pull-kubernetes-local-e2e Job triggered.
Details
cla/linuxfoundation S-Chan authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details

SIG Release automation moved this from Backlog to Done May 10, 2019

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented May 10, 2019

@S-Chan: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e 7cbe2d6 link /test pull-kubernetes-local-e2e

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.