Skip to content

Commit cea0eab

Browse files
authored
Add variables, templating & fix formatting (#180)
1 parent f36736a commit cea0eab

File tree

6 files changed

+31
-17
lines changed

6 files changed

+31
-17
lines changed

charts/redash/templates/_helpers.tpl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Shared environment block used across each component.
101101
value: {{ .Values.postgresql.auth.database | quote }}
102102
{{- end -}}
103103
{{- if not .Values.redis.enabled }}
104-
{{- if not .Values.redash.selfManagedSecrets -}}
104+
{{- if not .Values.redash.selfManagedSecrets }}
105105
- name: REDASH_REDIS_URL
106106
{{- with .Values.externalRedisSecret }}
107107
valueFrom:
@@ -126,11 +126,11 @@ Shared environment block used across each component.
126126
value: {{ .Values.redis.master.service.ports.redis | quote }}
127127
- name: REDASH_REDIS_NAME
128128
value: {{ .Values.redis.database | quote }}
129-
{{ end -}}
130-
{{ range $key, $value := .Values.env -}}
129+
{{- end }}
130+
{{- range $key, $value := .Values.env }}
131131
- name: {{ $key }}
132132
value: {{ $value | quote }}
133-
{{ end -}}
133+
{{- end }}
134134
## Start primary Redash configuration
135135
{{- if not .Values.redash.selfManagedSecrets }}
136136
{{- if or .Values.redash.secretKey .Values.redash.existingSecret }}
@@ -523,6 +523,9 @@ app.kubernetes.io/component: {{ . }}worker
523523
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
524524
{{- end }}
525525
app.kubernetes.io/managed-by: {{ .Release.Service }}
526+
{{- if .Values.commonLabels }}
527+
{{ tpl (toYaml .Values.commonLabels) . }}
528+
{{- end }}
526529
{{- end -}}
527530

528531
{{/*

charts/redash/templates/hook-migrations-job.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ spec:
1515
template:
1616
metadata:
1717
name: "{{ .Release.Name }}"
18-
labels: {{ include "redash.selectorLabels" . | nindent 8 }}
18+
labels:
19+
{{- include "redash.selectorLabels" . | nindent 8 }}
20+
{{- with .Values.migrations.podLabels }}
21+
{{- tpl (toYaml .) $ | nindent 8 }}
22+
{{- end }}
1923
{{- with .Values.migrations.podAnnotations }}
20-
annotations: {{ toYaml . | nindent 8 }}
24+
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
2125
{{- end }}
2226
spec:
2327
{{- with .Values.imagePullSecrets }}

charts/redash/templates/scheduler-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ spec:
2121
{{- with .Values.scheduler.podLabels }}
2222
{{- tpl (toYaml .) $ | nindent 8 }}
2323
{{- end }}
24-
{{- if .Values.scheduler.podAnnotations }}
25-
annotations: {{ toYaml .Values.scheduler.podAnnotations | nindent 8 }}
24+
{{- with .Values.scheduler.podAnnotations }}
25+
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
2626
{{- end }}
2727
spec:
2828
{{ with .Values.imagePullSecrets -}}

charts/redash/templates/server-deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ spec:
1616
labels:
1717
{{- include "redash.selectorLabels" . | nindent 8 }}
1818
app.kubernetes.io/component: server
19-
{{- if .Values.server.podLabels }}
20-
{{- tpl (toYaml .Values.server.podLabels) $ | nindent 8 }}
19+
{{- with .Values.server.podLabels }}
20+
{{- tpl (toYaml .) $ | nindent 8 }}
2121
{{- end }}
2222
{{- with .Values.server.podAnnotations }}
23-
annotations: {{ toYaml . | nindent 8 }}
23+
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
2424
{{- end }}
2525
spec:
2626
{{ with .Values.imagePullSecrets -}}

charts/redash/templates/worker-deployment.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ spec:
1313
matchLabels: {{ include "redash.selectorLabels" $context | nindent 6 }}
1414
template:
1515
metadata:
16-
labels: {{ include "redash.selectorLabels" $context | nindent 8 }}
17-
{{- if $workerConfig.podLabels }}
18-
{{ tpl (toYaml $workerConfig.podLabels) $ | nindent 8 }}
19-
{{- end }}
20-
{{- with $workerConfig.podAnnotations -}}
21-
annotations: {{ toYaml . | nindent 8 }}
16+
labels:
17+
{{- include "redash.selectorLabels" $context | nindent 8 }}
18+
{{- with $workerConfig.podLabels }}
19+
{{- tpl (toYaml .) $ | nindent 8 }}
20+
{{- end }}
21+
{{- with $workerConfig.podAnnotations }}
22+
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
2223
{{- end }}
2324
spec:
2425
{{ with $.Values.imagePullSecrets -}}

charts/redash/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ volumes: []
2929
# volumeMounts -- Redash global volume mounts configuration - applied to all containers
3030
volumeMounts: []
3131

32+
# commonLabels -- Redash global labels -- applied to all objects
33+
commonLabels: {}
34+
3235
## Service account and security context configuration
3336
serviceAccount:
3437
# serviceAccount.create -- Specifies whether a service account should be created
@@ -552,6 +555,9 @@ migrations:
552555
# migrations.podAnnotations -- Annotations for scheduled worker pod assignment [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
553556
podAnnotations: {}
554557

558+
# migrations.podLabels -- Labels for migration pod [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)
559+
podLabels: {}
560+
555561
# externalPostgreSQL -- External PostgreSQL configuration. To use an external PostgreSQL instead of the automatically deployed postgresql chart: set postgresql.enabled to false then uncomment and configure the externalPostgreSQL connection URL (e.g. postgresql://user:pass@host:5432/database)
556562
externalPostgreSQL:
557563
# externalPostgreSQLSecret -- Read external PostgreSQL configuration from a secret. This should point at a secret file with a single key which specifies the connection string.

0 commit comments

Comments
 (0)