Skip to content

Commit

Permalink
fix: Delete node when node name contains domain name as suffix (#237)
Browse files Browse the repository at this point in the history
Delete node does not work when ocp is using full guqlifed node names
(with domain name suffix).

Signed-off-by: Klaus Smolin <[email protected]>
  • Loading branch information
smolin-de authored Jan 17, 2024
1 parent d2c4b03 commit 637eca9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions roles/delete_compute_node/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
echo "INFO: Node '{{ param_compute_node.vm_hostname }}' not found or is already deleted"
exit 0
fi
oc adm cordon {{ param_compute_node.vm_hostname | lower }}
oc adm drain {{ param_compute_node.vm_hostname | lower }} --force --delete-emptydir-data --ignore-daemonsets --timeout=30s
oc delete nodes {{ param_compute_node.vm_hostname | lower }}
NODE=$(oc get nodes --no-headers=true | grep "^{{ param_compute_node.vm_hostname | lower }}" | cut -f 1 -d " ")
oc adm cordon "${NODE}"
oc adm drain "${NODE}" --force --delete-emptydir-data --ignore-daemonsets --timeout=30s
oc delete nodes "${NODE}"
register: cmd_output
- name: Print cmd output
ansible.builtin.debug:
Expand Down

0 comments on commit 637eca9

Please sign in to comment.