aboutsummaryrefslogtreecommitdiff
path: root/script/helm/garage/templates/secret.yaml
diff options
context:
space:
mode:
authorchemicstry <chemicstry@gmail.com>2022-06-20 18:49:38 +0300
committerMaximilien R <maximilien@deuxfleurs.fr>2022-09-30 18:46:57 +0200
commitb71fa2ddf45e21f40067fc021b3a81d738556eca (patch)
treea3ab91563a4177950420c869cfd0d7cc6df2c6b0 /script/helm/garage/templates/secret.yaml
parent37a73d7d3782ec8a5cd8b0e71a00722f90321ced (diff)
downloadgarage-b71fa2ddf45e21f40067fc021b3a81d738556eca.tar.gz
garage-b71fa2ddf45e21f40067fc021b3a81d738556eca.zip
Generate random RPC secret if not provided
Diffstat (limited to 'script/helm/garage/templates/secret.yaml')
-rw-r--r--script/helm/garage/templates/secret.yaml14
1 files changed, 14 insertions, 0 deletions
diff --git a/script/helm/garage/templates/secret.yaml b/script/helm/garage/templates/secret.yaml
new file mode 100644
index 00000000..54749424
--- /dev/null
+++ b/script/helm/garage/templates/secret.yaml
@@ -0,0 +1,14 @@
+apiVersion: v1
+kind: Secret
+metadata:
+ name: {{ include "garage.rpcSecretName" . }}
+ labels:
+ {{- include "garage.labels" . | nindent 4 }}
+type: Opaque
+data:
+ {{/* retrieve the secret data using lookup function and when not exists, return an empty dictionary / map as result */}}
+ {{- $prevSecret := (lookup "v1" "Secret" .Release.Namespace (include "garage.rpcSecretName" .)) | default dict }}
+ {{- $prevSecretData := $prevSecret.data | default dict }}
+ {{- $prevRpcSecret := $prevSecretData.rpcSecret | default "" | b64dec }}
+ {{/* Priority is: 1. from values, 2. previous value, 3. generate random */}}
+ rpcSecret: {{ .Values.garage.rpcSecret | default $prevRpcSecret | default (include "jupyterhub.randHex" 64) | b64enc | quote }}