blob: e8621474b24df32ecb8f7364243947ef87090d86 [file] [log] [blame]
Giorgi Lekveishvili8c99d622023-05-30 14:40:50 +04001{{- if and .Values.networkPolicy.enabled (or .Values.networkPolicy.egressRules.denyConnectionsToExternal .Values.networkPolicy.egressRules.customRules) }}
2apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
3kind: NetworkPolicy
4metadata:
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 }}
14spec:
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 }}