-
Notifications
You must be signed in to change notification settings - Fork 87
CNTRLPLANE-2845: add service-ca operator and workload network policies #324
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
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,37 @@ | ||
| # Allow policy for the service-ca controller pod in the openshift-service-ca namespace. | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: service-ca | ||
| namespace: openshift-service-ca | ||
| annotations: | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| spec: | ||
| podSelector: | ||
| matchLabels: | ||
| app: service-ca | ||
| ingress: | ||
| # Metrics scraping (TCP 8443) from any source | ||
| - ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| egress: | ||
| # DNS resolution via openshift-dns (TCP/UDP 5353) | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-dns | ||
| podSelector: | ||
| matchLabels: | ||
| dns.operator.openshift.io/daemonset-dns: default | ||
| ports: | ||
| - protocol: TCP | ||
| port: 5353 | ||
| - protocol: UDP | ||
| port: 5353 | ||
| # Kubernetes API server; no port restriction since it may run on non-standard ports | ||
| - {} | ||
|
Comment on lines
+33
to
+34
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. 🧩 Analysis chain🌐 Web query:
💡 Result: In a What
|
||
| policyTypes: | ||
| - Ingress | ||
| - Egress | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Deny all ingress and egress traffic for all pods in the namespace by default. | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: default-deny-all | ||
| namespace: openshift-service-ca | ||
| annotations: | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| spec: | ||
| podSelector: {} | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Allow policy for the service-ca-operator pod in the openshift-service-ca-operator namespace. | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: service-ca-operator | ||
| namespace: openshift-service-ca-operator | ||
| annotations: | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
|
Comment on lines
+7
to
+9
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. Missing The default-deny policy in this namespace ( 🔧 Proposed fix 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"🤖 Prompt for AI Agents |
||
| spec: | ||
| podSelector: | ||
| matchLabels: | ||
| app: service-ca-operator | ||
| ingress: | ||
| # Metrics scraping (TCP 8443) from any source | ||
| - ports: | ||
| - protocol: TCP | ||
| port: 8443 | ||
| egress: | ||
| # DNS resolution via openshift-dns (TCP/UDP 5353) | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-dns | ||
| podSelector: | ||
| matchLabels: | ||
| dns.operator.openshift.io/daemonset-dns: default | ||
| ports: | ||
| - protocol: TCP | ||
| port: 5353 | ||
| - protocol: UDP | ||
| port: 5353 | ||
| # Kubernetes API server; no port restriction since it may run on non-standard ports | ||
benluddy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - {} | ||
|
Comment on lines
+33
to
+34
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. 🧩 Analysis chain🏁 Script executed: cat -n manifests/08_networkpolicy.yaml | head -50Repository: openshift/service-ca-operator Length of output: 1693 🌐 Web query:
💡 Result: In the
By contrast:
Examples # Allow all egress
spec:
podSelector: {}
policyTypes: ["Egress"]
egress:
- {}# Deny all egress (egress isolation with zero allowed rules)
spec:
podSelector: {}
policyTypes: ["Egress"]
# egress: [] # (equivalent intent: no allowed egress rules)
# (or omit egress entirely)Sources: Kubernetes NetworkPolicy docs (allow-all / default-deny examples) [1], API semantics for [1] (v1-33.docs.kubernetes.io) Citations:
The empty egress rule on line 37 allows traffic to any destination on any port. This contradicts the intent stated in the line 36 comment. Either restrict the rule to the Kubernetes API server using an explicit 🤖 Prompt for AI Agents |
||
| policyTypes: | ||
| - Ingress | ||
| - Egress | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Deny all ingress and egress traffic for all pods in the namespace by default. | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: default-deny-all | ||
| namespace: openshift-service-ca-operator | ||
| annotations: | ||
| 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.
Missing
ibm-cloud-managedannotation creates inconsistency.The default-deny policy for this namespace (
0000_10_openshift_service-ca_02_networkpolicy_default-deny-all.yaml) includesinclude.release.openshift.io/ibm-cloud-managed: "true", but this allow policy does not. This would cause traffic to be blocked in IBM Cloud managed environments.🔧 Proposed fix
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"📝 Committable suggestion
🤖 Prompt for AI Agents