Skip to content

OCPBUGS-65497: Add all managed resources to ClusterOperator relatedObjects#404

Open
RadekManak wants to merge 2 commits into
openshift:mainfrom
RadekManak:add-clusterrole-to-related-objects
Open

OCPBUGS-65497: Add all managed resources to ClusterOperator relatedObjects#404
RadekManak wants to merge 2 commits into
openshift:mainfrom
RadekManak:add-clusterrole-to-related-objects

Conversation

@RadekManak
Copy link
Copy Markdown
Contributor

@RadekManak RadekManak commented May 6, 2026

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
    • ClusterOperator now includes eight additional resource types in its related objects tracking for the control-plane machine set operator: serviceaccounts, services, deployments, roles, rolebindings, clusterroles, clusterrolebindings, and validatingwebhookconfigurations. This expanded tracking provides improved visibility into all Kubernetes resources associated with the operator's deployment and configuration.

Add ClusterRole, ClusterRoleBinding, and ValidatingWebhookConfiguration
to the ClusterOperator's relatedObjects to ensure they are collected by
oc adm inspect and must-gather for debugging purposes.
Add serviceaccounts, services, deployments, roles, and rolebindings
to the relatedObjects list so that oc adm inspect and must-gather
collect the full set of resources managed by the operator.
@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
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Walkthrough

The PR expands the set of Kubernetes resources tracked as related objects for the control-plane-machine-set operator by adding eight new resource types (serviceaccounts, services, deployments, roles, rolebindings, clusterroles, clusterrolebindings, and validatingwebhookconfigurations) across both the Go implementation and the manifest declaration.

Changes

Expand Related Objects for Control-Plane-Machine-Set Operator

Layer / File(s) Summary
Core Implementation
pkg/controllers/controlplanemachineset/cluster_operator.go
relatedObjects() function expanded to return eight additional resource types (serviceaccounts, services, deployments, roles, rolebindings, clusterroles, clusterrolebindings, validatingwebhookconfigurations) for the control-plane-machine-set-operator in the machine-api namespace.
Manifest Declaration
manifests/0000_30_control-plane-machine-set-operator_04_clusteroperator.yaml
Eight new relatedObjects entries added to ClusterOperator status, declaring the same eight resource types with appropriate groups, namespaces, and names for the operator.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning Test violates single responsibility: "Set the cluster operator available" asserts 4 unrelated conditions in one block. Multiple Eventually assertions lack failure messages for diagnosis. Split multi-condition test into separate It blocks. Add messages to Eventually assertions: Eventually(...).Should(..., "should set managed resources")
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding all managed resources to the ClusterOperator relatedObjects list.
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 All Ginkgo test names in cluster_operator_test.go are stable and deterministic with no dynamic content (fmt.Sprintf, UUIDs, timestamps, pod names, or generated suffixes detected).
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests added in this PR. Changes are only to manifest files and controller implementation, not test code. MicroShift test compatibility check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests are added. The PR only updates the ClusterOperator manifest and the relatedObjects() function. The custom check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR only adds ClusterOperator metadata for related objects. No new pod scheduling constraints, node selectors, affinity rules, topology spread constraints, or replica count logic is introduced.
Ote Binary Stdout Contract ✅ Passed No OTE stdout contract violations. Changes only add data to Kubernetes resource list. No stdout writes, OTE modifications, or test setup function changes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests with IPv4 assumptions or external connectivity requirements introduced. E2E test files show no IPv4 patterns, hardcoded public URLs, or external dependencies.

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

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.1)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


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

@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
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 6, 2026

[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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 6, 2026

@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 0f554ed 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/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. 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