Skip to content

Commit

Permalink
Fix #7991: ensure kubelet_shutdown_grace_period and kubelet_shutdown_…
Browse files Browse the repository at this point in the history
…grace_period_critical_pods are compared as integers
  • Loading branch information
cristicalin committed Sep 20, 2021
1 parent 6f79112 commit 8b35bfd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion roles/kubernetes/preinstall/tasks/0020-verify-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

- name: Stop when ShutdownGracePeriod less than ShutdownGracePeriodCriticalPods
assert:
that: kubelet_shutdown_grace_period > kubelet_shutdown_grace_period_critical_pods
that: kubelet_shutdown_grace_period|int > kubelet_shutdown_grace_period_critical_pods|int
msg: "ShutdownGracePeriod ({{ kubelet_shutdown_grace_period }}) needs to be greater than ShutdownGracePeriodCriticalPods ({{ kubelet_shutdown_grace_period_critical_pods }}) in order to give normal pods time to be evacuated, please see https://kubernetes.io/blog/2021/04/21/graceful-node-shutdown-beta/ for details"
when:
- kube_version is version('v1.21.0', '>=')
Expand Down
4 changes: 4 additions & 0 deletions roles/kubespray-defaults/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ kube_profiling: false

# Graceful Node Shutdown
# This requires kubernetes >= 1.21.0
#
# Note, when using both kubelet_shutdown_grace_period and kubelet_shutdown_grace_period_critical_pods
# ensure to use the same meaasurement unit (i.e. s=seconds, m=minutes) because ansible is not aware
# of the variable type and can cause an assertion failure when validating your input
kubelet_shutdown_grace_period: 60s
# kubelet_shutdown_grace_period_critical_pods should be less than kubelet_shutdown_grace_period
# to give normal pods time to be gracefully evacuated
Expand Down

0 comments on commit 8b35bfd

Please sign in to comment.