Skip to content

OCPBUGS-65497: Add debug-useful ClusterOperator relatedObjects - #404

Open
RadekManak wants to merge 1 commit into
openshift:mainfrom
RadekManak:add-clusterrole-to-related-objects
Open

OCPBUGS-65497: Add debug-useful ClusterOperator relatedObjects#404
RadekManak wants to merge 1 commit into
openshift:mainfrom
RadekManak:add-clusterrole-to-related-objects

Conversation

@RadekManak

@RadekManak RadekManak commented May 6, 2026

Copy link
Copy Markdown
Contributor

Expand control-plane-machine-set ClusterOperator relatedObjects with the operator ClusterRole / ClusterRoleBinding so must-gather collects them.

Keeps the existing namespace, ControlPlaneMachineSet, and Machine relatedObjects.

Added relatedObjects

  • ClusterRole: control-plane-machine-set-operator
  • ClusterRoleBinding: control-plane-machine-set-operator

Tests

Parity test keeping the Go list in sync with the ClusterOperator manifest.

@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 6, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@RadekManak: This pull request references Jira Issue OCPBUGS-65497, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.21.z" instead

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:

Adds all resources managed by the control-plane-machine-set operator to the ClusterOperator's relatedObjects list, ensuring oc adm inspect and must-gather collect the complete set of resources needed for debugging.

Resources added

  • ServiceAccounts
  • Services, Deployments
  • Roles and RoleBindings
  • ClusterRoles and ClusterRoleBindings
  • ValidatingWebhookConfigurations

Both the static manifest YAML and the Go source are kept in sync.

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 6, 2026

Copy link
Copy Markdown

Walkthrough

The PR adds the control-plane-machine-set operator’s ClusterRole and ClusterRoleBinding to runtime related-object tracking and the ClusterOperator manifest, with a test that compares both declarations.

Changes

Control-plane related object tracking

Layer / File(s) Summary
Add operator RBAC related objects
pkg/controllers/controlplanemachineset/cluster_operator.go, manifests/0000_30_control-plane-machine-set-operator_04_clusteroperator.yaml
Runtime related objects and the ClusterOperator manifest now include the control-plane-machine-set-operator ClusterRole and ClusterRoleBinding.
Validate manifest consistency
pkg/controllers/controlplanemachineset/related_objects_test.go
A test loads the manifest and verifies that its related objects match relatedObjects().

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: nrb, damdo

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 Added Ginkgo titles are static: Describe("relatedObjects") and It("should stay in sync with the ClusterOperator manifest").
Test Structure And Quality ✅ Passed The new Ginkgo test is a single-purpose manifest-sync check, has meaningful failure messages, and doesn’t create cluster resources or use waits/timeouts.
Microshift Test Compatibility ✅ Passed The new Ginkgo test only reads a manifest and unmarshals YAML to compare pure Go data; it uses no cluster APIs, unsupported OpenShift features, or MicroShift-skipping labels.
Single Node Openshift (Sno) Test Compatibility ✅ Passed related_objects_test.go is an envtest unit test that only reads YAML and compares object refs; it has no node/topology assumptions or SNO-sensitive behavior.
Topology-Aware Scheduling Compatibility ✅ Passed Only ClusterOperator relatedObjects/status sync and a manifest consistency test changed; no pod specs, replicas, selectors, affinity, or topology-aware scheduling constraints were added.
Ote Binary Stdout Contract ✅ Passed The PR only changes relatedObjects data and adds an It-body sync test; no main/init/BeforeSuite stdout writes were introduced, and klog is already routed to GinkgoWriter.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed New Ginkgo test is local-only and just syncs manifest vs Go; no IPv4 assumptions or external connectivity found.
No-Weak-Crypto ✅ Passed No weak-crypto, custom-crypto, or secret/token comparison code was added; the PR only adds RBAC relatedObjects entries and a sync test.
Container-Privileges ✅ Passed Changed files only add ClusterOperator relatedObjects entries and a sync test; no privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation settings appear.
No-Sensitive-Data-In-Logs ✅ Passed No new logging exposes sensitive data; added code only updates relatedObjects and the existing logger messages are generic status/error text.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the core change: expanding ClusterOperator relatedObjects to include debug-relevant managed resources.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 6, 2026
@openshift-ci
openshift-ci Bot requested review from damdo and nrb May 6, 2026 13:52
@openshift-ci

openshift-ci Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign joelspeed 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.

🧹 Nitpick comments (1)
pkg/controllers/controlplanemachineset/cluster_operator.go (1)

54-98: ⚡ Quick win

Add a parity test for the duplicated related-object list.

relatedObjects() is now a second hard-coded source of truth next to manifests/0000_30_control-plane-machine-set-operator_04_clusteroperator.yaml. A small test that compares the two would catch future renames/additions before inspect or must-gather coverage drifts.

