-
Notifications
You must be signed in to change notification settings - Fork 380
OCPBUGS-61088: create networkpolicy settings for in-cluster monitoring #2656
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
Open
juzhao
wants to merge
83
commits into
openshift:main
Choose a base branch
from
juzhao:networkpolicy_in-cluster
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
de2f821
add networkpolicy settings for in-cluster monitoring
juzhao 91b04be
update thanos-querier.libsonnet for networkpolicy
juzhao d39c22f
update admission-webhook.libsonnet
juzhao d029248
fix typo in admission-webhook.libsonnet prometheus-operator.libsonnet
juzhao 506f269
update monitoring-plugin.libsonnet and gofmt manifests.go
juzhao 10baeed
update format
juzhao d881999
update alertmanager.libsonnet
juzhao 0da4120
update manifests.go to add ThanosQuerierNetworkPolicy func
juzhao 02c48aa
remove networkpolicy.yaml file under each component
juzhao 7f5102e
add networkpolicy files back
juzhao d34d3d5
update main.jsonnet to remove removeNetworkPolicy
juzhao aa26831
fix error
juzhao 5ca639d
fix errors
juzhao 0222586
remove resources.adoc resources.md
juzhao 13f0e13
add back resources.adoc resources.md main.jsonnet
juzhao cfe85fd
revert change in resources.adoc resources.md
juzhao 7cde663
update networkpolicy files
juzhao 57c710c
add renameNetworkPolicy to rename networkPolicy to networkPolicyDowns…
juzhao a6f8845
update libsonnet
juzhao f07312b
OCPBUGS-58475: Enforce secure TLS settings in CMO server
danielmellado 514ba77
OCPBUGS-34568,OCPBUGS-35095: non-HA alert cases
rexagod ec6e88e
bugfix: opt-out of multi-cluster control plane rules
rexagod 54f2baf
chore: `make generate`
rexagod 153245c
chore: `make jsonnet-fmt`
rexagod f90f401
chore: Indicate added alerts in CHANGELOG
rexagod dae3f9a
OCPBUGS-56158: Bump prometheus-operator to v0.85.0
slashpai 0c3c073
add networkpolicy settings for in-cluster monitoring
juzhao b15d04c
update thanos-querier.libsonnet for networkpolicy
juzhao 1a3e9e7
update admission-webhook.libsonnet
juzhao 1a6d431
fix typo in admission-webhook.libsonnet prometheus-operator.libsonnet
juzhao 8d80d31
update monitoring-plugin.libsonnet and gofmt manifests.go
juzhao 4b8855e
update format
juzhao bbccdbe
update alertmanager.libsonnet
juzhao d865f4c
update manifests.go to add ThanosQuerierNetworkPolicy func
juzhao 13d2f86
remove networkpolicy.yaml file under each component
juzhao 8cd29d0
add networkpolicy files back
juzhao 353b2bd
update main.jsonnet to remove removeNetworkPolicy
juzhao 306701e
fix error
juzhao b0c3a9c
fix errors
juzhao e2f71ca
remove resources.adoc resources.md
juzhao 5da0328
add back resources.adoc resources.md main.jsonnet
juzhao bdc8872
revert change in resources.adoc resources.md
juzhao a0e618f
update networkpolicy files
juzhao bfb85d0
add renameNetworkPolicy to rename networkPolicy to networkPolicyDowns…
juzhao acf789a
Revert "add renameNetworkPolicy to rename networkPolicy to networkPol…
juzhao 9721b3f
revert change
juzhao afffb62
revert change
juzhao 04ff8a3
fix typo
juzhao 082ccd1
remove remame-network-policy.libsonnet, file name is wrong
juzhao ab2f2c2
fix code error
juzhao 437118e
rename networkpolicy file name
juzhao ec7737e
add labels for networkpolicy files to let generate job pass
juzhao eceb453
add default deny networkpolicy to cluster-monitoring-operator.libsonnet
juzhao 2250fb9
change libsonnet format
juzhao 1c41a83
split networkpolicy
juzhao f85cb8c
rename default deny networkpolicy file name
juzhao a8a8484
update networkpolicy yaml file format
juzhao 8a285a2
rename networkpolicy file name to component name
juzhao 9f897bd
add code to deploy networkpolicy files for in-cluster monitoring
juzhao 1dfafc4
fix type check error to use NetworkingV1 func
juzhao bb3c93d
fix error
juzhao bc02f97
fix error
juzhao f3bc4b3
Merge remote-tracking branch 'upstream/main' into networkpolicy_in-cl…
juzhao 39c0741
fix error
juzhao 4ee6ccb
grant sa cluster-monitoring-operator get networkpolicies permission
juzhao 28d5b12
update 0000_50_cluster-monitoring-operator_02-role.yaml
juzhao 96a1213
update 0000_50_cluster-monitoring-operator_02-role.yaml
juzhao 6e850ef
update component clsuter-role yaml to grant access to networkpolicy
juzhao 0b624dd
update component libsonnet to add networkpolicy permission
juzhao a8022c0
update CMO 02-namespaced-cluster-role.yaml and 02-role.yaml
juzhao 39e419a
update permission
juzhao 8dae2d3
remove unnecessary component networkpolicy permission
juzhao 63867a8
change deploy networkpolicy task to beginning of each task
juzhao 1fa06d0
update prometheus 10901 port from UDP to TCP
juzhao 010c7e9
update code and add e2e tests for alertmanager
juzhao 910c61b
fix error
juzhao facd3a4
add e2e cases and update libsonnet and yaml files to reference port n…
juzhao a473694
remove annotations from libsonnet and yaml files
juzhao 8c65a39
remove comments
juzhao 2ec8ce5
fix error
juzhao a6ee40b
remvove egress for admission-webhook
juzhao 4b8c7ec
update PR based on comments
juzhao 7cb2edd
remove no needed NetworkPolicy check for node-exporter
juzhao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: prometheus-operator-admission-webhook-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: prometheus-operator-admission-webhook # Label must match your prometheus-operator-admission-webhook pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
# Allow access to port 8443 | ||
- ports: | ||
- port: 8443 | ||
protocol: TCP | ||
egress: | ||
# Allow curl 8443 and return result from any pod under any namespace | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: alertmanager-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: alertmanager # Label must match your alertmanager pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
# Allow access to ports 9092(tenancy)/9094(service)/9095(web)/9097(metrics) from all pods in all namespaces for ingress and egress | ||
ingress: | ||
- ports: | ||
- port: 9092 | ||
protocol: TCP | ||
- port: 9094 | ||
protocol: TCP | ||
- port: 9094 | ||
protocol: UDP | ||
- port: 9095 | ||
protocol: TCP | ||
- port: 9097 | ||
protocol: TCP | ||
egress: | ||
- {} |
25 changes: 25 additions & 0 deletions
25
assets/cluster-monitoring-operator/cluster-monitoring-operator-networkpolicy.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: cluster-monitoring-operator-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: cluster-monitoring-operator | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
# Allow access to port 8443 | ||
- ports: | ||
- port: 8443 | ||
protocol: TCP | ||
egress: | ||
# Allow curl 8443 and return result from any pod under any namespace | ||
- {} |
15 changes: 15 additions & 0 deletions
15
assets/cluster-monitoring-operator/default-deny-networkpolicy.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: default-deny | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
- Egress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: kube-state-metrics-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: kube-state-metrics # Label must match your kube-state-metrics pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
# Allow access to ports 8443(https-main)/9443(https-self) | ||
ingress: | ||
- ports: | ||
- port: 8443 | ||
protocol: TCP | ||
- port: 9443 | ||
protocol: TCP | ||
egress: | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: metrics-server-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: metrics-server # Label must match your metrics-server pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
# Allow access to ports 10250 | ||
ingress: | ||
- ports: | ||
- port: 10250 | ||
protocol: TCP | ||
egress: | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: monitoring-plugin-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: monitoring-plugin # Label must match your monitoring-plugin pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
# Allow access to port 9443 | ||
- ports: | ||
- port: 9443 | ||
protocol: TCP | ||
egress: | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: openshift-state-metrics-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: openshift-state-metrics # Label must match your openshift-state-metrics pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
# Allow access to ports 8443(https-main)/9443(https-self) | ||
ingress: | ||
- ports: | ||
- port: 8443 | ||
protocol: TCP | ||
- port: 9443 | ||
protocol: TCP | ||
egress: | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: prometheus-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: prometheus # Label must match your Prometheus pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
# Allow access to ports 9091(svc port)/9092(metrics port) | ||
- ports: | ||
- port: 9091 | ||
protocol: TCP | ||
- port: 9092 | ||
protocol: TCP | ||
# grpc port 10901 | ||
- port: 10901 | ||
protocol: TCP | ||
# thanos-proxy port 10903 for prometheus thanos-sidecar target | ||
- port: 10903 | ||
protocol: TCP | ||
# allow to access targert port to check target health and scrape from target | ||
egress: | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: prometheus-operator-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: prometheus-operator # Label must match your prometheus-operator pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
# Allow access to port 8443 | ||
- ports: | ||
- port: 8443 | ||
protocol: TCP | ||
egress: | ||
# Allow curl 8443 and return result from any pod under any namespace | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: telemeter-client-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: telemeter-client # Label must match your telemeter-client pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
# Allow access to port 8443 | ||
- ports: | ||
- port: 8443 | ||
protocol: TCP | ||
egress: | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/hypershift: "true" | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
include.release.openshift.io/single-node-developer: "true" | ||
name: thanos-querier-access | ||
namespace: openshift-monitoring | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: thanos-query # Label must match your thanos-query pod | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
# Allow access to ports 9091(svc)/9092(tenancy)/9093(tenancy-rules)/9094(metrics) from all pods in all namespaces for ingress and egress | ||
ingress: | ||
- ports: | ||
- port: 9091 | ||
endPort: 9094 | ||
protocol: TCP | ||
egress: | ||
- {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.