From 93c07b54c846fc86c00fa0a356cea7b8cdcc38b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Wed, 18 Nov 2020 11:13:25 +0100 Subject: [PATCH] fix: use toYaml instead of 'range' for environment variables, and alignment between 'charts' and 'helm' folders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hervé Le Meur --- charts/charts/templates/deployment.yaml | 5 +---- charts/charts/templates/ksvc.yaml | 7 +++---- helm/charts/templates/deployment.yaml | 13 ++++++------- helm/charts/templates/ksvc.yaml | 9 +++++---- helm/charts/values.yaml | 5 ++++- helm/preview/helmfile.yaml | 7 ++++++- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/charts/charts/templates/deployment.yaml b/charts/charts/templates/deployment.yaml index 09274f5..b6f5f8a 100644 --- a/charts/charts/templates/deployment.yaml +++ b/charts/charts/templates/deployment.yaml @@ -39,10 +39,7 @@ spec: env: - name: VERSION value: {{ .Chart.Version }} -{{- range $pkey, $pval := .Values.env }} - - name: {{ $pkey }} - value: {{ quote $pval }} -{{- end }} +{{ toYaml .Values.env | indent 10 }} envFrom: {{ toYaml .Values.envFrom | indent 10 }} ports: diff --git a/charts/charts/templates/ksvc.yaml b/charts/charts/templates/ksvc.yaml index 632938d..de8cbc6 100644 --- a/charts/charts/templates/ksvc.yaml +++ b/charts/charts/templates/ksvc.yaml @@ -21,10 +21,9 @@ spec: env: - name: VERSION value: {{ .Chart.Version }} -{{- range $pkey, $pval := .Values.env }} - - name: {{ $pkey }} - value: {{ quote $pval }} -{{- end }} +{{ toYaml .Values.env | indent 12 }} + envFrom: +{{ toYaml .Values.envFrom | indent 12 }} livenessProbe: httpGet: path: {{ .Values.livenessProbe.probePath | default .Values.probePath }} diff --git a/helm/charts/templates/deployment.yaml b/helm/charts/templates/deployment.yaml index 1c6669c..7972738 100644 --- a/helm/charts/templates/deployment.yaml +++ b/helm/charts/templates/deployment.yaml @@ -30,17 +30,16 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: -{{- range $pkey, $pval := .Values.env }} - - name: {{ $pkey }} - value: {{ quote $pval }} -{{- end }} + - name: VERSION + value: {{ .Chart.Version }} +{{ toYaml .Values.env | indent 8 }} envFrom: -{{ toYaml .Values.envFrom | indent 10 }} +{{ toYaml .Values.envFrom | indent 8 }} ports: - containerPort: {{ .Values.service.internalPort }} livenessProbe: httpGet: - path: {{ .Values.probePath }} + path: {{ .Values.livenessProbe.probePath | default .Values.probePath }} port: {{ .Values.service.internalPort }} initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.livenessProbe.periodSeconds }} @@ -48,7 +47,7 @@ spec: timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} readinessProbe: httpGet: - path: {{ .Values.probePath }} + path: {{ .Values.readinessProbe.probePath | default .Values.probePath }} port: {{ .Values.service.internalPort }} periodSeconds: {{ .Values.readinessProbe.periodSeconds }} successThreshold: {{ .Values.readinessProbe.successThreshold }} diff --git a/helm/charts/templates/ksvc.yaml b/helm/charts/templates/ksvc.yaml index d37fb3f..1f7a372 100644 --- a/helm/charts/templates/ksvc.yaml +++ b/helm/charts/templates/ksvc.yaml @@ -18,10 +18,11 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: -{{- range $pkey, $pval := .Values.env }} - - name: {{ $pkey }} - value: {{ quote $pval }} -{{- end }} + - name: VERSION + value: {{ .Chart.Version }} +{{ toYaml .Values.env | indent 12 }} + envFrom: +{{ toYaml .Values.envFrom | indent 12 }} livenessProbe: httpGet: path: {{ .Values.probePath }} diff --git a/helm/charts/values.yaml b/helm/charts/values.yaml index 75a9f43..1153bdd 100644 --- a/helm/charts/values.yaml +++ b/helm/charts/values.yaml @@ -65,12 +65,15 @@ livenessProbe: periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 + # Optional distinct liveness probe path, if empty the probePath is used + probePath: "" readinessProbe: failureThreshold: 1 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 - + # Optional distinct liveness probe path, if empty the probePath is used + probePath: "" # custom ingress annotations on this service ingress: diff --git a/helm/preview/helmfile.yaml b/helm/preview/helmfile.yaml index 3a8edeb..a2bfab5 100644 --- a/helm/preview/helmfile.yaml +++ b/helm/preview/helmfile.yaml @@ -1,3 +1,7 @@ +environments: + default: + values: + - jx-values.yaml releases: - chart: '../{{ requiredEnv "APP_NAME" }}' name: preview @@ -5,8 +9,9 @@ releases: createNamespace: true namespace: '{{ requiredEnv "PREVIEW_NAMESPACE" }}' values: - - values.yaml.gotmpl - jx-values.yaml + - imagePullSecrets.yaml + - values.yaml.gotmpl hooks: - events: ["presync"] showlogs: true