Skip to content

Commit

Permalink
Enable Istio mTLS for NATS Cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
muralov committed Sep 26, 2024
1 parent a593afe commit c74ac62
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/nats/templates/destination-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ spec:
host: {{ include "nats.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
trafficPolicy:
tls:
mode: DISABLE
mode: ISTIO_MUTUAL
{{- end }}
19 changes: 19 additions & 0 deletions resources/nats/templates/peer-authentication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.istio.enabled }}
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
name: {{ include "nats.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "nats.labels" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations:
{{- toYaml .Values.commonAnnotations | nindent 4 }}
{{- end }}
spec:
mtls:
mode: STRICT
selector:
matchLabels:
{{- include "nats.selectorLabels" . | nindent 6 }}
{{- end }}
2 changes: 1 addition & 1 deletion resources/nats/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ affinity:
# Annotations to add to the NATS pods
# ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
podAnnotations: {
sidecar.istio.io/inject: "false"
sidecar.istio.io/inject: "true"
}

# Annotations to add to the NATS StatefulSet
Expand Down

0 comments on commit c74ac62

Please sign in to comment.