Skip to content

Commit

Permalink
Merge pull request #242 from akash4sh/main
Browse files Browse the repository at this point in the history
Add secret reference for NATS token
  • Loading branch information
jebinjeb authored Sep 19, 2023
2 parents 61e2e19 + 432e901 commit d347ca3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion charts/nats/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ maintainers:
name: Jaime Piña
url: https://github.com/variadico
name: nats
version: 0.13.4
version: 0.13.5
14 changes: 7 additions & 7 deletions charts/nats/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,13 @@ data:
system_account: {{ . }}
{{- end }}
{{- with .Values.auth.token }}
authorization {
token: "{{ . }}"
{{- if .Values.auth.token }}
token: "{{ .Values.auth.token }}"
{{- else if .Values.auth.secret }}
token: $AUTH_TOKEN
{{- end }}
{{- if $.Values.auth.timeout }}
timeout: {{ $.Values.auth.timeout }}
{{- end }}
Expand Down Expand Up @@ -539,6 +541,4 @@ data:
accounts: {{- toRawJson . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
8 changes: 7 additions & 1 deletion charts/nats/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ spec:
fieldPath: metadata.namespace
- name: CLUSTER_ADVERTISE
value: {{ include "nats.clusterAdvertise" . }}

{{- if .Values.nats.jetstream.enabled }}
{{- with .Values.nats.jetstream.encryption }}
{{- with .secret }}
Expand All @@ -330,6 +329,13 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if and .Values.auth.enabled .Values.auth.secret }}
- name: AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.auth.secret.name }}
key: {{ .Values.auth.secret.key }}
{{- end }}
volumeMounts:
- name: config-volume
mountPath: /etc/nats-config
Expand Down
9 changes: 7 additions & 2 deletions charts/nats/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,13 @@ auth:
# name: operator-jwt
# key: KO.jwt

# Token authentication
# token:
# Use key if you want to provide the token via Helm Values
# token:

# Use a secret reference if you want to get a token from a secret
# secret:
# name: "nats-token"
# key: "key"

# NKey authentication
# nkeys:
Expand Down

0 comments on commit d347ca3

Please sign in to comment.