Skip to content

Commit 5675322

Browse files
rbaturovTal-or
andcommitted
kustomize: operator network policies
This commit introduces two network policies for the operator: 1. A default deny-all policy that blocks all ingress and egress traffic by default. This serves as a security baseline, ensuring that no unintended connections are allowed from or to the operator pod. 2. A policy allowing egress traffic from the scheduler pod to the API server. NOTE: OLM does not support generation of network-policy as part of CSV creation just yet. Those will be deployed along side the operator only when using kustomize. Signed-off-by: Ronny Baturov <[email protected]> Co-authored-by: Talor Itzhak <[email protected]>
1 parent 14aeb15 commit 5675322

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

config/default/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ resources:
1616
- ../crd
1717
- ../rbac
1818
- ../manager
19+
- ../networkpolicy
1920
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2021
# crd/kustomization.yaml
2122
#- ../webhook

config/networkpolicy/deny-all.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
name: operator-default-deny-all
5+
spec:
6+
podSelector:
7+
matchLabels:
8+
app: numaresources-operator
9+
policyTypes:
10+
- Ingress
11+
- Egress
12+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
name: operator-egress-to-api-server
5+
spec:
6+
podSelector:
7+
matchLabels:
8+
app: numaresources-operator
9+
egress:
10+
- ports:
11+
- protocol: TCP
12+
port: 6443
13+
policyTypes:
14+
- Egress
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
name: ingress-to-operator-metrics
5+
spec:
6+
podSelector:
7+
matchLabels:
8+
app: numaresources-operator
9+
ingress:
10+
- ports:
11+
- protocol: TCP
12+
port: 8080
13+
policyTypes:
14+
- Ingress
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resources:
2+
- deny-all.yaml
3+
- egress-to-api-server.yaml
4+
- ingress-to-metrics.yaml

0 commit comments

Comments
 (0)