Skip to content

Commit

Permalink
Add variables, templating & fix formatting (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
frivoire authored Jun 20, 2024
1 parent f36736a commit cea0eab
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 17 deletions.
11 changes: 7 additions & 4 deletions charts/redash/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Shared environment block used across each component.
value: {{ .Values.postgresql.auth.database | quote }}
{{- end -}}
{{- if not .Values.redis.enabled }}
{{- if not .Values.redash.selfManagedSecrets -}}
{{- if not .Values.redash.selfManagedSecrets }}
- name: REDASH_REDIS_URL
{{- with .Values.externalRedisSecret }}
valueFrom:
Expand All @@ -126,11 +126,11 @@ Shared environment block used across each component.
value: {{ .Values.redis.master.service.ports.redis | quote }}
- name: REDASH_REDIS_NAME
value: {{ .Values.redis.database | quote }}
{{ end -}}
{{ range $key, $value := .Values.env -}}
{{- end }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{ end -}}
{{- end }}
## Start primary Redash configuration
{{- if not .Values.redash.selfManagedSecrets }}
{{- if or .Values.redash.secretKey .Values.redash.existingSecret }}
Expand Down Expand Up @@ -523,6 +523,9 @@ app.kubernetes.io/component: {{ . }}worker
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.commonLabels }}
{{ tpl (toYaml .Values.commonLabels) . }}
{{- end }}
{{- end -}}

{{/*
Expand Down
8 changes: 6 additions & 2 deletions charts/redash/templates/hook-migrations-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ spec:
template:
metadata:
name: "{{ .Release.Name }}"
labels: {{ include "redash.selectorLabels" . | nindent 8 }}
labels:
{{- include "redash.selectorLabels" . | nindent 8 }}
{{- with .Values.migrations.podLabels }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.migrations.podAnnotations }}
annotations: {{ toYaml . | nindent 8 }}
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
Expand Down
4 changes: 2 additions & 2 deletions charts/redash/templates/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ spec:
{{- with .Values.scheduler.podLabels }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if .Values.scheduler.podAnnotations }}
annotations: {{ toYaml .Values.scheduler.podAnnotations | nindent 8 }}
{{- with .Values.scheduler.podAnnotations }}
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
spec:
{{ with .Values.imagePullSecrets -}}
Expand Down
6 changes: 3 additions & 3 deletions charts/redash/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ spec:
labels:
{{- include "redash.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: server
{{- if .Values.server.podLabels }}
{{- tpl (toYaml .Values.server.podLabels) $ | nindent 8 }}
{{- with .Values.server.podLabels }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.server.podAnnotations }}
annotations: {{ toYaml . | nindent 8 }}
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
spec:
{{ with .Values.imagePullSecrets -}}
Expand Down
13 changes: 7 additions & 6 deletions charts/redash/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ spec:
matchLabels: {{ include "redash.selectorLabels" $context | nindent 6 }}
template:
metadata:
labels: {{ include "redash.selectorLabels" $context | nindent 8 }}
{{- if $workerConfig.podLabels }}
{{ tpl (toYaml $workerConfig.podLabels) $ | nindent 8 }}
{{- end }}
{{- with $workerConfig.podAnnotations -}}
annotations: {{ toYaml . | nindent 8 }}
labels:
{{- include "redash.selectorLabels" $context | nindent 8 }}
{{- with $workerConfig.podLabels }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with $workerConfig.podAnnotations }}
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
spec:
{{ with $.Values.imagePullSecrets -}}
Expand Down
6 changes: 6 additions & 0 deletions charts/redash/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ volumes: []
# volumeMounts -- Redash global volume mounts configuration - applied to all containers
volumeMounts: []

# commonLabels -- Redash global labels -- applied to all objects
commonLabels: {}

## Service account and security context configuration
serviceAccount:
# serviceAccount.create -- Specifies whether a service account should be created
Expand Down Expand Up @@ -552,6 +555,9 @@ migrations:
# migrations.podAnnotations -- Annotations for scheduled worker pod assignment [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
podAnnotations: {}

# migrations.podLabels -- Labels for migration pod [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)
podLabels: {}

# 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)
externalPostgreSQL:
# externalPostgreSQLSecret -- Read external PostgreSQL configuration from a secret. This should point at a secret file with a single key which specifies the connection string.
Expand Down

0 comments on commit cea0eab

Please sign in to comment.