diff --git a/charts/wytui/templates/config/secret.yaml b/charts/wytui/templates/config/secret.yaml index 39e379b..cd21165 100644 --- a/charts/wytui/templates/config/secret.yaml +++ b/charts/wytui/templates/config/secret.yaml @@ -1,4 +1,13 @@ {{- if not .Values.secret.existing }} +{{- $authSecret := .Values.secret.authSecret -}} +{{- if not $authSecret -}} + {{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace .Values.secret.name) -}} + {{- if $existingSecret -}} + {{- $authSecret = index $existingSecret.data .Values.secret.authSecretKey | b64dec -}} + {{- else -}} + {{- $authSecret = randAlphaNum 64 -}} + {{- end -}} +{{- end -}} apiVersion: v1 kind: Secret metadata: @@ -7,7 +16,7 @@ metadata: type: Opaque stringData: {{ .Values.postgresql.secret.urlKey }}: {{ include "wytui.databaseUrl" . | quote }} - {{ .Values.secret.authSecretKey }}: {{ .Values.secret.authSecret | quote }} + {{ .Values.secret.authSecretKey }}: {{ $authSecret | quote }} {{- end }} --- {{- if and .Values.oidc.enabled (not .Values.oidc.secret.existing) }} diff --git a/charts/wytui/templates/deployment/postgresql.yaml b/charts/wytui/templates/deployment/postgresql.yaml index b57b45e..f2ec834 100644 --- a/charts/wytui/templates/deployment/postgresql.yaml +++ b/charts/wytui/templates/deployment/postgresql.yaml @@ -63,8 +63,11 @@ spec: volumeMounts: - name: postgresql-data mountPath: /var/lib/postgresql/data + {{- if .Values.postgresql.persistent.subPath }} + subPath: {{ .Values.postgresql.persistent.subPath }} + {{- end }} volumes: - name: postgresql-data persistentVolumeClaim: - claimName: wytui-postgresql + claimName: {{ .Values.postgresql.persistent.existingClaim | default "wytui-postgresql" }} {{- end }} diff --git a/charts/wytui/templates/deployment/wytui.yaml b/charts/wytui/templates/deployment/wytui.yaml index 054c334..ac1a70a 100644 --- a/charts/wytui/templates/deployment/wytui.yaml +++ b/charts/wytui/templates/deployment/wytui.yaml @@ -38,12 +38,18 @@ spec: volumeMounts: - name: downloads mountPath: /downloads + {{- if .Values.downloads.persistent.subPath }} + subPath: {{ .Values.downloads.persistent.subPath }} + {{- end }} - name: library mountPath: /media + {{- if .Values.library.persistent.subPath }} + subPath: {{ .Values.library.persistent.subPath }} + {{- end }} volumes: - name: downloads persistentVolumeClaim: - claimName: wytui-downloads + claimName: {{ .Values.downloads.persistent.existingClaim | default "wytui-downloads" }} - name: library persistentVolumeClaim: - claimName: wytui-library + claimName: {{ .Values.library.persistent.existingClaim | default "wytui-library" }} diff --git a/charts/wytui/templates/volumes/downloads.yaml b/charts/wytui/templates/volumes/downloads.yaml index e79eece..5859bd3 100644 --- a/charts/wytui/templates/volumes/downloads.yaml +++ b/charts/wytui/templates/volumes/downloads.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.downloads.persistent.existingClaim }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -12,3 +13,4 @@ spec: resources: requests: storage: {{ .Values.downloads.persistent.size }} +{{- end }} diff --git a/charts/wytui/templates/volumes/library.yaml b/charts/wytui/templates/volumes/library.yaml index a338b3d..7003658 100644 --- a/charts/wytui/templates/volumes/library.yaml +++ b/charts/wytui/templates/volumes/library.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.library.persistent.existingClaim }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -12,3 +13,4 @@ spec: resources: requests: storage: {{ .Values.library.persistent.size }} +{{- end }} diff --git a/charts/wytui/templates/volumes/postgresql.yaml b/charts/wytui/templates/volumes/postgresql.yaml index 81af3f5..0fd5091 100644 --- a/charts/wytui/templates/volumes/postgresql.yaml +++ b/charts/wytui/templates/volumes/postgresql.yaml @@ -1,4 +1,4 @@ -{{- if .Values.postgresql.enabled }} +{{- if and .Values.postgresql.enabled (not .Values.postgresql.persistent.existingClaim) }} apiVersion: v1 kind: PersistentVolumeClaim metadata: diff --git a/charts/wytui/values.yaml b/charts/wytui/values.yaml index 6e053df..f3cf6cd 100644 --- a/charts/wytui/values.yaml +++ b/charts/wytui/values.yaml @@ -48,6 +48,8 @@ postgresql: password: "" passwordKey: POSTGRES_PASSWORD persistent: + existingClaim: "" + subPath: "" size: 5Gi storageClass: "" accessModes: @@ -55,6 +57,8 @@ postgresql: downloads: persistent: + existingClaim: "" + subPath: "" size: 5Gi storageClass: "" accessModes: @@ -62,6 +66,8 @@ downloads: library: persistent: + existingClaim: "" + subPath: "" size: 10Gi storageClass: "" accessModes: