-
Notifications
You must be signed in to change notification settings - Fork 217
OCPCLOUD-2980: add ingress/egress network policy #1387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Allow egress from apps in openshift-machine-api to kube api | ||
# Allow egress from apps in openshift-machine-api to DNS | ||
# Allow egress from apps in openshift-machine-api to external cloud platforms | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-egress | ||
namespace: openshift-machine-api | ||
annotations: | ||
capability.openshift.io/name: MachineAPI | ||
exclude.release.openshift.io/internal-openshift-hosted: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
spec: | ||
egress: | ||
- ports: | ||
- protocol: TCP | ||
port: 1 | ||
endPort: 65535 | ||
- ports: | ||
- protocol: UDP | ||
port: 5353 | ||
podSelector: | ||
matchExpressions: | ||
- key: k8s-app | ||
operator: In | ||
values: | ||
- cluster-autoscaler | ||
- cluster-autoscaler-operator | ||
- cluster-baremetal-operator | ||
- control-plane-machine-set-operator | ||
- controller | ||
- machine-api-operator | ||
policyTypes: | ||
- Egress |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Allow ingress to the openshift-machine-api namespace pods for internal cluster request | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-ingress-cluster | ||
namespace: openshift-machine-api | ||
annotations: | ||
capability.openshift.io/name: MachineAPI | ||
exclude.release.openshift.io/internal-openshift-hosted: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
spec: | ||
ingress: | ||
- ports: | ||
- protocol: TCP | ||
port: 9440 | ||
endPort: 9442 | ||
- protocol: TCP | ||
port: 8443 | ||
podSelector: | ||
matchExpressions: | ||
- key: k8s-app | ||
operator: In | ||
values: | ||
- cluster-autoscaler | ||
- cluster-autoscaler-operator | ||
- cluster-baremetal-operator | ||
- control-plane-machine-set-operator | ||
- controller | ||
- machine-api-operator | ||
policyTypes: | ||
- Ingress |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Allow ingress to the openshift-machine-api namespace pods for kubeapi requests | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-ingress-kubeapi | ||
namespace: openshift-machine-api | ||
annotations: | ||
capability.openshift.io/name: MachineAPI | ||
exclude.release.openshift.io/internal-openshift-hosted: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
spec: | ||
ingress: | ||
- ports: | ||
- protocol: TCP | ||
port: 8443 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is present in multiple policies, what's it for? |
||
- protocol: TCP | ||
port: 9443 | ||
podSelector: | ||
matchExpressions: | ||
- key: k8s-app | ||
operator: In | ||
values: | ||
- cluster-autoscaler | ||
- cluster-autoscaler-operator | ||
- cluster-baremetal-operator | ||
- control-plane-machine-set-operator | ||
- controller | ||
- machine-api-operator | ||
policyTypes: | ||
- Ingress |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Allow ingress to the openshift-machine-api namespace pods for metrics request | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-ingress-metrics | ||
namespace: openshift-machine-api | ||
annotations: | ||
capability.openshift.io/name: MachineAPI | ||
exclude.release.openshift.io/internal-openshift-hosted: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
spec: | ||
ingress: | ||
- ports: | ||
- protocol: TCP | ||
port: 8085 | ||
- protocol: TCP | ||
port: 8440 | ||
endPort: 8444 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also includes 8443, third time now, I assume it's not an issue including a port multiple times, just curious why it's showing up so much |
||
- protocol: TCP | ||
port: 9191 | ||
endPort: 9192 | ||
podSelector: | ||
matchExpressions: | ||
- key: k8s-app | ||
operator: In | ||
values: | ||
- cluster-autoscaler | ||
- cluster-autoscaler-operator | ||
- cluster-baremetal-operator | ||
- control-plane-machine-set-operator | ||
- controller | ||
- machine-api-operator | ||
policyTypes: | ||
- Ingress |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Default deny all ingress and egress | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks different to @miyadav's one for CAPI, can we co-ordinate what is and isn't needed between the two PRs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I double checked @miyadav's pr openshift/cluster-capi-operator#325, this file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, you're right, they are the same apart from naming and comments. Can we call these both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes sure , thanks |
||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: default-deny | ||
namespace: openshift-machine-api | ||
annotations: | ||
capability.openshift.io/name: MachineAPI | ||
exclude.release.openshift.io/internal-openshift-hosted: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
spec: | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
- Egress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to just allow all traffic to egress? What does the recommendations document suggest?