Skip to content

Commit

Permalink
fix: Make dsn optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Blum committed Dec 25, 2023
1 parent d3ffdad commit 9d908b1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helm/charts/kratos/templates/cleanup-cron-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ spec:
- --config
- /etc/config/kratos.yaml
env:
{{- if not (empty ( include "kratos.dsn" . )) }}
{{- if .Values.kratos.config.dsn }}
- name: DSN
valueFrom:
secretKeyRef:
Expand Down
4 changes: 4 additions & 0 deletions helm/charts/kratos/templates/deployment-kratos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
env:
{{- if .Values.kratos.config.dsn }}
- name: DSN
valueFrom:
secretKeyRef:
name: {{ include "kratos.secretname" . }}
key: dsn
{{- end }}
{{- if $migrationExtraEnv }}
{{- toYaml $migrationExtraEnv | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -145,11 +147,13 @@ spec:
{{- end }}
{{- end }}
env:
{{- if .Values.kratos.config.dsn }}
- name: DSN
valueFrom:
secretKeyRef:
name: {{ include "kratos.secretname" . }}
key: dsn
{{- end }}
- name: SECRETS_DEFAULT
valueFrom:
secretKeyRef:
Expand Down
2 changes: 2 additions & 0 deletions helm/charts/kratos/templates/job-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ spec:
args: ["migrate", "sql", "-e", "--yes", "--config", "/etc/config/kratos.yaml"]
{{- end }}
env:
{{- if .Values.kratos.config.dsn }}
- name: DSN
valueFrom:
secretKeyRef:
name: {{ include "kratos.secretname" . }}
key: dsn
{{- end }}
{{- if $migrationExtraEnv }}
{{- toYaml $migrationExtraEnv | nindent 10 }}
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions helm/charts/kratos/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ metadata:
{{- end }}
type: Opaque
data:
{{- if .Values.kratos.config.dsn }}
dsn: {{ include "kratos.dsn" . | b64enc | quote }}
{{- end }}
# Generate a random secret if the user doesn't give one. User given secret has priority
secretsDefault: {{ ( include "kratos.secrets.default" . | default ( randAlphaNum 32 )) | required "Value kratos.config.secrets.default can not be empty!" | b64enc | quote }}
secretsCookie: {{ ( include "kratos.secrets.cookie" . | default ( randAlphaNum 32 )) | required "Value kratos.config.secrets.cookie can not be empty!" | b64enc | quote }}
Expand Down
2 changes: 2 additions & 0 deletions helm/charts/kratos/templates/statefulset-mail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ spec:
value: {{ .Values.statefulSet.log.format }}
- name: LOG_LEVEL
value: {{ .Values.statefulSet.log.level }}
{{- if .Values.kratos.config.dsn }}
- name: DSN
valueFrom:
secretKeyRef:
name: {{ include "kratos.secretname" . }}
key: dsn
{{- end }}
- name: SECRETS_DEFAULT
valueFrom:
secretKeyRef:
Expand Down

0 comments on commit 9d908b1

Please sign in to comment.