Skip to content

Commit

Permalink
Merge pull request #8 from krumIO/fix/dbcreate-jobs-with-external-sec…
Browse files Browse the repository at this point in the history
…rets

simplify dbcreds fallbacks
  • Loading branch information
hadams95 authored Mar 21, 2024
2 parents c33c4f4 + 9af60e3 commit 8265765
Showing 1 changed file with 12 additions and 36 deletions.
48 changes: 12 additions & 36 deletions helm/common/templates/_db_setup_job.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,66 +59,42 @@ spec:
name: {{ .Release.Name }}-postgresql
key: postgres-password
optional: false
{{- else if .Values.externalSecrets.dbcreds }}
{{- else if or .Values.externalSecrets.dbcreds $.Values.global.postgres.externalSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalSecrets.dbcreds }}
key: password
optional: false
{{- else if $.Values.global.postgres.externalSecret }}
valueFrom:
secretKeyRef:
name: {{ $.Values.global.postgres.externalSecret }}
name: {{ .Values.externalSecrets.dbcreds | default $.Values.global.postgres.externalSecret }}
key: password
optional: false
{{- else }}
value: {{ .Values.global.postgres.master.password | quote}}
{{- end }}
- name: PGUSER
{{- if .Values.externalSecrets.dbcreds }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalSecrets.dbcreds }}
key: username
optional: false
{{- else if $.Values.global.postgres.externalSecret }}
{{- if or .Values.externalSecrets.dbcreds $.Values.global.postgres.externalSecret }}
valueFrom:
secretKeyRef:
name: {{ $.Values.global.postgres.externalSecret }}
name: {{ .Values.externalSecrets.dbcreds | default $.Values.global.postgres.externalSecret }}
key: username
optional: false
{{- else }}
{{- else }}
value: {{ .Values.global.postgres.master.username | quote }}
{{- end }}
{{- end }}
- name: PGPORT
{{- if .Values.externalSecrets.dbcreds }}
{{- if or .Values.externalSecrets.dbcreds $.Values.global.postgres.externalSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalSecrets.dbcreds }}
name: {{ .Values.externalSecrets.dbcreds | default $.Values.global.postgres.externalSecret }}
key: port
optional: false
{{- else if $.Values.global.postgres.externalSecret }}
valueFrom:
secretKeyRef:
name: {{ $.Values.global.postgres.externalSecret }}
key: port
optional: false
{{- else }}
{{- else }}
value: {{ .Values.global.postgres.master.port | quote }}
{{- end }}
{{- end }}
- name: PGHOST
{{- if $.Values.global.dev }}
value: "{{ .Release.Name }}-postgresql"
{{- else if .Values.externalSecrets.dbcreds }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalSecrets.dbcreds }}
key: host
optional: false
{{- else if $.Values.global.postgres.externalSecret }}
{{- else if or .Values.externalSecrets.dbcreds $.Values.global.postgres.externalSecret }}
valueFrom:
secretKeyRef:
name: {{ $.Values.global.postgres.externalSecret }}
name: {{ .Values.externalSecrets.dbcreds | default $.Values.global.postgres.externalSecret }}
key: host
optional: false
{{- else }}
Expand Down

0 comments on commit 8265765

Please sign in to comment.