| Giorgi Lekveishvili | 8c99d62 | 2023-05-30 14:40:50 +0400 | [diff] [blame] | 1 | {{- if and .Values.networkPolicy.enabled (or .Values.networkPolicy.egressRules.denyConnectionsToExternal .Values.networkPolicy.egressRules.customRules) }} |
| 2 | apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} |
| 3 | kind: NetworkPolicy |
| 4 | metadata: |
| 5 | name: {{ printf "%s-egress" (include "common.names.fullname" .) }} |
| 6 | namespace: {{ .Release.Namespace }} |
| 7 | labels: {{- include "common.labels.standard" . | nindent 4 }} |
| 8 | {{- if .Values.commonLabels }} |
| 9 | {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} |
| 10 | {{- end }} |
| 11 | {{- if .Values.commonAnnotations }} |
| 12 | annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 13 | {{- end }} |
| 14 | spec: |
| 15 | podSelector: |
| 16 | matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} |
| 17 | policyTypes: |
| 18 | - Egress |
| 19 | egress: |
| 20 | {{- if .Values.networkPolicy.egressRules.denyConnectionsToExternal }} |
| 21 | - ports: |
| 22 | - port: 53 |
| 23 | protocol: UDP |
| 24 | - port: 53 |
| 25 | protocol: TCP |
| 26 | - to: |
| 27 | - namespaceSelector: {} |
| 28 | {{- end }} |
| 29 | {{- if .Values.networkPolicy.egressRules.customRules }} |
| 30 | {{- include "common.tplvalues.render" (dict "value" .Values.networkPolicy.egressRules.customRules "context" $) | nindent 4 }} |
| 31 | {{- end }} |
| 32 | {{- end }} |