Skip to content

Commit

Permalink
Add auth.existingSecret for external secret management
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Veschambre <gveschambre@petalmd.com>
  • Loading branch information
shepz authored and faridco committed Nov 14, 2024
1 parent 6b5801d commit 51c1bb7
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 2 deletions.
9 changes: 9 additions & 0 deletions aidbox/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/* Create the secret name for Aidbox, using existingSecret if set */}}
{{- define "aidbox.secretName" -}}
{{- if .Values.auth.existingSecret -}}
{{ .Values.auth.existingSecret }}
{{- else -}}
{{ include "aidbox.fullname" . }}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion aidbox/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
- configMapRef:
name: {{ include "aidbox.fullname" . }}
- secretRef:
name: {{ include "aidbox.fullname" . }}
name: {{ include "aidbox.secretName" . }}
{{- range .Values.extraEnvFromConfigMaps }}
- configMapRef:
name: {{ . }}
Expand Down
2 changes: 2 additions & 0 deletions aidbox/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.auth.existingSecret -}}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -17,3 +18,4 @@ data:
{{ if .PGUSER }}PGUSER: {{ .PGUSER | b64enc }}{{ end }}
{{ if .PGPASSWORD }}PGPASSWORD: {{ .PGPASSWORD | b64enc }}{{ end }}
{{- end }}
{{- end -}}
3 changes: 3 additions & 0 deletions aidbox/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ config:
BOX_METRICS_PORT: 8765
PGPORT: 5432

auth:
existingSecret: ""

image:
repository: healthsamurai/aidboxone
pullPolicy: IfNotPresent
Expand Down
10 changes: 10 additions & 0 deletions aidboxdb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}


{{/* Create the secret name for AidboxDB, using existingSecret if set */}}
{{- define "aidboxdb.secretName" -}}
{{- if .Values.auth.existingSecret -}}
{{ .Values.auth.existingSecret }}
{{- else -}}
{{ include "aidboxdb.fullname" . }}
{{- end -}}
{{- end -}}
2 changes: 2 additions & 0 deletions aidboxdb/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.auth.existingSecret -}}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -10,3 +11,4 @@ data:
POSTGRES_PASSWORD: {{ .POSTGRES_PASSWORD | b64enc }}
POSTGRES_USER: {{ .POSTGRES_USER | b64enc }}
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion aidboxdb/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
- configMapRef:
name: {{ $fullName }}-env
- secretRef:
name: {{ $fullName }}
name: {{ include "aidboxdb.secretName" . }}
volumeMounts:
- name: db-pg-config
mountPath: /etc/configs
Expand Down
3 changes: 3 additions & 0 deletions aidboxdb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres

auth:
existingSecret: ""

storage:
# -- Storage className to use
className: ""
Expand Down

0 comments on commit 51c1bb7

Please sign in to comment.