Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions roles/cleanup_openstack/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
value: []
when: rabbitmq_cell1_info.resources | default([]) | length > 0

- name: Delete deployment CRs
- name: Delete deployment CRs (Phase 1 - Application Resources)
vars:
_stages_crs: >-
{{
Expand All @@ -99,11 +99,6 @@
_external_dns_crs:
- "{{ cifmw_manifests_dir }}/cifmw_external_dns/ceph-local-dns.yml"
- "{{ cifmw_manifests_dir }}/cifmw_external_dns/ceph-local-cert.yml"
_operators_crs:
- "{{ cifmw_kustomize_deploy_nmstate_dest_file }}"
- "{{ cifmw_kustomize_deploy_metallb_dest_file }}"
- "{{ cifmw_kustomize_deploy_kustomizations_dest_dir }}/openstack.yaml"
- "{{ cifmw_kustomize_deploy_olm_dest_file }}"
_bmh_crs: >-
{{
bmh_crs.files |
Expand All @@ -121,11 +116,43 @@
_external_dns_crs +
_stages_crs_path +
_bmh_crs +
_bmh_secrets_crs +
_operators_crs
_bmh_secrets_crs
}}
ansible.builtin.import_tasks: cleanup_crs.yaml

- name: Wait for Phase 1 resources to be deleted
kubernetes.core.k8s_info:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
api_key: "{{ cifmw_openshift_token | default(omit) }}"
context: "{{ cifmw_openshift_context | default(omit) }}"
namespace: "{{ cifmw_openstack_namespace }}"
kind: "{{ item }}"
api_version: "{{ api_versions[item] }}"
register: _phase1_resources
until: _phase1_resources.resources | default([]) | length == 0
retries: 60
delay: 10
loop:
- OpenStackControlPlane
- OpenStackDataPlaneNodeSet
- OpenStackDataPlaneDeployment
vars:
api_versions:
OpenStackControlPlane: core.openstack.org/v1beta1
OpenStackDataPlaneNodeSet: dataplane.openstack.org/v1beta1
OpenStackDataPlaneDeployment: dataplane.openstack.org/v1beta1
failed_when: false

- name: Delete deployment CRs (Phase 2 - Operators)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(non-blocking) suggestion: Might be a good addition checking if previous phase has ended before running phase 2 ?

vars:
_operators_crs:
- "{{ cifmw_kustomize_deploy_nmstate_dest_file }}"
- "{{ cifmw_kustomize_deploy_metallb_dest_file }}"
- "{{ cifmw_kustomize_deploy_kustomizations_dest_dir }}/openstack.yaml"
- "{{ cifmw_kustomize_deploy_olm_dest_file }}"
_crs_to_delete: "{{ _operators_crs }}"
ansible.builtin.import_tasks: cleanup_crs.yaml

- name: Get artifacts scripts
ansible.builtin.find:
path: "{{ cifmw_kustomize_deploy_basedir }}/artifacts"
Expand Down
Loading