nats chart provisoning
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
{{- $contextName := .contextName }}
|
||||
|
||||
# url
|
||||
{{- if .Values.service.enabled }}
|
||||
url: nats://{{ .Values.service.name }}
|
||||
{{- else }}
|
||||
url: nats://{{ .Values.headlessService.name }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .context }}
|
||||
|
||||
# creds
|
||||
{{- with .creds}}
|
||||
{{- if .contents }}
|
||||
creds: /etc/nats-contents/{{ $contextName }}.creds
|
||||
{{- else if .secretName }}
|
||||
{{- $dir := trimSuffix "/" .dir }}
|
||||
creds: {{ printf "%s/%s" $dir (.key | default "nats.creds") | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
# nkey
|
||||
{{- with .nkey}}
|
||||
{{- if .contents }}
|
||||
nkey: /etc/nats-contents/{{ $contextName }}.nk
|
||||
{{- else if .secretName }}
|
||||
{{- $dir := trimSuffix "/" .dir }}
|
||||
nkey: {{ printf "%s/%s" $dir (.key | default "nats.nk") | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
# tls
|
||||
{{- with .tls }}
|
||||
{{- if .secretName }}
|
||||
{{- $dir := trimSuffix "/" .dir }}
|
||||
cert: {{ printf "%s/%s" $dir (.cert | default "tls.crt") | quote }}
|
||||
key: {{ printf "%s/%s" $dir (.key | default "tls.key") | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
# tlsCA
|
||||
{{- if $.Values.config.nats.tls.enabled }}
|
||||
{{- with $.Values.tlsCA }}
|
||||
{{- if and .enabled (or .configMapName .secretName) }}
|
||||
{{- $dir := trimSuffix "/" .dir }}
|
||||
ca: {{ printf "%s/%s" $dir (.key | default "ca.crt") | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
{{- include "nats.metadataNamespace" $ | nindent 2 }}
|
||||
name: {{ .Values.natsBox.contextsSecret.name }}
|
||||
labels:
|
||||
{{- include "natsBox.labels" $ | nindent 4 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{- range $ctxKey, $ctxVal := .Values.natsBox.contexts }}
|
||||
"{{ $ctxKey }}.json": |
|
||||
{{- include "toPrettyRawJson" (include "nats.loadMergePatch" (dict "file" "nats-box/contexts-secret/context.yaml" "merge" (.merge | default dict) "patch" (.patch | default list) "ctx" (merge (dict "contextName" $ctxKey "context" $ctxVal) $)) | fromYaml) | nindent 4 }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user