From 2ac379a38e87539e4f498239882240170ab699c0 Mon Sep 17 00:00:00 2001 From: jarpat Date: Thu, 27 Jun 2024 11:43:02 -0400 Subject: [PATCH 1/4] initial changes --- roles/monitoring/tasks/main.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/roles/monitoring/tasks/main.yaml b/roles/monitoring/tasks/main.yaml index eb6ee5dd..8db1ad52 100644 --- a/roles/monitoring/tasks/main.yaml +++ b/roles/monitoring/tasks/main.yaml @@ -50,6 +50,30 @@ tags: - cluster-logging +- name: V4M - check if storage class is being used + ansible.builtin.shell: | + kubectl --kubeconfig {{ KUBECONFIG }} get pv --output=custom-columns='PORT:.spec.storageClassName' | grep -o v4m | wc -l + register: sc_users + when: + - PROVIDER is not none + - PROVIDER in ["azure","aws","gcp"] + - V4_CFG_MANAGE_STORAGE is not none + - V4_CFG_MANAGE_STORAGE|bool + tags: + - uninstall + +- name: V4M - storageclass uninstall status + debug: + msg: "{{ sc_users.stdout }} Persistent Volumes still referring to the v4m Storage Class, skipping deletion" + when: + - PROVIDER is not none + - PROVIDER in ["azure","aws","gcp"] + - V4_CFG_MANAGE_STORAGE is not none + - V4_CFG_MANAGE_STORAGE|bool + - sc_users.stdout | int > 0 + tags: + - uninstall + - name: V4M - remove storageclass kubernetes.core.k8s: kubeconfig: "{{ KUBECONFIG }}" @@ -60,5 +84,6 @@ - PROVIDER == "azure" - V4_CFG_MANAGE_STORAGE is not none - V4_CFG_MANAGE_STORAGE|bool + - sc_users.stdout | int == 0 tags: - uninstall From cee21a1ca3e0a831854bf75bc2226f5000254ad6 Mon Sep 17 00:00:00 2001 From: jarpat Date: Thu, 27 Jun 2024 11:44:40 -0400 Subject: [PATCH 2/4] use full name for task --- roles/monitoring/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/monitoring/tasks/main.yaml b/roles/monitoring/tasks/main.yaml index 8db1ad52..9d867b88 100644 --- a/roles/monitoring/tasks/main.yaml +++ b/roles/monitoring/tasks/main.yaml @@ -63,7 +63,7 @@ - uninstall - name: V4M - storageclass uninstall status - debug: + ansible.builtin.debug: msg: "{{ sc_users.stdout }} Persistent Volumes still referring to the v4m Storage Class, skipping deletion" when: - PROVIDER is not none From 1a6a08edf4ef82d01641afc0fdb5677c1ca3c164 Mon Sep 17 00:00:00 2001 From: jarpat Date: Thu, 27 Jun 2024 15:20:14 -0400 Subject: [PATCH 3/4] reword --- roles/monitoring/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/monitoring/tasks/main.yaml b/roles/monitoring/tasks/main.yaml index 9d867b88..c90b78d9 100644 --- a/roles/monitoring/tasks/main.yaml +++ b/roles/monitoring/tasks/main.yaml @@ -64,7 +64,7 @@ - name: V4M - storageclass uninstall status ansible.builtin.debug: - msg: "{{ sc_users.stdout }} Persistent Volumes still referring to the v4m Storage Class, skipping deletion" + msg: "Persistent Volumes still referring to the v4m Storage Class, skipping deletion" when: - PROVIDER is not none - PROVIDER in ["azure","aws","gcp"] From 63e8dade36954429b6187b9bd7b908c159f0f6b5 Mon Sep 17 00:00:00 2001 From: jarpat Date: Fri, 28 Jun 2024 14:10:53 -0400 Subject: [PATCH 4/4] update when statement --- roles/monitoring/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/monitoring/tasks/main.yaml b/roles/monitoring/tasks/main.yaml index c90b78d9..9b9d5054 100644 --- a/roles/monitoring/tasks/main.yaml +++ b/roles/monitoring/tasks/main.yaml @@ -81,7 +81,7 @@ src: "{{ role_path }}/files/{{ PROVIDER }}-storageclass.yaml" when: - PROVIDER is not none - - PROVIDER == "azure" + - PROVIDER in ["azure","aws","gcp"] - V4_CFG_MANAGE_STORAGE is not none - V4_CFG_MANAGE_STORAGE|bool - sc_users.stdout | int == 0