Skip to content

Commit

Permalink
fix: use toYaml instead of 'range' for environment variables, and ali…
Browse files Browse the repository at this point in the history
…gnment between 'charts' and 'helm' folders

Signed-off-by: Hervé Le Meur <[email protected]>
  • Loading branch information
Hervé Le Meur committed Nov 23, 2020
1 parent b758af2 commit 93c07b5
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
5 changes: 1 addition & 4 deletions charts/charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions charts/charts/templates/ksvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
13 changes: 6 additions & 7 deletions helm/charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,24 @@ 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 }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
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 }}
Expand Down
9 changes: 5 additions & 4 deletions helm/charts/templates/ksvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 4 additions & 1 deletion helm/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion helm/preview/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
environments:
default:
values:
- jx-values.yaml
releases:
- chart: '../{{ requiredEnv "APP_NAME" }}'
name: preview
wait: true
createNamespace: true
namespace: '{{ requiredEnv "PREVIEW_NAMESPACE" }}'
values:
- values.yaml.gotmpl
- jx-values.yaml
- imagePullSecrets.yaml
- values.yaml.gotmpl
hooks:
- events: ["presync"]
showlogs: true
Expand Down

0 comments on commit 93c07b5

Please sign in to comment.