Skip to content

Commit 5691ed1

Browse files
committed
add ingress/egress network policy
1 parent c2d9e7f commit 5691ed1

5 files changed

+143
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Allow egress from apps in openshift-machine-api to kube api
2+
# Allow egress from apps in openshift-machine-api to DNS
3+
# Allow egress from apps in openshift-machine-api to external cloud platforms
4+
apiVersion: networking.k8s.io/v1
5+
kind: NetworkPolicy
6+
metadata:
7+
name: allow-egress
8+
namespace: openshift-machine-api
9+
annotations:
10+
capability.openshift.io/name: MachineAPI
11+
exclude.release.openshift.io/internal-openshift-hosted: "true"
12+
include.release.openshift.io/self-managed-high-availability: "true"
13+
include.release.openshift.io/single-node-developer: "true"
14+
spec:
15+
egress:
16+
- ports:
17+
- protocol: TCP
18+
port: 1
19+
endPort: 65535
20+
- ports:
21+
- protocol: UDP
22+
port: 5353
23+
podSelector:
24+
matchExpressions:
25+
- key: k8s-app
26+
operator: In
27+
values:
28+
- cluster-autoscaler-operator
29+
- cluster-baremetal-operator
30+
- control-plane-machine-set-operator
31+
- controller
32+
- machine-api-operator
33+
policyTypes:
34+
- Egress
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Allow ingress to the openshift-machine-api namespace pods for internal cluster request
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: allow-ingress-cluster
6+
namespace: openshift-machine-api
7+
annotations:
8+
capability.openshift.io/name: MachineAPI
9+
exclude.release.openshift.io/internal-openshift-hosted: "true"
10+
include.release.openshift.io/self-managed-high-availability: "true"
11+
include.release.openshift.io/single-node-developer: "true"
12+
spec:
13+
ingress:
14+
- ports:
15+
- protocol: TCP
16+
port: 9440
17+
endPort: 9442
18+
- protocol: TCP
19+
port: 8443
20+
podSelector:
21+
matchExpressions:
22+
- key: k8s-app
23+
operator: In
24+
values:
25+
- cluster-autoscaler-operator
26+
- cluster-baremetal-operator
27+
- control-plane-machine-set-operator
28+
- controller
29+
- machine-api-operator
30+
policyTypes:
31+
- Ingress
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Allow ingress to the openshift-machine-api namespace pods for kubeapi requests
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: allow-ingress-kubeapi
6+
namespace: openshift-machine-api
7+
annotations:
8+
capability.openshift.io/name: MachineAPI
9+
exclude.release.openshift.io/internal-openshift-hosted: "true"
10+
include.release.openshift.io/self-managed-high-availability: "true"
11+
include.release.openshift.io/single-node-developer: "true"
12+
spec:
13+
ingress:
14+
- ports:
15+
- protocol: TCP
16+
port: 8443
17+
- protocol: TCP
18+
port: 9443
19+
podSelector:
20+
matchExpressions:
21+
- key: k8s-app
22+
operator: In
23+
values:
24+
- cluster-autoscaler-operator
25+
- cluster-baremetal-operator
26+
- control-plane-machine-set-operator
27+
- controller
28+
- machine-api-operator
29+
policyTypes:
30+
- Ingress
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Allow ingress to the openshift-machine-api namespace pods for metrics request
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: allow-ingress-metrics
6+
namespace: openshift-machine-api
7+
annotations:
8+
capability.openshift.io/name: MachineAPI
9+
exclude.release.openshift.io/internal-openshift-hosted: "true"
10+
include.release.openshift.io/self-managed-high-availability: "true"
11+
include.release.openshift.io/single-node-developer: "true"
12+
spec:
13+
ingress:
14+
- ports:
15+
- protocol: TCP
16+
port: 8440
17+
endPort: 8444
18+
- protocol: TCP
19+
port: 9191
20+
endPort: 9192
21+
podSelector:
22+
matchExpressions:
23+
- key: k8s-app
24+
operator: In
25+
values:
26+
- cluster-autoscaler-operator
27+
- cluster-baremetal-operator
28+
- control-plane-machine-set-operator
29+
- controller
30+
- machine-api-operator
31+
policyTypes:
32+
- Ingress
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Default deny all ingress and egress
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: default-deny
6+
namespace: openshift-machine-api
7+
annotations:
8+
capability.openshift.io/name: MachineAPI
9+
exclude.release.openshift.io/internal-openshift-hosted: "true"
10+
include.release.openshift.io/self-managed-high-availability: "true"
11+
include.release.openshift.io/single-node-developer: "true"
12+
spec:
13+
podSelector: {}
14+
policyTypes:
15+
- Ingress
16+
- Egress

0 commit comments

Comments
 (0)