From 0158a4d39711f0dc0ccca9f068184c720e005a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20N=C3=A9au?= Date: Fri, 26 Jan 2024 16:25:39 +0100 Subject: [PATCH] Create gitjob resources only if gitjob is enabled This respects existing behaviour as currently triggered via the Rancher UI. If the `gitjob.enabled` switch evaluates to `false`, `gitjob` CRDs will still be installed, though. --- charts/fleet/templates/deployment_gitjob.yaml | 2 ++ charts/fleet/templates/rbac_gitjob.yaml | 2 ++ charts/fleet/templates/service_gitjob.yaml | 4 +++- charts/fleet/templates/serviceaccount_gitjob.yaml | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/charts/fleet/templates/deployment_gitjob.yaml b/charts/fleet/templates/deployment_gitjob.yaml index 426b904f47..936e8a694a 100644 --- a/charts/fleet/templates/deployment_gitjob.yaml +++ b/charts/fleet/templates/deployment_gitjob.yaml @@ -1,3 +1,4 @@ +{{- if .Values.gitops.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -50,3 +51,4 @@ spec: {{- if .Values.priorityClassName }} priorityClassName: "{{.Values.priorityClassName}}" {{- end }} +{{- end }} diff --git a/charts/fleet/templates/rbac_gitjob.yaml b/charts/fleet/templates/rbac_gitjob.yaml index 0c5d74bd33..2aa35a67c4 100644 --- a/charts/fleet/templates/rbac_gitjob.yaml +++ b/charts/fleet/templates/rbac_gitjob.yaml @@ -1,3 +1,4 @@ +{{- if .Values.gitops.enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: @@ -75,3 +76,4 @@ roleRef: subjects: - kind: ServiceAccount name: gitjob +{{- end }} diff --git a/charts/fleet/templates/service_gitjob.yaml b/charts/fleet/templates/service_gitjob.yaml index bf57c1b55c..a694f56fe8 100644 --- a/charts/fleet/templates/service_gitjob.yaml +++ b/charts/fleet/templates/service_gitjob.yaml @@ -1,3 +1,4 @@ +{{- if .Values.gitops.enabled }} apiVersion: v1 kind: Service metadata: @@ -9,4 +10,5 @@ spec: protocol: TCP targetPort: 8080 selector: - app: "gitjob" \ No newline at end of file + app: "gitjob" +{{- end }} diff --git a/charts/fleet/templates/serviceaccount_gitjob.yaml b/charts/fleet/templates/serviceaccount_gitjob.yaml index 5f8aecb045..c769b47cfd 100644 --- a/charts/fleet/templates/serviceaccount_gitjob.yaml +++ b/charts/fleet/templates/serviceaccount_gitjob.yaml @@ -1,4 +1,6 @@ +{{- if .Values.gitops.enabled }} apiVersion: v1 kind: ServiceAccount metadata: name: gitjob +{{- end }}