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

Allow pausing after upgrade but before uncordon #8530

Merged
merged 2 commits into from
Feb 16, 2022
Merged

Allow pausing after upgrade but before uncordon #8530

merged 2 commits into from
Feb 16, 2022

Conversation

mac-chaffee
Copy link
Contributor

@mac-chaffee mac-chaffee commented Feb 10, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:
Since performing Kubernetes upgrades requires draining all the nodes in sequence, that is an excellent time to perform other maintenance tasks like rebooting to apply kernel upgrades, upgrading packages, or other manual changes. For complex upgrades, it may also be nice to leave a node cordoned after the upgrade to inspect it before allowing it to run workloads.

So this PR adds two optional variables so that users can either be prompted before uncordoning an upgraded node, or just wait a specified duration (just like the pre-upgrade promp/delay setting). The default behavior (no prompting, no delay) is left intact.

Which issue(s) this PR fixes:
Provides a workaround for #8535

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Added the optional prompt or delay before uncordoning nodes after upgrades (see variable `upgrade_node_post_upgrade_confirm`).

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 10, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @mac-chaffee!

It looks like this is your first PR to kubernetes-sigs/kubespray 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubespray has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @mac-chaffee. 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 /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 added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 10, 2022
@mac-chaffee
Copy link
Contributor Author

Helps address #8535

@mac-chaffee
Copy link
Contributor Author

Actually this would be better as a post-upgrade pause, like

- name: Wait before upgrade node

I'll implement it that way

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 11, 2022
@mac-chaffee mac-chaffee changed the title Allow nodes to stay cordoned after upgrade for manual inspection Allow pausing after upgrade but before uncordon Feb 11, 2022
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 11, 2022
@mac-chaffee
Copy link
Contributor Author

/hold remove

@mac-chaffee
Copy link
Contributor Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 11, 2022
Copy link
Member

@floryut floryut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mac-chaffee Thank you

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: floryut, mac-chaffee

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 15, 2022
@mac-chaffee
Copy link
Contributor Author

Looks like I need an ok-to-test approval as well

@oomichi
Copy link
Contributor

oomichi commented Feb 16, 2022

/lgtm
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 16, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 16, 2022
@k8s-ci-robot k8s-ci-robot merged commit 0f73d87 into kubernetes-sigs:master Feb 16, 2022
@mac-chaffee
Copy link
Contributor Author

mac-chaffee commented Feb 17, 2022

Turns out this might not have the desired effect due to another sort of bug: The "uncordon" step (and thus the prompt) occurs BEFORE all the handlers, which reload systemd and restart kubelet. So the second the node gets uncordoned, kubelet gets rebooted, which may cause issues for pods that were immediately scheduled on that node.

So we actually need to move the prompt and the uncordon step after the handlers, maybe making them handlers as well.

@mac-chaffee
Copy link
Contributor Author

oh and the message "Ready to uncordon node?" may not always be accurate. If the node was already cordoned, uncordoning will be skipped, so the prompt could be confusing.

Quehenr pushed a commit to Quehenr/unstable-laboratory-infrastructure-kubespray that referenced this pull request Feb 18, 2022
* master:
  Configure Etcd container_manager explicitly (kubernetes-sigs#8521)
  Fix print_hostnames of inventory.py (kubernetes-sigs#8554)
  Fix etcd_events not getting upgraded in upgrade-cluster.yml (kubernetes-sigs#8550)
  nerdctl: upgrade to 0.16.1 (kubernetes-sigs#8539)
  Allow pausing after upgrade but before uncordon (kubernetes-sigs#8530)
  [calico] upgrade release checksums (kubernetes-sigs#8544)
  Allow to specify a source address for metallb peerings, and target only some nodes using node selectors (kubernetes-sigs#8534)
  add support for Dual Stack node InternalIP (kubernetes-sigs#8542)
  terraform/gcp: Allow to change extra disk types (kubernetes-sigs#8524)
  add support for Calico IP6_AUTODETECTION_METHOD (kubernetes-sigs#8541)
  implement download mirrors support (kubernetes-sigs#8474)
  Fix: Error when creating subnets more than AZ (kubernetes-sigs#8516)
  feat(offline): Improve generate_list.sh to generate offline file list using ansible (kubernetes-sigs#8537) (kubernetes-sigs#8538)
  docs: Update offline-environment.md for containerd (kubernetes-sigs#8520) (kubernetes-sigs#8523)
  Change Cilium setting identity_allocation_mode to cilium_identity_allocation_mode (kubernetes-sigs#8519)
  Fix wrong port name in metallb.yml.j2 (kubernetes-sigs#8510)
rtsp pushed a commit to rtsp/kubespray that referenced this pull request Mar 8, 2022
* Allow pausing after upgrade but before uncordon

* Expand docs for upgrade pausing vars

Signed-off-by: Mac Chaffee <[email protected]>
sakuraiyuta pushed a commit to sakuraiyuta/kubespray that referenced this pull request Apr 16, 2022
* Allow pausing after upgrade but before uncordon

* Expand docs for upgrade pausing vars

Signed-off-by: Mac Chaffee <[email protected]>
@oomichi oomichi mentioned this pull request May 28, 2022
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jun 29, 2023
* Allow pausing after upgrade but before uncordon

* Expand docs for upgrade pausing vars

Signed-off-by: Mac Chaffee <[email protected]>
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Oct 21, 2023
* Allow pausing after upgrade but before uncordon

* Expand docs for upgrade pausing vars

Signed-off-by: Mac Chaffee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants