2021-11-30 13:33:15 +00:00
|
|
|
{{/*
|
2022-02-22 10:24:26 +00:00
|
|
|
This template generates a random appkey and ensures it persists across updates/edits to the chart
|
2021-11-30 13:33:15 +00:00
|
|
|
*/}}
|
|
|
|
{{- define "monica.appkey" -}}
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Secret
|
2022-02-22 10:24:26 +00:00
|
|
|
type: Opaque
|
2021-11-30 13:33:15 +00:00
|
|
|
metadata:
|
2022-02-22 10:24:26 +00:00
|
|
|
name: appkey
|
2021-11-30 13:33:15 +00:00
|
|
|
labels:
|
2022-06-07 17:41:19 +00:00
|
|
|
{{- include "tc.common.labels" . | nindent 4 }}
|
2021-11-30 13:33:15 +00:00
|
|
|
{{- $keyprevious := lookup "v1" "Secret" .Release.Namespace "appkey" }}
|
|
|
|
{{- $appkey := "" }}
|
|
|
|
data:
|
2022-02-22 10:24:26 +00:00
|
|
|
{{- if $keyprevious }}
|
2021-11-30 13:33:15 +00:00
|
|
|
appkey: {{ ( index $keyprevious.data "appkey" ) }}
|
2022-02-22 10:24:26 +00:00
|
|
|
{{- else }}
|
|
|
|
{{- $appkey = randAlphaNum 32 }}
|
|
|
|
appkey: {{ $appkey | b64enc }}
|
|
|
|
{{- end }}
|
2021-11-30 13:33:15 +00:00
|
|
|
{{- end -}}
|