Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions charts/fider/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,24 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Name of the secret holding fider's secret environment variables.
Uses .Values.fider.existingSecret when set, otherwise the chart-managed secret.
*/}}
{{- define "fider.secretName" -}}
{{- if .Values.fider.existingSecret -}}
{{- .Values.fider.existingSecret -}}
{{- else -}}
{{- printf "%s-env-secrets" (include "fider.fullname" .) -}}
{{- end -}}
{{- end }}

{{/*
Whether a secret reference exists (either chart-managed or pre-existing).
*/}}
{{- define "fider.hasSecret" -}}
{{- if or .Values.fider.existingSecret .Values.fider.secretEnv -}}
true
{{- end -}}
{{- end }}
8 changes: 4 additions & 4 deletions charts/fider/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ spec:
imagePullPolicy: {{ .Values.dbchecker.image.pullPolicy }}
securityContext:
{{- toYaml .Values.dbchecker.securityContext | nindent 10 }}
{{- if .Values.fider.secretEnv }}
{{- if include "fider.hasSecret" . }}
envFrom:
- secretRef:
name: {{ template "fider.fullname" . }}-env-secrets
name: {{ include "fider.secretName" . }}
{{- end }}
command: ["wait4x"]
args: ["--no-color", "--timeout", "60s", "postgresql", "$(DATABASE_URL)"]
Expand Down Expand Up @@ -74,10 +74,10 @@ spec:
{{- end }}
- name: METRICS_ENABLED
value: 'true'
{{- if .Values.fider.secretEnv }}
{{- if include "fider.hasSecret" . }}
envFrom:
- secretRef:
name: {{ template "fider.fullname" . }}-env-secrets
name: {{ include "fider.secretName" . }}
{{- end }}
{{- if .Values.fider.legalPages.enabled }}
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion charts/fider/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.fider.secretEnv }}
{{- if and .Values.fider.secretEnv (not .Values.fider.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
5 changes: 4 additions & 1 deletion charts/fider/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ fider:
# - name: EMAIL_AWSSES_ACCESS_KEY_ID
# value: youraccesskeygoeshere

# -- These environment variables are stored in a Kubernetes secret
# -- Name of a pre-existing Kubernetes Secret containing the secret environment variables (e.g. DATABASE_URL, JWT_SECRET). When set, `secretEnv` is ignored and no Secret is created by this chart; the referenced Secret is used directly via `envFrom`.
existingSecret: ""

# -- These environment variables are stored in a Kubernetes secret. Ignored when `existingSecret` is set.
secretEnv:
# -- Connection string to the PostgreSQL database
DATABASE_URL: 'postgres://fider:s0m3g00dp4ssw0rd@postgresql-service:5432/fider?sslmode=disable'
Expand Down