From 80f84fc9d3e8dc5fb781fb8c8eff5dc6f79ca0f2 Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Thu, 7 Nov 2024 22:59:49 -0800 Subject: [PATCH] Use kubectl to delete all configurations in helm hook Signed-off-by: Kate Goldenring --- deployment/helm/templates/pre-delete-job.yaml | 4 ++-- deployment/helm/templates/rbac.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deployment/helm/templates/pre-delete-job.yaml b/deployment/helm/templates/pre-delete-job.yaml index 813c2611d..111fc0796 100644 --- a/deployment/helm/templates/pre-delete-job.yaml +++ b/deployment/helm/templates/pre-delete-job.yaml @@ -28,9 +28,9 @@ spec: serviceAccountName: akri-helm-cleanup-hook-sa containers: - name: delete-configurations - image: curlimages/curl:latest + image: bitnami/kubectl:latest command: ["/bin/sh", "-c"] args: [ - "curl -ik -X DELETE -H \"Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)\" https://kubernetes.default.svc.cluster.local/apis/akri.sh/v0/namespaces/{{ .Release.Namespace }}/configurations" + "kubectl delete configurations.akri.sh --all --all-namespaces --wait" ] {{- end }} \ No newline at end of file diff --git a/deployment/helm/templates/rbac.yaml b/deployment/helm/templates/rbac.yaml index 99331213d..034bff54c 100644 --- a/deployment/helm/templates/rbac.yaml +++ b/deployment/helm/templates/rbac.yaml @@ -106,9 +106,9 @@ metadata: labels: app.kubernetes.io/component: helm-hook rules: -- apiGroups: ["akri.sh"] +- apiGroups: [{{ .Values.crds.group | quote }}] resources: ["configurations"] - verbs: ["deletecollection"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete", "deletecollection"] --- apiVersion: 'rbac.authorization.k8s.io/v1' kind: 'ClusterRoleBinding'