refactor: set jwt secret generation directly in secret.yaml

Signed-off-by: Noste <83548733+Noooste@users.noreply.github.com>
This commit is contained in:
Noste
2025-12-26 15:37:51 +01:00
parent 65447b927a
commit b1b6e02a19
2 changed files with 19 additions and 18 deletions
-18
View File
@@ -1,18 +0,0 @@
{{- if not .Values.config.auth.jwt_private_key_secret.name }}
{{- $secretName := printf "%s-jwt-key" (include "garage-ui.fullname" .) }}
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace $secretName }}
{{- if not $existingSecret }}
{{- $privateKey := genPrivateKey "ed25519" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
labels:
{{- include "garage-ui.labels" . | nindent 4 }}
annotations:
"helm.sh/resource-policy": keep
type: Opaque
data:
jwt-key.pem: {{ $privateKey | b64enc | quote }}
{{- end }}
{{- end }}
+19
View File
@@ -51,3 +51,22 @@ type: Opaque
data:
jwt-key.pem: {{ .Values.config.auth.jwt_private_key | b64enc | quote }}
{{- end }}
---
{{- if not .Values.config.auth.jwt_private_key_secret.name }}
{{- $secretName := printf "%s-jwt-key" (include "garage-ui.fullname" .) }}
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace $secretName }}
{{- if not $existingSecret }}
{{- $privateKey := genPrivateKey "ed25519" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
labels:
{{- include "garage-ui.labels" . | nindent 4 }}
annotations:
"helm.sh/resource-policy": keep
type: Opaque
data:
jwt-key.pem: {{ $privateKey | b64enc | quote }}
{{- end }}
{{- end }}