Skip to content

Commit

Permalink
feat(helm): encryption key is now always stored in secret
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Pinsel <[email protected]>
  • Loading branch information
DominikPinsel committed Aug 10, 2023
1 parent 4dcb1a2 commit 5913764
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
5 changes: 4 additions & 1 deletion charts/managed-identity-wallet/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ spec:
- name: MIW_HOST_NAME
value: {{ tpl .Values.miw.host . }}
- name: ENCRYPTION_KEY
value: {{ default .Values.miw.database.encryptionKey (randAlphaNum 32)}}
valueFrom:
secretKeyRef:
name: {{ default .Values.miw.database.encryptionKey.secret (printf "%s-encryption-key" ( include "managed-identity-wallet.fullname" . )) }}
key: {{ default .Values.miw.database.encryptionKey.secretKey "encryption-key" }}
- name: AUTHORITY_WALLET_BPN
value: {{ tpl .Values.miw.authorityWallet.bpn . }}
- name: AUTHORITY_WALLET_DID
Expand Down
18 changes: 18 additions & 0 deletions charts/managed-identity-wallet/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,22 @@ data:
{{- range $key, $val := .Values.secrets }}
{{ $key }}: {{ $val | b64enc }}
{{- end}}
{{- end }}

---
{{- if not .Values.miw.database.encryptionKey.secret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "managed-identity-wallet.fullname" . }}-encryption-key
labels:
{{- include "managed-identity-wallet.labels" . | nindent 4 }}
type: Opaque
data:
{{- if .Values.miw.database.encryptionKey.value }}
{{ default .Values.miw.database.encryptionKey.secretKey "encryption-key" }}: {{ .Values.miw.database.encryptionKey.value | b64enc }}
{{- else }}
{{ default .Values.miw.database.encryptionKey.secretKey "encryption-key" }}: {{ randAlphaNum 32 | b64enc }}
{{- end }}

{{- end }}
26 changes: 17 additions & 9 deletions charts/managed-identity-wallet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,21 @@ miw:
secretPasswordKey: "password"
# -- Database name. Default: miw_app
name: "miw_app"
# -- Database encryption key for confidential data. If empty it is set to 32 random alphanumeric chars
encryptionKey: ""
# -- Database encryption key for confidential data. If empty a secret with 32 random alphanumeric chars is generated
encryptionKey:
# -- Encryption key value. Ignored if `secret` is set
value: ""
# -- Existing secret for database encryption key
secret: ""
# -- Existing secret key for database encryption key
secretKey: ""
keycloak:
# -- Keycloak realm
realm: "miw_test"
# -- Keycloak client id
clientId: "miw_private_client"
# -- Keycloak URL. Default: <release name>-keycloak:4200
url: "http://{{ .Release.Name }}-keycloak:4200"
# -- Keycloak URL. Default: <release name>-keycloak
url: "http://{{ .Release.Name }}-keycloak"
logging:
# -- Log Level. Should be ether ERROR, WARN, INFO, DEBUG, or TRACE. Default: INFO
level: "INFO"
Expand Down Expand Up @@ -182,10 +188,10 @@ keycloak:
# -- Keycloak authentication
auth:
# -- Keycloak admin user
adminUser: ""
adminUser: "admin"
# -- Keycloak admin password
adminPassword: ""
# -- Playground Keycloak realm configuration for the MIW
adminPassword: "password"
# -- Keycloak realm configuration
keycloakConfigCli:
# -- Enable to create the miw playground realm
enabled: true
Expand All @@ -195,9 +201,9 @@ keycloak:
backoffLimit: 5
# -- Environment Variables for the Keycloak container
extraEnvVars:
# -- Keycloak hostname. Default: <release name>-keycloak:4200
# -- Keycloak hostname. Default: <release name>-keycloak
- name: KEYCLOAK_HOSTNAME
value: "{{ .Release.Name }}-keycloak:4200"
value: "{{ .Release.Name }}-keycloak"

# -- Postgresql configuration
postgresql:
Expand All @@ -209,6 +215,8 @@ postgresql:
enablePostgresUser: false
# -- User to create
username: "miw"
# -- Password to set
password: "password"
# -- Backup configuration (see https://github.com/bitnami/charts/tree/main/bitnami/postgresql#backup-parameters)
backup:
# -- Enable to create a backup cronjob
Expand Down

0 comments on commit 5913764

Please sign in to comment.