From 9315b02fb69ff57cbd2a70979293480b956eb217 Mon Sep 17 00:00:00 2001 From: chaosi-zju Date: Mon, 11 Dec 2023 14:20:30 +0800 Subject: [PATCH] make hook-delete-policy in helm job configurable. Signed-off-by: chaosi-zju --- charts/karmada/templates/post-delete-job.yaml | 2 +- charts/karmada/templates/post-install-job.yaml | 2 +- charts/karmada/templates/pre-install-job.yaml | 2 +- charts/karmada/values.yaml | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/charts/karmada/templates/post-delete-job.yaml b/charts/karmada/templates/post-delete-job.yaml index b78d1ea98187..c6c187e0cb9b 100644 --- a/charts/karmada/templates/post-delete-job.yaml +++ b/charts/karmada/templates/post-delete-job.yaml @@ -14,7 +14,7 @@ metadata: # job is considered part of the release. "helm.sh/hook": post-delete "helm.sh/hook-weight": "0" - "helm.sh/hook-delete-policy": hook-succeeded + "helm.sh/hook-delete-policy": {{ .Values.postDeleteJob.hookDeletePolicy }} spec: parallelism: 1 completions: 1 diff --git a/charts/karmada/templates/post-install-job.yaml b/charts/karmada/templates/post-install-job.yaml index 3ec16ab8f3d9..0496dae18b54 100644 --- a/charts/karmada/templates/post-install-job.yaml +++ b/charts/karmada/templates/post-install-job.yaml @@ -17,7 +17,7 @@ metadata: # job is considered part of the release. "helm.sh/hook": post-install "helm.sh/hook-weight": "0" - "helm.sh/hook-delete-policy": hook-succeeded + "helm.sh/hook-delete-policy": {{ .Values.postInstallJob.hookDeletePolicy }} spec: parallelism: 1 completions: 1 diff --git a/charts/karmada/templates/pre-install-job.yaml b/charts/karmada/templates/pre-install-job.yaml index fc4a28fbcf35..812efd4214da 100644 --- a/charts/karmada/templates/pre-install-job.yaml +++ b/charts/karmada/templates/pre-install-job.yaml @@ -307,7 +307,7 @@ metadata: # job is considered part of the release. "helm.sh/hook": pre-install "helm.sh/hook-weight": "3" - "helm.sh/hook-delete-policy": hook-succeeded + "helm.sh/hook-delete-policy": {{ .Values.preInstallJob.hookDeletePolicy }} {{- if "karmada.preInstallJob.labels" }} labels: {{- include "karmada.preInstallJob.labels" . | nindent 4 }} diff --git a/charts/karmada/values.yaml b/charts/karmada/values.yaml index 13a8b5c67942..976ab092f6c8 100644 --- a/charts/karmada/values.yaml +++ b/charts/karmada/values.yaml @@ -79,16 +79,22 @@ kubectl: preInstallJob: tolerations: [] nodeSelector: {} + ## Define policies that determine when to delete corresponding hook resources: before-hook-creation,hook-succeeded,hook-failed + hookDeletePolicy: "hook-succeeded" ## post-install job config postInstallJob: tolerations: [] nodeSelector: {} + ## Define policies that determine when to delete corresponding hook resources: before-hook-creation,hook-succeeded,hook-failed + hookDeletePolicy: "hook-succeeded" ## post-delete job config postDeleteJob: tolerations: [] nodeSelector: {} + ## Define policies that determine when to delete corresponding hook resources: before-hook-creation,hook-succeeded,hook-failed + hookDeletePolicy: "hook-succeeded" ## karmada certificate config certs: