@@ -22,34 +22,37 @@ spec:
2222 {{- if eq .Values.service.type "LoadBalancer" }}
2323 - {}
2424 {{- else }}
25- # Allow client connections
2625 - ports :
26+ # Allow client connections
2727 - port : {{ .Values.listeners.client.containerPort }}
28+ # Allow communication controller
29+ - port : {{ .Values.listeners.controller.containerPort }}
30+ # Allow communication inter-broker
31+ - port : {{ .Values.listeners.interbroker.containerPort }}
32+ # Allow communication external
33+ - port : {{ .Values.listeners.external.containerPort }}
2834 {{- if not .Values.networkPolicy.allowExternal }}
2935 from :
30- - podSelector :
36+ {{- if or .Values.networkPolicy.allowCurrentNamespace .Values.networkPolicy.allowNamespaces }}
37+ {{- if .Values.networkPolicy.allowCurrentNamespace }}
38+ - namespaceSelector :
3139 matchLabels :
32- {{ template "common.names.fullname" . }}-client: "true"
33- {{- if .Values.networkPolicy.explicitNamespacesSelector }}
34- namespaceSelector : {{- toYaml .Values.networkPolicy.explicitNamespacesSelector | nindent 12 }}
35- {{- end }}
40+ kubernetes.io/metadata.name : {{ .Release.Namespace }}
41+ {{- end }}
42+ {{- range $namespace := .Values.networkPolicy.allowNamespaces }}
43+ {{- if $namespace }}
44+ - namespaceSelector :
45+ matchLabels :
46+ kubernetes.io/metadata.name : {{ $namespace }}
47+ {{- end }}
48+ {{- end }}
49+ {{- end }}
3650 {{- end }}
37- # Allow communication controller
38- - ports :
39- - port : {{ .Values.listeners.controller.containerPort }}
40- from :
41- - podSelector :
42- matchLabels : {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
43- # Allow communication inter-broker
44- - ports :
45- - port : {{ .Values.listeners.interbroker.containerPort }}
46- from :
47- - podSelector :
48- matchLabels : {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
4951 # Allow External connection
5052 {{- if .Values.externalAccess.enabled }}
5153 - ports :
5254 - port : {{ .Values.listeners.external.containerPort }}
55+ - port : {{ .Values.externalAccess.controller.service.ports.external }}
5356 {{- if .Values.networkPolicy.externalAccess.from }}
5457 from : {{- include "common.tplvalues.render" ( dict "value" .Values.networkPolicy.externalAccess.from "context" $ ) | nindent 8 }}
5558 {{- end }}
0 commit comments