Skip to content

Commit f3ba282

Browse files
Add optional Credentials to nats-kafka (#845)
* Add optional userCredentials to nats-kafka * Add nats-kafka credentials key and name * Update nats-kafka readme to include nats credential usecase * Update helm/charts/nats-kafka/templates/configmap.yaml Co-authored-by: Caleb Lloyd <2414837+caleblloyd@users.noreply.github.com> * Update helm/charts/nats-kafka/templates/deployment.yaml Co-authored-by: Caleb Lloyd <2414837+caleblloyd@users.noreply.github.com> * Update helm/charts/nats-kafka/templates/deployment.yaml Co-authored-by: Caleb Lloyd <2414837+caleblloyd@users.noreply.github.com> * bump patch version * Add nats kafka values credentials clarity --------- Co-authored-by: Caleb Lloyd <2414837+caleblloyd@users.noreply.github.com>
1 parent 0760c47 commit f3ba282

File tree

5 files changed

+50
-1
lines changed

5 files changed

+50
-1
lines changed

helm/charts/nats-kafka/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
2-
version: 0.15.2
2+
version: 0.15.3
33
appVersion: 1.4.2
44
type: application
55
name: nats-kafka

helm/charts/nats-kafka/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,31 @@ natskafka:
9696
topic: bar
9797
subject: baz
9898
```
99+
100+
**Using Nats Credentials**
101+
102+
If you need a nats credential for authentication:
103+
104+
```yaml
105+
natskafka:
106+
nats:
107+
servers:
108+
- "nats://1.2.3.4:4222"
109+
credentials:
110+
secret:
111+
name: nats-sys-creds
112+
key: sys.creds
113+
connect:
114+
- type: "NATSToKafka"
115+
brokers:
116+
- "1.2.3.4:9092"
117+
id: whizz
118+
topic: bar
119+
subject: bang
120+
- type: "KafkaToNATS"
121+
brokers:
122+
- "1.2.3.4:9092"
123+
id: foo
124+
topic: bar
125+
subject: baz
126+
```

helm/charts/nats-kafka/templates/configmap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ data:
2727
ConnectTimeout: {{ .Values.natskafka.nats.connectTimeout }},
2828
MaxReconnects: {{ .Values.natskafka.nats.maxReconnects }},
2929
ReconnectWait: {{ .Values.natskafka.nats.reconnectWait }},
30+
{{- with .Values.natskafka.nats.credentials }}
31+
UserCredentials: /etc/nats-kafka/creds/{{ .secret.key }},
32+
{{- end }}
3033
}
3134
3235
{{ if or .Values.natskafka.monitoring.httpPort .Values.natskafka.monitoring.httpsPort }}

helm/charts/nats-kafka/templates/deployment.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ spec:
3636
mountPath: /etc/nats-kafka/tls
3737
readOnly: true
3838
{{ end }}
39+
{{- if .Values.natskafka.nats.credentials }}
40+
- name: creds-volume
41+
mountPath: /etc/nats-kafka/creds
42+
readOnly: true
43+
{{- end }}
3944
{{- if .Values.natskafka.additionalVolumeMounts }}
4045
{{- toYaml .Values.natskafka.additionalVolumeMounts | nindent 12 }}
4146
{{- end }}
@@ -83,6 +88,11 @@ spec:
8388
secret:
8489
secretName: {{ .Values.natskafka.monitoring.tls.secret }}
8590
{{ end }}
91+
{{- with .Values.natskafka.nats.credentials }}
92+
- name: creds-volume
93+
secret:
94+
secretName: {{ .secret.name }}
95+
{{- end }}
8696
{{- if .Values.natskafka.additionalVolumes }}
8797
{{- toYaml .Values.natskafka.additionalVolumes | nindent 8 }}
8898
{{- end }}

helm/charts/nats-kafka/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,12 @@ natskafka:
6464
connectTimeout: 5000
6565
maxReconnects: 120
6666
reconnectWait: 5000
67+
68+
# The credentials file to load in to connect to the NATS Server.
69+
#
70+
# credentials:
71+
# secret:
72+
# name: nats-sys-creds
73+
# key: sys.creds
74+
6775
connect: []

0 commit comments

Comments
 (0)