Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(helm): make different secrets for backend, postgres DB and flyway and remove unnecessary secret entries #2011

Merged
merged 3 commits into from
Jun 14, 2024
Merged
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
4 changes: 2 additions & 2 deletions charts/app/templates/backend/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
imagePullPolicy: {{ default "Always" .Values.backend.imagePullPolicy }}
envFrom:
- secretRef:
name: {{.Release.Name}}
name: {{.Release.Name}}-flyway
env:
- name: FLYWAY_BASELINE_ON_MIGRATE
value: "true"
Expand All @@ -59,7 +59,7 @@ spec:
imagePullPolicy: {{ default "Always" .Values.backend.imagePullPolicy }}
envFrom:
- secretRef:
name: {{.Release.Name}}
name: {{.Release.Name}}-backend
env:
- name: LOG_LEVEL
value: info
Expand Down
41 changes: 29 additions & 12 deletions charts/app/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,44 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}
name: {{ .Release.Name }}-backend
labels: {{- include "labels" . | nindent 4 }}
{{- if .Values.global.secrets.persist }}
annotations:
helm.sh/resource-policy: keep
{{- end }}
data:
databasePassword: {{ $databasePassword | quote }}
postgres-password: {{ $databasePassword | quote }}
password: {{ $databasePassword | quote }}
databaseUser: {{ $databaseUser | b64enc | quote }}
databaseName: {{ $databaseName | b64enc | quote }}
databaseURL: {{ $databaseURL | b64enc | quote }}
databaseJDBCURL: {{ $databaseJDBCURL | b64enc | quote }}
databaseJDBCURLNoCreds: {{ $databaseJDBCURLNoCreds | b64enc | quote }}
FLYWAY_URL: {{ $databaseJDBCURLNoCreds | b64enc | quote }}
FLYWAY_USER: {{ $databaseUser | b64enc | quote }}
FLYWAY_PASSWORD: {{ $databasePassword | quote }}
POSTGRES_PASSWORD: {{ $databasePassword | quote }}
POSTGRES_USER: {{ $databaseUser | b64enc | quote }}
POSTGRES_DATABASE: {{ $databaseName | b64enc | quote }}
POSTGRES_HOST: {{ $hostWithoutPort | b64enc | quote }}

---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-flyway
labels: {{- include "labels" . | nindent 4 }}
{{- if .Values.global.secrets.persist }}
annotations:
helm.sh/resource-policy: keep
{{- end }}
data:
FLYWAY_URL: {{ $databaseJDBCURLNoCreds | b64enc | quote }}
FLYWAY_USER: {{ $databaseUser | b64enc | quote }}
FLYWAY_PASSWORD: {{ $databasePassword | quote }}

---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-database
labels: {{- include "labels" . | nindent 4 }}
{{- if .Values.global.secrets.persist }}
annotations:
helm.sh/resource-policy: keep
{{- end }}
data:
postgres-password: {{ $databasePassword | quote }}
password: {{ $databasePassword | quote }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ bitnami-pg:
repository: bcgov/nr-containers/bitnami/postgresql
tag: 15.7.0
auth:
existingSecret: '{{ .Release.Name }}'
existingSecret: '{{ .Release.Name }}-database'
username: 'quickstart'
database: quickstart
shmVolume:
Expand Down
Loading