blob: 6f37065980196d01599449c96ab029532f44f4c5 [file] [log] [blame]
Giorgi Lekveishvili193b7c02025-05-22 16:21:37 +04001{{- if and .Values.networkPolicies.enabled .Values.ingress.enabled (not (eq .Values.networkPolicies.type "")) }}
2apiVersion: networking.k8s.io/v1
3kind: NetworkPolicy
4metadata:
5 name: longhorn-ui-frontend
6 namespace: {{ include "release_namespace" . }}
7spec:
8 podSelector:
9 matchLabels:
10 app: longhorn-ui
11 policyTypes:
12 - Ingress
13 ingress:
14 - from:
15 {{- if eq .Values.networkPolicies.type "rke1"}}
16 - namespaceSelector:
17 matchLabels:
18 kubernetes.io/metadata.name: ingress-nginx
19 podSelector:
20 matchLabels:
21 app.kubernetes.io/component: controller
22 app.kubernetes.io/instance: ingress-nginx
23 app.kubernetes.io/name: ingress-nginx
24 {{- else if eq .Values.networkPolicies.type "rke2" }}
25 - namespaceSelector:
26 matchLabels:
27 kubernetes.io/metadata.name: kube-system
28 podSelector:
29 matchLabels:
30 app.kubernetes.io/component: controller
31 app.kubernetes.io/instance: rke2-ingress-nginx
32 app.kubernetes.io/name: rke2-ingress-nginx
33 {{- else if eq .Values.networkPolicies.type "k3s" }}
34 - namespaceSelector:
35 matchLabels:
36 kubernetes.io/metadata.name: kube-system
37 podSelector:
38 matchLabels:
39 app.kubernetes.io/name: traefik
40 ports:
41 - port: 8000
42 protocol: TCP
43 - port: 80
44 protocol: TCP
45 {{- end }}
46{{- end }}