-
Notifications
You must be signed in to change notification settings - Fork 264
OCPBUGS-35387: rbac: Add network resources to cluster-reader role #2826
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: master
Are you sure you want to change the base?
OCPBUGS-35387: rbac: Add network resources to cluster-reader role #2826
Conversation
|
Skipping CI for Draft Pull Request. |
Add read permissions (i.e. get, list, watch) for network-related resources to the cluster-reader ClusterRole aggregation. The resources are: - egressrouters.network.operator.openshift.io - network-attachment-definitions.k8s.cni.cncf.io - networks.operator.openshift.io Fixes: OCPBUGS-35387
e8f6663 to
93ab506
Compare
|
/retest |
|
@mattedallo: This pull request references Jira Issue OCPBUGS-35387, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@mattedallo: This pull request references Jira Issue OCPBUGS-35387, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retest-required |
|
@mattedallo did you check if the cluster-reader role gets the permissions in an OCP cluster with the patch? |
|
Hi @pliurh , Yes I tested it. $ oc get clusterversion
NAME VERSION AVAILABLE PROGRESSING SINCE STATUS
version 4.19.0-0.nightly-2025-10-22-141259 True False 4m58s Cluster version is 4.19.0-0.nightly-2025-10-22-141259
$ oc new-project test-project
Now using project "test-project" on server "https://api.ci-ln-9wmpp2t-76ef8.origin-ci-int-aws.dev.rhcloud.com:6443".
$ oc create sa test-user -n test-project
serviceaccount/test-user created
$ oc auth can-i list network-attachment-definitions.k8s.cni.cncf.io --as=system:serviceaccount:test-project:test-user
no
$ oc auth can-i list egressrouters.network.operator.openshift.io --as=system:serviceaccount:test-project:test-user
no
$ oc auth can-i list networks.operator.openshift.io --as=system:serviceaccount:test-project:test-user
Warning: resource 'networks' is not namespace scoped in group 'operator.openshift.io'
no
$ oc adm policy add-cluster-role-to-user cluster-reader -z test-user -n test-project
clusterrole.rbac.authorization.k8s.io/cluster-reader added: "test-user"
$ oc auth can-i list network-attachment-definitions.k8s.cni.cncf.io --as=system:serviceaccount:test-project:test-user
yes
$ oc auth can-i list egressrouters.network.operator.openshift.io --as=system:serviceaccount:test-project:test-user
yes
$ oc auth can-i list networks.operator.openshift.io --as=system:serviceaccount:test-project:test-user
Warning: resource 'networks' is not namespace scoped in group 'operator.openshift.io'
yes
|
|
/retest |
|
/lgtm /cc @kyrtapz |
WalkthroughTwo new read-only RBAC rules were appended to the OVN-Kubernetes cluster-reader ClusterRole: one for Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (2)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Comment |
|
@kyrtapz when you have time please take a look. Thanks |
| - get | ||
| - list | ||
| - watch | ||
| - apiGroups: ["operator.openshift.io"] |
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.
While I am ok with the other two I am not really sure what is the general approach for operator.openshift.io CRDs across OCP.
From what I've seen there are no other operator CRDs added to the cluster-reader.
@pliurh @mattedallo were you able to find that out?
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.
@kyrtapz Thank you for raising this concern. I've checked the RBAC patterns across OpenShift operators, and I indeed it seems no operator.openshift.io resources are currently exposed to cluster-reader across the entire platform. Our proposed change would be the first exception to this pattern.
Investigation Findings / My understanding
Listing my findings/understanding below, most of them might be trivial for a seasoned Red Hat engineer but helps me validate if my understanding is correct.
Pattern Confirmed Across All Operators
I verified that zero out of 21 operator.openshift.io/v1 resources have aggregate-to-cluster-reader or aggregate-to-view labels.
For comparison, here are operators that do have cluster-reader access, but for different API groups (NOT operator.openshift.io):
- machine-config-operator: Exposes
machineconfiguration.openshift.ioandconfig.openshift.io(source) - cluster-samples-operator: Exposes
samples.operator.openshift.io(different API group) (source) - cluster-config-operator: Exposes only
config.openshift.io(source) - machine-api-operator: Exposes
machine.openshift.io(source)
The Current Architectural Pattern
The consistent pattern across OpenShift is:
- ✅ config.openshift.io → Exposed to cluster-reader (user-facing, high-level configuration)
- ✅ Custom operator API groups (e.g.,
samples.operator.openshift.io,machineconfiguration.openshift.io) → Exposed when appropriate - ❌ operator.openshift.io → NOT exposed to cluster-reader (implementation details, cluster-admin only)
Security Considerations
On the security side, looking at the operator.openshift.io/Network CRD data that would become readable does not seem harmful:
- ✅ No credential/secret fields in the API definition
- ✅ Mostly configuration data (CIDRs, MTU, ports, feature flags)
⚠️ RawCNIConfig is freeform JSON (could be misused, but user error not design flaw AFAIU)⚠️ Infrastructure topology info (collectors, syslog destinations)
Still, that doesn't mean it won't include something that shouldn't be readable by a cluster-reader in the future, especially if the architectural assumption is that this is an internal, non-customer-visible CRD.
How troubleshoot has been made possible so far?
Mostly making use of must-gather
must-gatherwith cluster-admin privileges (already attempts to collect networks.operator.openshift.io)- Offline analysis of must-gather output
Questions
As someone new to the team, I want to make sure I understand the tradeoffs here:
-
Breaking the pattern: Is the debugging benefit sufficient to justify being the first and only
operator.openshift.ioresource exposed to cluster-reader across the platform? -
Security review: Should we assess the risk of exposing implementation details like
RawCNIConfigand in general braking the current pattern? -
Alternatives: Could we instead:
- Enhance
config.openshift.io/Network.Statuswith additional troubleshooting fields? - Create a dedicated troubleshooting API?
- Enhance
I'm happy to pursue whichever direction the team thinks is best.
@pliurh please let me know your thoughts as you might have additional context on this.
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.
I don't think we shall break the pattern.
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.
@kyrtapz I removed the operator.openshift.io CRD based on the discussion above.
PTAL
Thanks
…uster-reader Signed-off-by: Matteo Dallaglio <mdallagl@redhat.com>
Remove networks.operator.openshift.io resources from the cluster-reader ClusterRole aggregation to maintain consistency with the platform-wide architectural pattern. After investigation, no operator.openshift.io resources are currently exposed to cluster-reader across any OpenShift operators. The consistent pattern is: - config.openshift.io resources ARE exposed (user-facing configuration) - operator.openshift.io resources are NOT exposed (implementation details) While the Network resource doesn't contain sensitive data, exposing it would make CNO the first and only exception to this pattern. The team decided to preserve architectural consistency rather than break this established pattern. Related: OCPBUGS-35387 Signed-off-by: Matteo Dallaglio <mdallagl@redhat.com>
|
/retest |
1 similar comment
|
/retest |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: arkadeepsen, mattedallo, pliurh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@mattedallo: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Add read permissions (i.e. get, list, watch) for network-related resources to the cluster-reader ClusterRole aggregation. The resources are:
Fixes: OCPBUGS-35387