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:
|
|
|
|
{{- include "common.labels" . | nindent 4 }}
|
|
|
|
{{- $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 -}}
|