Skip to content

Commit 51c1bb7

Browse files
shepzfaridco
authored andcommitted
Add auth.existingSecret for external secret management
Signed-off-by: Guillaume Veschambre <[email protected]>
1 parent 6b5801d commit 51c1bb7

File tree

8 files changed

+31
-2
lines changed

8 files changed

+31
-2
lines changed

aidbox/templates/_helpers.tpl

+9
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,12 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/* Create the secret name for Aidbox, using existingSecret if set */}}
65+
{{- define "aidbox.secretName" -}}
66+
{{- if .Values.auth.existingSecret -}}
67+
{{ .Values.auth.existingSecret }}
68+
{{- else -}}
69+
{{ include "aidbox.fullname" . }}
70+
{{- end -}}
71+
{{- end -}}

aidbox/templates/deployment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
- configMapRef:
3333
name: {{ include "aidbox.fullname" . }}
3434
- secretRef:
35-
name: {{ include "aidbox.fullname" . }}
35+
name: {{ include "aidbox.secretName" . }}
3636
{{- range .Values.extraEnvFromConfigMaps }}
3737
- configMapRef:
3838
name: {{ . }}

aidbox/templates/secrets.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if not .Values.auth.existingSecret -}}
12
apiVersion: v1
23
kind: Secret
34
metadata:
@@ -17,3 +18,4 @@ data:
1718
{{ if .PGUSER }}PGUSER: {{ .PGUSER | b64enc }}{{ end }}
1819
{{ if .PGPASSWORD }}PGPASSWORD: {{ .PGPASSWORD | b64enc }}{{ end }}
1920
{{- end }}
21+
{{- end -}}

aidbox/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ config:
1010
BOX_METRICS_PORT: 8765
1111
PGPORT: 5432
1212

13+
auth:
14+
existingSecret: ""
15+
1316
image:
1417
repository: healthsamurai/aidboxone
1518
pullPolicy: IfNotPresent

aidboxdb/templates/_helpers.tpl

+10
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,13 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
65+
{{/* Create the secret name for AidboxDB, using existingSecret if set */}}
66+
{{- define "aidboxdb.secretName" -}}
67+
{{- if .Values.auth.existingSecret -}}
68+
{{ .Values.auth.existingSecret }}
69+
{{- else -}}
70+
{{ include "aidboxdb.fullname" . }}
71+
{{- end -}}
72+
{{- end -}}

aidboxdb/templates/secrets.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if not .Values.auth.existingSecret -}}
12
apiVersion: v1
23
kind: Secret
34
metadata:
@@ -10,3 +11,4 @@ data:
1011
POSTGRES_PASSWORD: {{ .POSTGRES_PASSWORD | b64enc }}
1112
POSTGRES_USER: {{ .POSTGRES_USER | b64enc }}
1213
{{- end }}
14+
{{- end -}}

aidboxdb/templates/statefulset.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ spec:
4646
- configMapRef:
4747
name: {{ $fullName }}-env
4848
- secretRef:
49-
name: {{ $fullName }}
49+
name: {{ include "aidboxdb.secretName" . }}
5050
volumeMounts:
5151
- name: db-pg-config
5252
mountPath: /etc/configs

aidboxdb/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ env:
1010
POSTGRES_USER: postgres
1111
POSTGRES_DB: postgres
1212

13+
auth:
14+
existingSecret: ""
15+
1316
storage:
1417
# -- Storage className to use
1518
className: ""

0 commit comments

Comments
 (0)