🤖 Prompt for 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.

In `@pkg/controllers/controlplanemachineset/cluster_operator.go` around lines 54 -
98, Add a parity unit test that ensures the hard-coded relatedObjects() list
matches the relatedObjects declared in the manifest file
manifests/0000_30_control-plane-machine-set-operator_04_clusteroperator.yaml:
write a test (e.g., controlplanemachineset_relatedobjects_test.go) that calls
relatedObjects(), loads and parses the ClusterOperator YAML from the manifest
file, extracts the relatedObjects entries (group, resource, name, namespace),
normalizes both lists into comparable sets (ignore ordering), and fails if there
is any difference so future renames/additions are caught automatically.
🤖 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.

Nitpick comments:
In `@pkg/controllers/controlplanemachineset/cluster_operator.go`:
- Around line 54-98: Add a parity unit test that ensures the hard-coded
relatedObjects() list matches the relatedObjects declared in the manifest file
manifests/0000_30_control-plane-machine-set-operator_04_clusteroperator.yaml:
write a test (e.g., controlplanemachineset_relatedobjects_test.go) that calls
relatedObjects(), loads and parses the ClusterOperator YAML from the manifest
file, extracts the relatedObjects entries (group, resource, name, namespace),
normalizes both lists into comparable sets (ignore ordering), and fails if there
is any difference so future renames/additions are caught automatically.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 9d39db61-8275-4aaa-84bb-b8115826240f

📥 Commits

Reviewing files that changed from the base of the PR and between 85f92f7 and 0f554ed.

📒 Files selected for processing (2)
  • manifests/0000_30_control-plane-machine-set-operator_04_clusteroperator.yaml
  • pkg/controllers/controlplanemachineset/cluster_operator.go

@RadekManak
RadekManak force-pushed the add-clusterrole-to-related-objects branch from 0f554ed to 2c4c707 Compare July 13, 2026 15:49
Add ClusterRole/ClusterRoleBinding, ValidatingWebhookConfiguration, and
ControlPlaneMachineSet/Machine references to relatedObjects so inspect and
must-gather collect the resources needed to debug CPMS.

Keep Go and the ClusterOperator manifest in sync with a parity test.
@RadekManak
RadekManak force-pushed the add-clusterrole-to-related-objects branch from 2c4c707 to eeff6a8 Compare July 13, 2026 16:12
@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 13, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@RadekManak: This pull request references Jira Issue OCPBUGS-65497, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @sunzhaohua2

Details

In response to this:

Adds all resources managed by the control-plane-machine-set operator to the ClusterOperator's relatedObjects list, ensuring oc adm inspect and must-gather collect the complete set of resources needed for debugging.

Resources added

  • ServiceAccounts
  • Services, Deployments
  • Roles and RoleBindings
  • ClusterRoles and ClusterRoleBindings
  • ValidatingWebhookConfigurations

Both the static manifest YAML and the Go source are kept in sync.

Summary by CodeRabbit

  • New Features
  • Improved ClusterOperator reporting by adding visibility for the control-plane machine set operator’s RBAC resources, including the clusterroles and clusterrolebindings it manages.
  • Tests
  • Added coverage to ensure the ClusterOperator manifest’s status.relatedObjects stays in sync with the computed related object list.

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.

@openshift-ci

openshift-ci Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@openshift-ci-robot: GitHub didn't allow me to request PR reviews from the following users: sunzhaohua2.

Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

@RadekManak: This pull request references Jira Issue OCPBUGS-65497, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @sunzhaohua2

In response to this:

Adds all resources managed by the control-plane-machine-set operator to the ClusterOperator's relatedObjects list, ensuring oc adm inspect and must-gather collect the complete set of resources needed for debugging.

Resources added

  • ServiceAccounts
  • Services, Deployments
  • Roles and RoleBindings
  • ClusterRoles and ClusterRoleBindings
  • ValidatingWebhookConfigurations

Both the static manifest YAML and the Go source are kept in sync.

Summary by CodeRabbit

  • New Features
  • Improved ClusterOperator reporting by adding visibility for the control-plane machine set operator’s RBAC resources, including the clusterroles and clusterrolebindings it manages.
  • Tests
  • Added coverage to ensure the ClusterOperator manifest’s status.relatedObjects stays in sync with the computed related object list.

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.

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.

@RadekManak RadekManak changed the title OCPBUGS-65497: Add all managed resources to ClusterOperator relatedObjects OCPBUGS-65497: Add debug-useful ClusterOperator relatedObjects Jul 13, 2026
@RadekManak

Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@RadekManak: 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/e2e-aws-ovn-etcd-scaling eeff6a8 link true /test e2e-aws-ovn-etcd-scaling

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.

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

Labels

jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants