Skip to content

OCPBUGS-65488: Add cluster-scoped RBAC and CRDs to network ClusterOperator relatedObjects#3013

Open
smulje wants to merge 1 commit into
openshift:masterfrom
smulje:fix-OCPBUGS-65488
Open

OCPBUGS-65488: Add cluster-scoped RBAC and CRDs to network ClusterOperator relatedObjects#3013
smulje wants to merge 1 commit into
openshift:masterfrom
smulje:fix-OCPBUGS-65488

Conversation

@smulje

@smulje smulje commented May 25, 2026

Copy link
Copy Markdown

Summary

Adds missing cluster-scoped resources to the network ClusterOperator's relatedObjects field to enable oc adm inspect clusteroperator/network to collect all relevant resources for debugging.

Associated Bug:

https://redhat.atlassian.net/browse/OCPBUGS-65488

Problem

While checking oc adm inspect clusteroperator output in CI, several cluster-scoped resources deployed via static manifests were missing from the network ClusterOperator's relatedObjects:

  • ClusterRoleBinding: cluster-network-operator
  • ClusterRoleBinding: default-account-cluster-network-operator
  • CRDs: egressrouters.network.operator.openshift.io, operatorpkis.network.operator.openshift.io, networks.operator.openshift.io

This caused oc adm inspect to fail collecting these resources, making debugging more difficult.

Solution

Updated manifests/0000_70_cluster-network-operator_05_clusteroperator.yaml to include these cluster-scoped resources in the status.relatedObjects field.

Testing

Manual Verification

  1. Deploy cluster with updated manifest
  2. Run oc adm inspect clusteroperator/network
  3. Verify the following files are collected:

Before Fix:

clusterroles % ls
metrics-daemon-role.yaml				net-attach-def-project.yaml				openshift-ovn-kubernetes-cluster-reader.yaml		openshift-ovn-kubernetes-udn-editor.yaml
multus-admission-controller-webhook.yaml		network-diagnostics.yaml				openshift-ovn-kubernetes-control-plane-limited.yaml	openshift-ovn-kubernetes-udn-viewer.yaml
multus-ancillary-tools.yaml				network-node-identity.yaml				openshift-ovn-kubernetes-kube-rbac-proxy.yaml		whereabouts-cni.yaml
multus.yaml						openshift-iptables-alerter.yaml				openshift-ovn-kubernetes-node-limited.yaml
 clusterrolebindings % ls
metrics-daemon-sa-rolebinding.yaml			multus-group.yaml					network-node-identity.yaml				openshift-ovn-kubernetes-node-kube-rbac-proxy.yaml
multus-admission-controller-webhook.yaml		multus-transient.yaml					openshift-iptables-alerter.yaml
multus-ancillary-tools.yaml				multus-whereabouts.yaml					openshift-ovn-kubernetes-control-plane-limited.yaml
multus-cluster-readers.yaml				network-diagnostics.yaml				openshift-ovn-kubernetes-node-identity-limited.yaml

After Fix:

inspect.local.1906073230607695611/cluster-scoped-resources/rbac.authorization.k8s.io/clusterroles
clusterroles % ls
metrics-daemon-role.yaml				net-attach-def-project.yaml				openshift-ovn-kubernetes-cluster-reader.yaml		openshift-ovn-kubernetes-udn-editor.yaml
multus-admission-controller-webhook.yaml		network-diagnostics.yaml				openshift-ovn-kubernetes-control-plane-limited.yaml	openshift-ovn-kubernetes-udn-viewer.yaml
multus-ancillary-tools.yaml				network-node-identity.yaml				openshift-ovn-kubernetes-kube-rbac-proxy.yaml		whereabouts-cni.yaml
multus.yaml						openshift-iptables-alerter.yaml				openshift-ovn-kubernetes-node-limited.yaml

clusterrolebindings % ls 
cluster-network-operator.yaml				multus-cluster-readers.yaml				network-diagnostics.yaml				openshift-ovn-kubernetes-node-identity-limited.yaml
metrics-daemon-sa-rolebinding.yaml			multus-group.yaml					network-node-identity.yaml				openshift-ovn-kubernetes-node-kube-rbac-proxy.yaml
multus-admission-controller-webhook.yaml		multus-transient.yaml					openshift-iptables-alerter.yaml
multus-ancillary-tools.yaml				multus-whereabouts.yaml					openshift-ovn-kubernetes-control-plane-limited.yaml

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 25, 2026
@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@smulje: This pull request references Jira Issue OCPBUGS-65488, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

Adds missing cluster-scoped resources to the network ClusterOperator's relatedObjects field to enable oc adm inspect clusteroperator/network to collect all relevant resources for debugging.

Problem

While checking oc adm inspect clusteroperator output in CI, several cluster-scoped resources deployed via static manifests were missing from the network ClusterOperator's relatedObjects:

  • ClusterRoleBinding: cluster-network-operator
  • ClusterRoleBinding: default-account-cluster-network-operator
  • CRDs: egressrouters.network.operator.openshift.io, operatorpkis.network.operator.openshift.io, networks.operator.openshift.io

This caused oc adm inspect to fail collecting these resources, making debugging more difficult.

Solution

Updated manifests/0000_70_cluster-network-operator_05_clusteroperator.yaml to include these cluster-scoped resources in the status.relatedObjects field.

Changes

  • Added 2 ClusterRoleBindings to relatedObjects
  • Added 3 CustomResourceDefinitions to relatedObjects
  • No Go code changes required (follows pattern from other operators)

Testing

Manual Verification

  1. Deploy cluster with updated manifest
  2. Run oc adm inspect clusteroperator/network
  3. Verify the following files are collected:
cluster-scoped-resources/rbac.authorization.k8s.io/clusterrolebindings/cluster-network-operator.yaml
cluster-scoped-resources/rbac.authorization.k8s.io/clusterrolebindings/default-account-cluster-network-operator.yaml
cluster-scoped-resources/apiextensions.k8s.io/customresourcedefinitions/egressrouters.network.operator.openshift.io.yaml
cluster-scoped-resources/apiextensions.k8s.io/customresourcedefinitions/operatorpkis.network.operator.openshift.io.yaml
cluster-scoped-resources/apiextensions.k8s.io/customresourcedefinitions/networks.operator.openshift.io.yaml

Expected vs Actual

Before: Only cloud-network-config-controller and metrics-daemon-sa-rolebinding ClusterRoleBindings collected
After: All CNO-owned ClusterRoleBindings and CRDs are collected

References

Risk Assessment

Low Risk:

  • Only adds to existing relatedObjects, doesn't remove anything
  • Resources already exist in cluster, we're just making them discoverable
  • Follows proven pattern from other operators
  • No functional code changes
  • Manifest-only change

🤖 Generated with Claude Code via /jira:solve OCPBUGS-65488

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.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Walkthrough

The PR updates the network operator’s ClusterOperator status to include additional related Kubernetes resources, and mirrors those references in controller reconciliation before status is written.

Changes

Network operator related objects

Layer / File(s) Summary
Manifest status related objects
manifests/0000_70_cluster-network-operator_05_clusteroperator.yaml
Adds status.relatedObjects entries for two clusterrolebindings and three customresourcedefinitions.
Controller related object assembly
pkg/controller/operconfig/operconfig_controller.go
Extends relatedObjects during Reconcile with the same clusterrolebinding and CRD references before persisting status.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding cluster-scoped RBAC and CRDs to the network ClusterOperator's relatedObjects.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo tests found in PR. All test files use Go's standard testing framework, not Ginkgo BDD-style test declarations.
Test Structure And Quality ✅ Passed PR contains only manifest and controller logic changes (no test files added/modified), making the Ginkgo test quality check not applicable to this PR.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests are added in this PR. The changes are limited to manifest updates and controller code changes for populating relatedObjects. The check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR adds no new Ginkgo e2e tests—only manifest and controller code changes. The custom check applies only when new tests are added.
Topology-Aware Scheduling Compatibility ✅ Passed PR only adds metadata references to cluster-scoped resources in ClusterOperator status. No deployment manifests, scheduling constraints, affinity rules, or pod topology configurations are modified.
Ote Binary Stdout Contract ✅ Passed PR modifies the cluster-network-operator, a regular Kubernetes operator (not an OTE test binary). Changes only add ObjectReference appends in Reconcile() method—no stdout writes in process-level code.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests added in this PR. Changes are limited to manifest updates and controller code; mtu_probe_test.go is a unit test using Go's testing package, not Ginkgo.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 25, 2026
@openshift-ci

