Skip to content

Commit

Permalink
made probes configurable, fixed formatting, ci cleanup (getredash#171)
Browse files Browse the repository at this point in the history
* made probes configurable, fixed formatting, ci cleanup

* added probes conditions

* common volume mounts
  • Loading branch information
AndrewChubatiuk authored Apr 12, 2024
1 parent 7af1cee commit abe36a0
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 85 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: azure/setup-helm@v4
- name: configure git
run: |
git config user.name "$GITHUB_ACTOR"
Expand Down
4 changes: 2 additions & 2 deletions charts/redash/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: redash
version: 3.1.0-alpha1
appVersion: 24.04.0-dev-b8640593524.10
version: 3.1.0-alpha2
appVersion: 24.04.0-dev-b8665145752.21
description: Redash is an open source tool built for teams to query, visualize and collaborate.
keywords:
- redash
Expand Down
11 changes: 9 additions & 2 deletions charts/redash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This chart bootstraps a [Redash](https://github.com/getredash/redash) deployment

This is a contributed project developed by volunteers and not officially supported by Redash.

Current chart version is `3.1.0-alpha1`
Current chart version is `3.1.0-alpha2`

* <https://github.com/getredash/redash>

Expand Down Expand Up @@ -104,6 +104,8 @@ The following table lists the configurable parameters of the Redash chart and th
| migrations.securityContext | object | `{}` | |
| migrations.tolerations | list | `[]` | Tolerations for server pod assignment [ref](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) |
| migrations.ttlSecondsAfterFinished | int | `600` | ttl for install job [ref](https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/) |
| migrations.volumeMounts | list | `[]` | volume mounts for migrations pods |
| migrations.volumes | list | `[]` | volumes that will be mounted to migrations pods only |
| nameOverride | string | `""` | |
| postgresql.auth.database | string | `"redash"` | PostgreSQL database name (when postgresql chart enabled) |
| postgresql.auth.password | string | `nil` | REQUIRED: PostgreSQL password for redash user (when postgresql chart enabled) |
Expand Down Expand Up @@ -201,6 +203,7 @@ The following table lists the configurable parameters of the Redash chart and th
| redis.master.service.ports.redis | int | `6379` | |
| scheduler.affinity | object | `{}` | Affinity for scheduler pod assignment [ref](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) |
| scheduler.env | object | `{}` | Redash scheduler specific environment variables. |
| scheduler.livenessProbe | object | `{}` | Liveness probe for scheduler to ensure workers are running fine |
| scheduler.nodeSelector | object | `{}` | Node labels for scheduler pod assignment [ref](https://kubernetes.io/docs/user-guide/node-selection/) |
| scheduler.podAnnotations | object | `{}` | Annotations for scheduler pod assignment [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
| scheduler.podLabels | object | `{}` | Labels for scheduler pod assignment [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) |
Expand All @@ -213,10 +216,12 @@ The following table lists the configurable parameters of the Redash chart and th
| server.affinity | object | `{}` | Affinity for server pod assignment [ref](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) |
| server.env | object | `{}` | Redash server specific environment variables Don't use this for variables that are in the configuration above, however. |
| server.httpPort | int | `5000` | Server container port (only useful if you are using a customized image) |
| server.livenessProbe | object | `{"failureThreshold":10,"initialDelaySeconds":90,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1}` | Server liveness probe configuration |
| server.nodeSelector | object | `{}` | Node labels for server pod assignment [ref](https://kubernetes.io/docs/user-guide/node-selection/) |
| server.podAnnotations | object | `{}` | Annotations for server pod assignment [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
| server.podLabels | object | `{}` | Labels for server pod assignment [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) |
| server.podSecurityContext | object | `{}` | Security contexts for server pod assignment [ref](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) |
| server.readinessProbe | object | `{"failureThreshold":3,"initialDelaySeconds":10,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1}` | Server readiness probe configuration |
| server.replicaCount | int | `1` | Number of server pods to run |
| server.resources | object | `{}` | Server resource requests and limits [ref](http://kubernetes.io/docs/user-guide/compute-resources/) |
| server.securityContext | object | `{}` | |
Expand All @@ -231,8 +236,10 @@ The following table lists the configurable parameters of the Redash chart and th
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `nil` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| volumeMounts | list | `[]` | Redash global volume mounts configuration - applied to all containers |
| volumes | list | `[]` | Redash global volumes configuration - applied to all containers |
| worker.affinity | object | `{}` | Default affinity for worker pod assignment [ref](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) |
| worker.livenessProbe | string | `nil` | Default worker's liveness probe to ensure workers are running fine |
| worker.livenessProbe | object | `{}` | Default worker's liveness probe to ensure workers are running fine |
| worker.nodeSelector | object | `{}` | Default node labels for worker pod assignment [ref](https://kubernetes.io/docs/user-guide/node-selection/) |
| worker.podAnnotations | object | `{}` | Default annotations for worker pod assignment [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
| worker.podLabels | object | `{}` | Default labels for worker pod assignment [ref](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) |
Expand Down
44 changes: 21 additions & 23 deletions charts/redash/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,19 @@ Get the secret name.
{{/*
Shared environment block used across each component.
*/}}
{{- define "redash.env" }}
{{- if not .Values.redash.selfManagedSecrets }}
{{- if not .Values.postgresql.enabled }}
{{- define "redash.env" -}}
{{- if not .Values.redash.selfManagedSecrets -}}
{{- if not .Values.postgresql.enabled -}}
- name: REDASH_DATABASE_URL
{{ if .Values.externalPostgreSQLSecret -}}
{{- if .Values.externalPostgreSQLSecret }}
valueFrom:
secretKeyRef:
{{- .Values.externalPostgreSQLSecret | toYaml | nindent 6 }}
{{ else -}}
secretKeyRef: {{ .Values.externalPostgreSQLSecret | toYaml | nindent 6 }}
{{- else }}
value: {{ default "" .Values.externalPostgreSQL | quote }}
{{- end }}
{{- else -}}
- name: REDASH_DATABASE_USER
value: "{{ .Values.postgresql.auth.username }}"
value: {{ .Values.postgresql.auth.username | quote }}
- name: REDASH_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
Expand All @@ -96,16 +95,15 @@ Shared environment block used across each component.
- name: REDASH_DATABASE_HOSTNAME
value: {{ include "redash.postgresql.fullname" . }}
- name: REDASH_DATABASE_PORT
value: "{{ .Values.postgresql.primary.service.ports.postgresql }}"
value: {{ .Values.postgresql.primary.service.ports.postgresql | quote }}
- name: REDASH_DATABASE_NAME
value: "{{ .Values.postgresql.auth.database }}"
{{- end }}
value: {{ .Values.postgresql.auth.database | quote }}
{{- end -}}
{{- if not .Values.redis.enabled }}
- name: REDASH_REDIS_URL
{{- if .Values.externalRedisSecret }}
valueFrom:
secretKeyRef:
{{- .Values.externalRedisSecret | toYaml | nindent 6 }}
secretKeyRef: {{ .Values.externalRedisSecret | toYaml | nindent 6 }}
{{- else }}
value: {{ default "" .Values.externalRedis | quote }}
{{- end }}
Expand All @@ -122,15 +120,15 @@ Shared environment block used across each component.
- name: REDASH_REDIS_HOSTNAME
value: {{ include "redash.redis.fullname" . }}
- name: REDASH_REDIS_PORT
value: "{{ .Values.redis.master.service.ports.redis }}"
value: {{ .Values.redis.master.service.ports.redis | quote }}
- name: REDASH_REDIS_NAME
value: "{{ .Values.redis.database }}"
{{- end }}
{{- end }}
{{- range $key, $value := .Values.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
value: {{ .Values.redis.database | quote }}
{{ end -}}
{{- end -}}
{{ range $key, $value := .Values.env -}}
- name: {{ $key | quote }}
value: {{ $value | quote }}
{{ end -}}
## Start primary Redash configuration
{{- if not .Values.redash.selfManagedSecrets }}
{{- if or .Values.redash.secretKey .Values.redash.existingSecret }}
Expand Down Expand Up @@ -515,8 +513,8 @@ helm.sh/chart: {{ include "redash.chart" . }}
{{- if .workerName }}
app.kubernetes.io/component: {{ .workerName }}worker
{{- end }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- if or .Chart.AppVersion .Values.image.tag }}
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
Expand Down
13 changes: 6 additions & 7 deletions charts/redash/templates/hook-migrations-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,21 @@ spec:
args:
- create_db
env:
{{- include "redash.env" . | nindent 10 }}
{{- range $key, $value := .Values.migrations.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
{{- $envCtx := mergeOverwrite (deepCopy .) (dict "Values" (dict "env" .Values.migrations.env)) -}}
{{- include "redash.env" $envCtx | nindent 10 }}
{{- if (include "redash.envFrom" .) }}
envFrom:
{{- include "redash.envFrom" . | nindent 10 }}
{{- end}}
{{- with .Values.migrations.resources }}
resources: {{ toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.migrations.volumeMounts }}
{{- $volumeMounts := concat .Values.volumeMounts .Values.migrations.volumeMounts }}
{{- with $volumeMounts }}
volumeMounts: {{ toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.migrations.volumes }}
{{- $volumes := concat .Values.volumes .Values.migrations.volumes -}}
{{- with $volumes }}
volumes: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.migrations.nodeSelector }}
Expand Down
16 changes: 9 additions & 7 deletions charts/redash/templates/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,26 @@ spec:
securityContext: {{ toYaml .Values.scheduler.securityContext | nindent 12 }}
image: {{ .Values.image.registry }}/{{ .Values.image.repo }}:{{ .Values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.scheduler.volumeMounts }}
{{- $volumeMounts := concat .Values.volumeMounts .Values.scheduler.volumeMounts }}
{{- with $volumeMounts }}
volumeMounts: {{ toYaml . | nindent 12 }}
{{- end }}
args:
- scheduler
env:
{{- include "redash.env" . | nindent 12 }}
{{- range $key, $value := .Values.scheduler.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
{{- $envCtx := mergeOverwrite (deepCopy .) (dict "Values" (dict "env" .Values.scheduler.env)) -}}
{{- include "redash.env" $envCtx | nindent 12 }}
{{- with (include "redash.envFrom" .) }}
envFrom: {{ . | nindent 12 }}
{{- end }}
{{- with .Values.scheduler.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.scheduler.volumes }}
{{- with .Values.scheduler.livenessProbe }}
livenessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
{{- $volumes := concat .Values.volumes .Values.scheduler.volumes }}
{{- with $volumes }}
volumes: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.scheduler.nodeSelector }}
Expand Down
4 changes: 2 additions & 2 deletions charts/redash/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ metadata:
type: Opaque
data:
## Start primary Redash configuration
{{ $null := required "A value for one of the following variables is required: redash.secretKey (secure random value), redash.existingSecret (secret name)" (or .Values.redash.secretKey .Values.redash.existingSecret) }}
{{- $null := required "A value for one of the following variables is required: redash.secretKey (secure random value), redash.existingSecret (secret name)" (or .Values.redash.secretKey .Values.redash.existingSecret) }}
secretKey: {{ default "" .Values.redash.secretKey | b64enc | quote }}
googleClientSecret: {{ default "" .Values.redash.googleClientSecret | b64enc | quote }}
ldapBindDnPassword: {{ default "" .Values.redash.ldapBindDnPassword | b64enc | quote }}
{{ $null := required "A value for one of the following variables is required: redash.cookieSecret (secure random value), redash.existingSecret (secret name)" (or .Values.redash.cookieSecret .Values.redash.existingSecret) }}
{{- $null := required "A value for one of the following variables is required: redash.cookieSecret (secure random value), redash.existingSecret (secret name)" (or .Values.redash.cookieSecret .Values.redash.existingSecret) }}
cookieSecret: {{ default "" .Values.redash.cookieSecret | b64enc | quote }}
mailPassword: {{ default "" .Values.redash.mailPassword | b64enc | quote }}
## End primary Redash configuration
Expand Down
41 changes: 14 additions & 27 deletions charts/redash/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,45 +36,32 @@ spec:
securityContext: {{ toYaml .Values.server.securityContext | nindent 12 }}
image: {{ .Values.image.registry }}/{{ .Values.image.repo }}:{{ .Values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.server.volumeMounts }}
{{- $volumeMounts := concat .Values.volumeMounts .Values.server.volumeMounts }}
{{- with $volumeMounts }}
volumeMounts: {{ toYaml . | nindent 12 }}
{{- end }}
args:
- server
env:
{{- include "redash.env" . | nindent 12 }}
{{- range $key, $value := .Values.server.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
{{ with (include "redash.envFrom" .) -}}
{{- $envCtx := mergeOverwrite (deepCopy .) (dict "Values" (dict "env" .Values.server.env)) -}}
{{- include "redash.env" $envCtx | nindent 12 }}
{{- with (include "redash.envFrom" .) }}
envFrom: {{ . | nindent 12 }}
{{- end }}
ports:
- containerPort: {{ .Values.server.httpPort }}
livenessProbe:
httpGet:
path: /ping
port: {{ .Values.server.httpPort }}
# Redash can take a while to come up initially, so we delay checks.
initialDelaySeconds: 90
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
readinessProbe:
httpGet:
path: /ping
port: {{ .Values.server.httpPort }}
initialDelaySeconds: 10
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
{{- $defaultProbe := dict "httpGet" (dict "path" "/ping" "port" .Values.server.httpPort) -}}
{{- with .Values.server.livenessProbe }}
livenessProbe: {{ deepCopy . | mergeOverwrite $defaultProbe | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.server.readinessProbe }}
readinessProbe: {{ deepCopy . | mergeOverwrite $defaultProbe | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.server.resources }}
resources: {{ toYaml .Values.server.resources | nindent 12 }}
{{- end }}
{{- with .Values.server.volumes }}
{{- $volumes := concat .Values.volumes .Values.server.volumes -}}
{{- with $volumes }}
volumes: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.server.nodeSelector }}
Expand Down
21 changes: 11 additions & 10 deletions charts/redash/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ range $workerName, $config := .Values.workers -}}
{{- $workerConfig := merge (deepCopy $.Values.worker) $config }}
{{- $context := deepCopy $ | merge (dict "workerName" $workerName)}}
{{- $workerConfig := mergeOverwrite (deepCopy $.Values.worker) $config }}
{{- $context := mergeOverwrite (deepCopy $) (dict "workerName" $workerName)}}
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -36,23 +36,24 @@ spec:
imagePullPolicy: {{ $.Values.image.pullPolicy }}
args:
- worker
{{ with $workerConfig.volumeMounts -}}
{{- $volumeMounts := concat $.Values.volumeMounts $workerConfig.volumeMounts }}
{{- with $volumeMounts }}
volumeMounts: {{ toYaml . | nindent 12 }}
{{- end -}}
livenessProbe: {{ toYaml $workerConfig.livenessProbe | nindent 12 }}
env:
{{- include "redash.env" $ | nindent 12 }}
{{- range $key, $value := $workerConfig.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- with $workerConfig.livenessProbe }}
livenessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
env:
{{- $envCtx := mergeOverwrite (deepCopy $) (dict "Values" (dict "env" $workerConfig.env)) -}}
{{- include "redash.env" $envCtx | nindent 12 }}
{{- with (include "redash.envFrom" $) }}
envFrom: {{ . | nindent 12 }}
{{- end }}
{{- with $workerConfig.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with $workerConfig.volumes }}
{{- $volumes := concat $.Values.volumes $workerConfig.volumes -}}
{{- with $volumes }}
volumes: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $workerConfig.nodeSelector }}
Expand Down
Loading

0 comments on commit abe36a0

Please sign in to comment.