| {{- if .Values.networkPolicy.enabled }} |
| kind: NetworkPolicy |
| apiVersion: {{ include "nacos.networkPolicy.apiVersion" . }} |
| metadata: |
| name: {{ include "nacos.fullname" . }} |
| namespace: {{ template "nacos.namespace" . }} |
| labels: {{- include "nacos.labels" . | nindent 4 }} |
| spec: |
| podSelector: |
| matchLabels: {{- include "nacos.matchLabels" . | nindent 6 }} |
| policyTypes: |
| - Ingress |
| ingress: |
| - ports: |
| - port: {{ .Values.nacos.service.port }} |
| {{- if not .Values.networkPolicy.allowExternal }} |
| from: |
| - podSelector: |
| matchLabels: |
| {{ include "zookeeper.fullname" . }}-client: "true" |
| - podSelector: |
| matchLabels: {{- include "zookeeper.matchLabels" . | nindent 14 }} |
| {{- end }} |
| - ports: |
| - port: {{ .Values.nacos.service.port }} |
| from: |
| - podSelector: |
| matchLabels: {{- include "zookeeper.matchLabels" . | nindent 14 }} |
| {{- end }} |