openshift-ci Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Hi @smulje. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@openshift-ci

openshift-ci Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: smulje
Once this PR has been reviewed and has the lgtm label, please assign abhat for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@manifests/0000_70_cluster-network-operator_05_clusteroperator.yaml`:
- Around line 10-25: The controller is overwriting
ClusterOperator.status.relatedObjects with only objects from network.Render(...)
(via pkg/controller/operconfig/operconfig_controller.go ->
r.status.SetRelatedObjects) and status_manager.set() calls
deleteRelatedObjectsNotRendered(co), which removes the three CRDs and two
ClusterRoleBindings declared in this manifest; fix by either ensuring the
computed relatedObjects (in operconfig_controller.go / network.Render) includes
the two ClusterRoleBinding names (cluster-network-operator and
default-account-cluster-network-operator) and the three CRD names
(egressrouters.network.operator.openshift.io,
operatorpkis.network.operator.openshift.io, networks.operator.openshift.io), or
modify pkg/controller/statusmanager/status_manager.go (set() /
deleteRelatedObjectsNotRendered) to merge/preserve CVO-managed relatedObjects by
adding those CRD names to keepCRDs or by changing deletion logic to union
existing co.Status.RelatedObjects with rendered status.relatedObjects for known
CVO-managed entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 44c044d7-a087-48f6-b5c7-a964b9c23d7f

📥 Commits

Reviewing files that changed from the base of the PR and between bea98c0 and eac3560.

📒 Files selected for processing (1)
  • manifests/0000_70_cluster-network-operator_05_clusteroperator.yaml

Comment thread manifests/0000_70_cluster-network-operator_05_clusteroperator.yaml
@smulje smulje force-pushed the fix-OCPBUGS-65488 branch from eac3560 to c94e52e Compare May 25, 2026 11:01
…Objects

Add missing cluster-scoped resources to the network ClusterOperator's
relatedObjects field in both the manifest and the controller code:
- ClusterRoleBinding: cluster-network-operator
- ClusterRoleBinding: default-account-cluster-network-operator
- CRD: egressrouters.network.operator.openshift.io
- CRD: operatorpkis.network.operator.openshift.io
- CRD: networks.operator.openshift.io

These resources are deployed as static manifests by CVO but were not
included in relatedObjects, causing 'oc adm inspect clusteroperator/network'
to fail collecting them for debugging purposes.

Changes:
1. Updated ClusterOperator manifest to include relatedObjects for CVO bootstrap
2. Updated operconfig controller to add these resources to the computed
   relatedObjects list, preventing deleteRelatedObjectsNotRendered() from
   removing them during reconciliation

Without the controller change, the manifest-only fix would be overwritten
at runtime when the controller recomputes and sets relatedObjects.

Signed-off-by: Swati Mulje <smulje@redhat.com>
@smulje smulje force-pushed the fix-OCPBUGS-65488 branch from c94e52e to fad0e27 Compare May 25, 2026 11:02
@smulje smulje marked this pull request as ready for review May 25, 2026 13:01
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 25, 2026
@openshift-ci openshift-ci Bot requested review from arghosh93 and bpickard22 May 25, 2026 13:01
@arghosh93

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 4, 2026
@openshift-ci

openshift-ci Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

@smulje: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security fad0e27 link unknown /test security

Full PR test history. Your PR dashboard.

Details

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.

@smulje

smulje commented Jun 8, 2026

Copy link
Copy Markdown
Author

/test e2e-aws-ovn-upgrade

@arghosh93 arghosh93 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that all resources belonging to https://github.com/openshift/cluster-network-operator/tree/master/manifests are not being tracked at relatedObjects of network Cluster operator CR. It is logical as files in the manifests directory are supposed to be deployed and reconciled by cluster-version-operator and not CNO. So, it also does not make sense to have those in relatedObjects of network CO.

did you check whether all objects under manifest directory of CNO should be in relatedObjects of network CO? or, we only care about the objects that you added in your PR? Did you have any conversation regarding this with anyone?

include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/single-node-developer: "true"
status:
relatedObjects:

@arghosh93 arghosh93 Jun 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you are adding here and also adding at operconfig_controller.go? We should never set status at the manifest I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants