Skip to content

Commit d347ca3

Browse files
authored
Merge pull request #242 from akash4sh/main
Add secret reference for NATS token
2 parents 61e2e19 + 432e901 commit d347ca3

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

charts/nats/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ maintainers:
1919
name: Jaime Piña
2020
url: https://github.com/variadico
2121
name: nats
22-
version: 0.13.4
22+
version: 0.13.5

charts/nats/templates/configmap.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,13 @@ data:
482482
system_account: {{ . }}
483483
{{- end }}
484484
485-
{{- with .Values.auth.token }}
486485
authorization {
487-
token: "{{ . }}"
488-
489-
486+
{{- if .Values.auth.token }}
487+
token: "{{ .Values.auth.token }}"
488+
{{- else if .Values.auth.secret }}
489+
token: $AUTH_TOKEN
490+
{{- end }}
491+
490492
{{- if $.Values.auth.timeout }}
491493
timeout: {{ $.Values.auth.timeout }}
492494
{{- end }}
@@ -539,6 +541,4 @@ data:
539541
accounts: {{- toRawJson . }}
540542
{{- end }}
541543
542-
{{- end }}
543-
544-
{{- end }}
544+
{{- end }}

charts/nats/templates/statefulset.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ spec:
318318
fieldPath: metadata.namespace
319319
- name: CLUSTER_ADVERTISE
320320
value: {{ include "nats.clusterAdvertise" . }}
321-
322321
{{- if .Values.nats.jetstream.enabled }}
323322
{{- with .Values.nats.jetstream.encryption }}
324323
{{- with .secret }}
@@ -330,6 +329,13 @@ spec:
330329
{{- end }}
331330
{{- end }}
332331
{{- end }}
332+
{{- if and .Values.auth.enabled .Values.auth.secret }}
333+
- name: AUTH_TOKEN
334+
valueFrom:
335+
secretKeyRef:
336+
name: {{ .Values.auth.secret.name }}
337+
key: {{ .Values.auth.secret.key }}
338+
{{- end }}
333339
volumeMounts:
334340
- name: config-volume
335341
mountPath: /etc/nats-config

charts/nats/values.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,13 @@ auth:
531531
# name: operator-jwt
532532
# key: KO.jwt
533533

534-
# Token authentication
535-
# token:
534+
# Use key if you want to provide the token via Helm Values
535+
# token:
536+
537+
# Use a secret reference if you want to get a token from a secret
538+
# secret:
539+
# name: "nats-token"
540+
# key: "key"
536541

537542
# NKey authentication
538543
# nkeys:

0 commit comments

Comments
 (0)