annother attempt at bitwarden/fireflyiii fix

This commit is contained in:
kjeld Schouten-Lebbing 2021-08-31 18:40:02 +02:00
parent ce9969be4f
commit 36046257fc
No known key found for this signature in database
GPG Key ID: 4CDAD4A532BC1EDB
4 changed files with 18 additions and 20 deletions

View File

@ -27,4 +27,4 @@ name: fireflyiii
sources: sources:
- https://github.com/firefly-iii/firefly-iii/ - https://github.com/firefly-iii/firefly-iii/
type: application type: application
version: 6.0.10 version: 6.0.11

View File

@ -7,17 +7,16 @@ kind: Secret
metadata: metadata:
{{- $dbcredsname := ( printf "%v-%v" .Release.Name "dbcreds" ) }} {{- $dbcredsname := ( printf "%v-%v" .Release.Name "dbcreds" ) }}
name: {{ $dbcredsname }} name: {{ $dbcredsname }}
{{- $previous := lookup "v1" "Secret" .Release.Namespace $dbcredsname }}
{{- $dbPass := "" }}
data: data:
{{- if $previous }} {{- if .Release.IsInstall }}
postgresql-password: {{ ( index $previous.data "postgresql-password" ) }} postgresql-password: {{ randAlphaNum 50 | b64enc | quote }}
postgresql-postgres-password: {{ ( index $previous.data "postgresql-postgres-password" ) }}
{{- else }}
{{- $dbPass = randAlphaNum 50 }}
postgresql-password: {{ $dbPass | b64enc | quote }}
postgresql-postgres-password: {{ randAlphaNum 50 | b64enc | quote }} postgresql-postgres-password: {{ randAlphaNum 50 | b64enc | quote }}
{{- end }} {{ else }}
# `index` function is necessary because the property name contains a dash.
# Otherwise (...).data.db_password would have worked too.
postgresql-password: {{ index (lookup "v1" "Secret" .Release.Namespace ( $dbcredsname | quote ) ).data "postgresql-password" }}
postgresql-postgres-password: {{ index (lookup "v1" "Secret" .Release.Namespace ( $dbcredsname | quote ) ).data "postgresql-postgres-password" }}
{{ end }}
url: {{ ( printf "%v%v:%v@%v-%v:%v/%v" "postgresql://" .Values.postgresql.postgresqlUsername $dbPass .Release.Name "postgresql" "5432" .Values.postgresql.postgresqlDatabase ) | b64enc | quote }} url: {{ ( printf "%v%v:%v@%v-%v:%v/%v" "postgresql://" .Values.postgresql.postgresqlUsername $dbPass .Release.Name "postgresql" "5432" .Values.postgresql.postgresqlDatabase ) | b64enc | quote }}
postgresql_host: {{ ( printf "%v-%v" .Release.Name "postgresql" ) | b64enc | quote }} postgresql_host: {{ ( printf "%v-%v" .Release.Name "postgresql" ) | b64enc | quote }}
type: Opaque type: Opaque

View File

@ -31,4 +31,4 @@ name: vaultwarden
sources: sources:
- https://github.com/dani-garcia/vaultwarden - https://github.com/dani-garcia/vaultwarden
type: application type: application
version: 5.0.10 version: 5.0.11

View File

@ -43,17 +43,16 @@ metadata:
{{- include "common.labels" . | nindent 4 }} {{- include "common.labels" . | nindent 4 }}
{{- $dbcredsname := ( printf "%v-%v" .Release.Name "dbcreds" ) }} {{- $dbcredsname := ( printf "%v-%v" .Release.Name "dbcreds" ) }}
name: {{ $dbcredsname }} name: {{ $dbcredsname }}
{{- $previous := lookup "v1" "Secret" .Release.Namespace $dbcredsname }}
{{- $dbPass := "" }}
data: data:
{{- if $previous }} {{- if .Release.IsInstall }}
postgresql-password: {{ ( index $previous.data "postgresql-password" ) }} postgresql-password: {{ randAlphaNum 50 | b64enc | quote }}
postgresql-postgres-password: {{ ( index $previous.data "postgresql-postgres-password" ) }}
{{- else }}
{{- $dbPass = randAlphaNum 50 }}
postgresql-password: {{ $dbPass | b64enc | quote }}
postgresql-postgres-password: {{ randAlphaNum 50 | b64enc | quote }} postgresql-postgres-password: {{ randAlphaNum 50 | b64enc | quote }}
{{- end }} {{ else }}
# `index` function is necessary because the property name contains a dash.
# Otherwise (...).data.db_password would have worked too.
postgresql-password: {{ index (lookup "v1" "Secret" .Release.Namespace ( $dbcredsname | quote ) ).data "postgresql-password" }}
postgresql-postgres-password: {{ index (lookup "v1" "Secret" .Release.Namespace ( $dbcredsname | quote ) ).data "postgresql-postgres-password" }}
{{ end }}
url: {{ ( printf "%v%v:%v@%v-%v:%v/%v" "postgresql://" .Values.postgresql.postgresqlUsername $dbPass .Release.Name "postgresql" "5432" .Values.postgresql.postgresqlDatabase ) | b64enc | quote }} url: {{ ( printf "%v%v:%v@%v-%v:%v/%v" "postgresql://" .Values.postgresql.postgresqlUsername $dbPass .Release.Name "postgresql" "5432" .Values.postgresql.postgresqlDatabase ) | b64enc | quote }}
type: Opaque type: Opaque
{{- end -}} {{- end -}}