Skip to content

Commit d43b009

Browse files
committed
specify namespace with selectors
1 parent 61b47ec commit d43b009

File tree

1 file changed

+36
-27
lines changed

1 file changed

+36
-27
lines changed

deploy/chart/templates/0000_50_olm_01-networkpolicies.yaml

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ spec:
2222
- ports:
2323
- protocol: TCP
2424
port: 8080
25-
egress:
26-
- ports:
27-
- protocol: TCP
28-
port: 6443 # kube-api service
29-
- protocol: TCP
30-
port: 53 # DNS
31-
- protocol: UDP
32-
port: 53 # DNS
25+
# egress:
26+
# - ports:
27+
# - protocol: TCP
28+
# port: 6443 # kube-api service
29+
# - protocol: TCP
30+
# port: 53 # DNS
31+
# - protocol: UDP
32+
# port: 53 # DNS
3333
policyTypes:
3434
- Ingress
35-
- Egress
35+
# - Egress
3636
---
3737
apiVersion: networking.k8s.io/v1
3838
kind: NetworkPolicy
@@ -47,19 +47,19 @@ spec:
4747
- ports:
4848
- protocol: TCP
4949
port: metrics
50-
egress:
51-
- ports:
52-
- protocol: TCP
53-
port: 6443 # kube-api server
54-
- protocol: TCP
55-
port: 50051 # catalog service
56-
- protocol: TCP
57-
port: 53 # DNS
58-
- protocol: UDP
59-
port: 53 # DNS
50+
# egress:
51+
# - ports:
52+
# - protocol: TCP
53+
# port: 6443 # kube-api server
54+
# - protocol: TCP
55+
# port: 50051 # registry pods' service port
56+
# - protocol: TCP
57+
# port: 53 # DNS
58+
# - protocol: UDP
59+
# port: 53 # DNS
6060
policyTypes:
6161
- Ingress
62-
- Egress
62+
# - Egress
6363
---
6464
apiVersion: networking.k8s.io/v1
6565
kind: NetworkPolicy
@@ -75,13 +75,22 @@ spec:
7575
- protocol: TCP
7676
port: {{ .Values.package.service.internalPort }}
7777
egress:
78-
- ports:
79-
- protocol: TCP
80-
port: 50051 # catalog service
81-
- protocol: TCP
82-
port: 53 # DNS
83-
- protocol: UDP
84-
port: 53 # DNS
78+
- to:
79+
- namespaceSelector:
80+
matchLabels:
81+
kubernetes.io/metadata.name: {{ .Values.catalog_namespace }} # For registry resolution
82+
ports:
83+
- protocol: TCP
84+
port: 50051 # registry pods' service port
85+
- to:
86+
- namespaceSelector:
87+
matchLabels:
88+
kubernetes.io/metadata.name: kube-system # For DNS resolution (CoreDNS runs here)
89+
ports:
90+
- protocol: UDP
91+
port: 53 # DNS
92+
- protocol: TCP
93+
port: 53 # DNS
8594
policyTypes:
8695
- Ingress
8796
- Egress

0 commit comments

Comments
 (0)