Skip to content

Commit

Permalink
fix: Waiting until Volumes will be detached from the node on graceful…
Browse files Browse the repository at this point in the history
… node removal
  • Loading branch information
Andrii Zahorodniuk committed Apr 21, 2022
1 parent 2c2d451 commit f23276d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions roles/remove-node/pre-remove/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,16 @@
until: result.rc == 0 or allow_ungraceful_removal
retries: "{{ drain_retries }}"
delay: "{{ drain_retry_delay_seconds }}"

- name: remove-node | Wait until Volumes will be detached from the node
command: >-
{{ kubectl }} get volumeattachments -o go-template={% raw %}'{{ range .items }}{{ .spec.nodeName }}{{ "\n" }}{{ end }}'{% endraw %}
register: nodes_with_volumes
delegate_to: "{{ groups['kube_control_plane']|first }}"
changed_when: false
until: not (kube_override_hostname|default(inventory_hostname) in nodes_with_volumes.stdout_lines)
retries: 3
delay: "{{ drain_grace_period }}"
when:
- not allow_ungraceful_removal
- kube_override_hostname|default(inventory_hostname) in nodes.stdout_lines

0 comments on commit f23276d

Please sign in to comment.