make pre-remove node draining a failable task (#6442)

and add configuration to allow ungraceful removal
This commit is contained in:
Lars 2020-08-21 09:13:39 +02:00 committed by GitHub
parent 0c09ec5d13
commit ca66a96d0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -1,3 +1,4 @@
---
allow_ungraceful_removal: false
drain_grace_period: 300
drain_timeout: 360s

View file

@ -4,7 +4,7 @@
{{ bin_dir }}/kubectl cordon {{ hostvars[item]['kube_override_hostname']|default(item) }}
with_items:
- "{{ node.split(',') | default(groups['kube-node']) }}"
failed_when: false
failed_when: result.rc == 0 and not allow_ungraceful_removal
delegate_to: "{{ groups['kube-master']|first }}"
run_once: true
ignore_errors: yes
@ -19,7 +19,7 @@
--delete-local-data {{ hostvars[item]['kube_override_hostname']|default(item) }}
with_items:
- "{{ node.split(',') | default(groups['kube-node']) }}"
failed_when: false
failed_when: result.rc == 0 and not allow_ungraceful_removal
delegate_to: "{{ groups['kube-master']|first }}"
run_once: true
ignore_errors: yes