From 3229d346cb09f6b35521b8cadf6591a9028ac46f Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Thu, 1 Apr 2021 10:14:43 +0200 Subject: [PATCH] Fixing invalid yaml case, nill guarded a bunch of things --- charts/onechart/templates/deployment.yaml | 10 ++++++++++ charts/onechart/values.yaml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/charts/onechart/templates/deployment.yaml b/charts/onechart/templates/deployment.yaml index e9e7591..790c8a8 100644 --- a/charts/onechart/templates/deployment.yaml +++ b/charts/onechart/templates/deployment.yaml @@ -38,6 +38,7 @@ spec: - -c - {{ .Values.command | quote }} {{- end }} + {{- if or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets }} envFrom: &envFrom {{- if .Values.vars }} - configMapRef: @@ -51,6 +52,7 @@ spec: - secretRef: name: {{ template "robustName" .Release.Name }} {{- end }} + {{- end }} ports: - name: http containerPort: {{ .Values.containerPort }} @@ -65,6 +67,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} + {{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }} volumeMounts: &volumeMounts {{- range .Values.volumes }} - name: {{ .name }} @@ -80,6 +83,7 @@ spec: mountPath: {{ .path }} readOnly: true {{- end }} + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.debugSidecarEnabled }} @@ -90,9 +94,14 @@ spec: - {{ .Values.debugSidecar.shell }} - -c - {{ .Values.debugSidecar.command | quote }} + {{- if or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets }} envFrom: *envFrom + {{- end }} + {{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }} volumeMounts: *volumeMounts + {{- end }} {{- end }} + {{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }} volumes: {{- range .Values.volumes }} - name: {{ .name }} @@ -109,6 +118,7 @@ spec: secret: secretName: {{ printf "%s-%s" $.Release.Name .name }} {{- end }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/onechart/values.yaml b/charts/onechart/values.yaml index da8b4b6..a509bbb 100644 --- a/charts/onechart/values.yaml +++ b/charts/onechart/values.yaml @@ -1,7 +1,7 @@ image: repository: nginx tag: "latest" - imagePullPolicy: IfNotPresent + pullPolicy: IfNotPresent replicas: 1