From 4d2eb3b9f265bcb4b80ff7d335a430560a29b234 Mon Sep 17 00:00:00 2001 From: Igor Soares Date: Wed, 19 Feb 2025 10:19:02 -0300 Subject: [PATCH 2/2] Add template option to allow enabling/disabling the pre-install job Add the .Values.preInstallJob.create option to allow enabling/disabling the pre-install job. The service account related to the pre-install job will be enabled/disabled accordingly as well. This is required because in certain scenarios, such as platform upgrades, we need to skip the Kubernetes version check. Signed-off-by: Igor Soares --- charts/flux2/templates/pre-install-job-serviceaccount.yaml | 2 ++ charts/flux2/templates/pre-install-job.yaml | 2 ++ charts/flux2/values.yaml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/charts/flux2/templates/pre-install-job-serviceaccount.yaml b/charts/flux2/templates/pre-install-job-serviceaccount.yaml index f634869..14b35fd 100644 --- a/charts/flux2/templates/pre-install-job-serviceaccount.yaml +++ b/charts/flux2/templates/pre-install-job-serviceaccount.yaml @@ -1,3 +1,4 @@ +{{- if and .Values.preInstallJob.create}} apiVersion: v1 kind: ServiceAccount metadata: @@ -12,3 +13,4 @@ metadata: "helm.sh/hook": pre-install "helm.sh/hook-weight": "-10" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +{{- end }} \ No newline at end of file diff --git a/charts/flux2/templates/pre-install-job.yaml b/charts/flux2/templates/pre-install-job.yaml index 2c2541f..59bfa32 100644 --- a/charts/flux2/templates/pre-install-job.yaml +++ b/charts/flux2/templates/pre-install-job.yaml @@ -1,3 +1,4 @@ +{{- if and .Values.preInstallJob.create}} apiVersion: batch/v1 kind: Job metadata: @@ -70,3 +71,4 @@ spec: {{- with .Values.cli.tolerations }} tolerations: {{ toYaml . | nindent 8 }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/flux2/values.yaml b/charts/flux2/values.yaml index 6a023c7..9277f13 100644 --- a/charts/flux2/values.yaml +++ b/charts/flux2/values.yaml @@ -325,3 +325,6 @@ prometheus: - sourceLabels: [__meta_kubernetes_pod_phase] action: keep regex: Running + +preInstallJob: + create: true -- 2.34.1