[bitnami/etcd] Reuse etcd jwt token while upgrade (#12019)

Signed-off-by: Nobi <nobi@nobidev.com>
This commit is contained in:
Nguyễn Đức Chiến
2022-09-16 16:31:23 +07:00
committed by GitHub
parent 21ed1ffa35
commit b29606f620
3 changed files with 13 additions and 2 deletions

View File

@@ -24,4 +24,4 @@ name: etcd
sources:
- https://github.com/bitnami/containers/tree/main/bitnami/etcd
- https://coreos.com/etcd/
version: 8.5.1
version: 8.5.2

View File

@@ -192,3 +192,14 @@ etcd: disasterRecovery
Please enable persistence (--set persistence.enabled=true)
{{- end -}}
{{- end -}}
{{- define "etcd.token.jwtToken" -}}
{{- if (include "etcd.token.createSecret" .) -}}
{{- $jwtToken := lookup "v1" "Secret" .Release.Namespace (printf "%s-jwt-token" (include "common.names.fullname" .)) -}}
{{- if $jwtToken -}}
{{ index $jwtToken "data" "jwt-token.pem" | b64dec }}
{{- else -}}
{{ genPrivateKey "rsa" }}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -10,5 +10,5 @@ metadata:
{{- end }}
type: Opaque
data:
jwt-token.pem: {{ genPrivateKey "rsa" | b64enc | quote }}
jwt-token.pem: {{ include "etcd.token.jwtToken" . | b64enc | quote }}
{{- end }}