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: custom secrets and config maps issue #92

Merged
merged 5 commits into from
Oct 30, 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
2 changes: 2 additions & 0 deletions templates/configmap-env.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.passboltEnv.configMapName }}
{{- $type := "cm" -}}
{{- $action := "env" -}}
{{- $Name := include "passbolt-library.fullname" . -}}
Expand All @@ -20,3 +21,4 @@ data:
DATASOURCES_DEFAULT_DRIVER: 'Cake\Database\Driver\Postgres'
DATASOURCES_DEFAULT_ENCODING: "utf8"
{{- end -}}
{{- end }}
5 changes: 3 additions & 2 deletions templates/cronjob-proc-email.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ spec:
{{- end }}
envFrom:
- configMapRef:
name: {{ $Name }}-cm-env
name: {{ default (printf "%s-cm-env" $Name) .Values.passboltEnv.configMapName }}
- secretRef:
name: {{ $Name }}-sec-env
name: {{ default (printf "%s-sec-env" $Name) .Values.passboltEnv.secretName }}
{{- with .Values.passboltEnv.extraEnvFrom }}
{{- with .Values.passboltEnv.extraEnvFrom }}
{{- toYaml . | nindent 16 }}
{{- end }}
Expand Down
12 changes: 8 additions & 4 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
{{ if ( not $.Values.passboltEnv.secretName ) }}
checksum/sec-env: {{ include (print $.Template.BasePath "/secret-env.yaml") . | sha256sum }}
{{- end }}
{{ if ( not $.Values.gpgExistingSecret ) }}
checksum/sec-gpg: {{ include (print $.Template.BasePath "/secret-gpg.yaml") . | sha256sum }}
{{- end }}
{{ if ( not $.Values.passboltEnv.configMapName ) }}
checksum/cm-env: {{ include (print $.Template.BasePath "/configmap-env.yaml") . | sha256sum }}
{{- end }}
{{- if and .Values.passboltEnv.plain.PASSBOLT_PLUGINS_JWT_AUTHENTICATION_ENABLED ( not .Values.jwtExistingSecret ) }}
checksum/sec-jwt: {{ include (print $.Template.BasePath "/secret-jwt.yaml") . | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -90,9 +94,9 @@ spec:
{{- end }}
envFrom:
- configMapRef:
name: {{ $Name }}-cm-env
name: {{ default (printf "%s-cm-env" $Name) .Values.passboltEnv.configMapName }}
- secretRef:
name: {{ $Name }}-sec-env
name: {{ default (printf "%s-sec-env" $Name) .Values.passboltEnv.secretName }}
{{- with .Values.passboltEnv.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -128,9 +132,9 @@ spec:
{{- end }}
envFrom:
- configMapRef:
name: {{ $Name }}-cm-env
name: {{ default (printf "%s-cm-env" $Name) .Values.passboltEnv.configMapName }}
- secretRef:
name: {{ $Name }}-sec-env
name: {{ default (printf "%s-sec-env" $Name) .Values.passboltEnv.secretName }}
{{- with .Values.passboltEnv.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions templates/job-create-gpg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ spec:
{{- end }}
envFrom:
- configMapRef:
name: {{ $Name }}-cm-env
name: {{ default (printf "%s-cm-env" $Name) .Values.passboltEnv.configMapName }}
- secretRef:
name: {{ $Name }}-sec-env
name: {{ default (printf "%s-sec-env" $Name) .Values.passboltEnv.secretName }}
{{- with .Values.passboltEnv.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions templates/job-create-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ spec:
{{- end }}
envFrom:
- configMapRef:
name: {{ $Name }}-cm-env
name: {{ default (printf "%s-cm-env" $Name) .Values.passboltEnv.configMapName }}
- secretRef:
name: {{ $Name }}-sec-env
name: {{ default (printf "%s-sec-env" $Name) .Values.passboltEnv.secretName }}
{{- with .Values.passboltEnv.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
12 changes: 6 additions & 6 deletions templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ rules:
resources: [ "configmaps", "secrets" ]
resourceNames:
- {{ $Name }}-sec-redis-proxy
- {{ $Name }}-cm-env
- {{ $Name }}-sec-env
- {{ default (printf "%s-cm-env" $Name) .Values.passboltEnv.configMapName }}
- {{ default (printf "%s-sec-env" $Name) .Values.passboltEnv.secretName }}
- {{ include "passbolt.gpg.secretName" ( dict "name" $Name "Values" $.Values ) }}
- {{ include "passbolt.jwt.secretName" ( dict "name" $Name "Values" $.Values ) }}
- {{ $Name }}-sec-tls
Expand Down Expand Up @@ -64,9 +64,9 @@ rules:
- apiGroups: [""]
resources: [ "configmaps", "secrets" ]
resourceNames:
- {{ $Name }}-cm-env
- {{ default (printf "%s-cm-env" $Name) .Values.passboltEnv.configMapName }}
- {{ include "passbolt.gpg.secretName" ( dict "name" $Name "Values" $.Values ) }}
- {{ $Name }}-sec-env
- {{ default (printf "%s-sec-env" $Name) .Values.passboltEnv.secretName }}
- {{ $Name }}-sec-redis-proxy
verbs: ["get", "patch"]
---
Expand Down Expand Up @@ -112,9 +112,9 @@ rules:
- apiGroups: [""]
resources: [ "configmaps", "secrets" ]
resourceNames:
- {{ $Name }}-cm-env
- {{ default (printf "%s-cm-env" $Name) .Values.passboltEnv.configMapName }}
- {{ include "passbolt.jwt.secretName" ( dict "name" $Name "Values" $.Values ) }}
- {{ $Name }}-sec-env
- {{ default (printf "%s-sec-env" $Name) .Values.passboltEnv.secretName }}
- {{ $Name }}-sec-redis-proxy
verbs: ["get", "patch"]
---
Expand Down
2 changes: 2 additions & 0 deletions templates/secret-env.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.passboltEnv.secretName }}
{{- $type := "sec" -}}
{{- $action := "env" -}}
{{- $Name := include "passbolt-library.fullname" . -}}
Expand Down Expand Up @@ -26,3 +27,4 @@ data:
{{- $port := ( default "5432" .Values.passboltEnv.plain.DATASOURCES_DEFAULT_PORT) | toString }}
DATASOURCES_DEFAULT_URL: {{ printf "postgres://%s:%s@%s:%s/%s?schema=%s" $username $password $host $port $database $schema | toString | b64enc }}
{{- end -}}
{{- end }}
6 changes: 6 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ passboltEnv:
[]
# - secretRef:
# name: passbolt-secret
## Overrides the plain value in the case of not wanting to provide the config from values
## Do this ONLY if you know what you are doing
configMapName: ''
## Overrides the secrets value in the case of not wanting to provide them in the values file.
## Do this ONLY if you know what you are doing
secretName: ''
## Passbolt deployment parameters

# -- If autoscaling is disabled this will define the number of pods to run
Expand Down
Loading