From 737b98262d130aec0a5111b3b239be6767f980b3 Mon Sep 17 00:00:00 2001 From: ricolin Date: Thu, 16 Nov 2023 15:08:04 +0800 Subject: [PATCH] fix(cert_manager): Remove release before upgrade --- roles/cert_manager/tasks/main.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/roles/cert_manager/tasks/main.yml b/roles/cert_manager/tasks/main.yml index 4daa72af..09c6260f 100644 --- a/roles/cert_manager/tasks/main.yml +++ b/roles/cert_manager/tasks/main.yml @@ -12,6 +12,32 @@ # License for the specific language governing permissions and limitations # under the License. +- name: Uninstall the legacy HelmRelease + run_once: true + block: + - name: Suspend the existing HelmRelease + failed_when: false + kubernetes.core.k8s: + state: patched + api_version: helm.toolkit.fluxcd.io/v2beta1 + kind: HelmRelease + name: "{{ cert_manager_helm_release_name }}" + chart_ref: "{{ cert_manager_helm_chart_ref }}" + release_namespace: "{{ cert_manager_helm_release_namespace }}" + definition: + spec: + suspend: true + + - name: Remove the existing HelmRelease + failed_when: false + kubernetes.core.k8s: + state: absent + api_version: helm.toolkit.fluxcd.io/v2beta1 + kind: HelmRelease + name: "{{ cert_manager_helm_release_name }}" + chart_ref: "{{ cert_manager_helm_chart_ref }}" + release_namespace: "{{ cert_manager_helm_release_namespace }}" + - name: Deploy Helm chart run_once: true kubernetes.core.helm: