Skip to content

Fixes https://redhat.atlassian.net/browse/OCPBUGS-82584#1489

Closed
rgordill wants to merge 1 commit intoopenshift:mainfrom
rgordill:main
Closed

Fixes https://redhat.atlassian.net/browse/OCPBUGS-82584#1489
rgordill wants to merge 1 commit intoopenshift:mainfrom
rgordill:main

Conversation

@rgordill
Copy link
Copy Markdown

@rgordill rgordill commented Apr 16, 2026

It adds a new status field called selector, with the same logic as other scale subresources (an joined string of spec.selector fields comma separated), and fix the scale subresource definition to point to that field. With that, the HPA and other scaling mechanisms would not raise exceptions.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new status.selector field to MachineSet status that exposes the label selector in string format, enabling proper autoscaler and HPA integration through the scale subresource.
  • Tests

    • Added test coverage to validate the status selector field correctly matches the spec selector configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 3973e474-bf48-4237-88a4-8c04dff54a5c

📥 Commits

Reviewing files that changed from the base of the PR and between 498bb59 and b046beb.

⛔ Files ignored due to path filters (9)
  • vendor/github.com/openshift/api/machine/v1beta1/types_machineset.go is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-CustomNoUpgrade.crd.yaml is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-Default.crd.yaml is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-DevPreviewNoUpgrade.crd.yaml is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-OKD.crd.yaml is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-TechPreviewNoUpgrade.crd.yaml is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/openshift/api/machine/v1beta1/zz_generated.swagger_doc_generated.go is excluded by !**/vendor/**, !vendor/**, !**/zz_generated*
  • vendor/github.com/openshift/client-go/machine/applyconfigurations/internal/internal.go is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1beta1/machinesetstatus.go is excluded by !**/vendor/**, !vendor/**
📒 Files selected for processing (7)
  • install/0000_30_machine-api-operator_03_machineset.CustomNoUpgrade.crd.yaml
  • install/0000_30_machine-api-operator_03_machineset.Default.crd.yaml
  • install/0000_30_machine-api-operator_03_machineset.DevPreviewNoUpgrade.crd.yaml
  • install/0000_30_machine-api-operator_03_machineset.OKD.crd.yaml
  • install/0000_30_machine-api-operator_03_machineset.TechPreviewNoUpgrade.crd.yaml
  • pkg/controller/machineset/status.go
  • pkg/controller/machineset/status_test.go

Walkthrough

The changes add a new status.selector field to MachineSet CRD schemas across five deployment variants and update the scale subresource to reference this field. The controller logic is enhanced to compute and write the selector string during status updates, with new test coverage validating the computation.

Changes

Cohort / File(s) Summary
MachineSet CRD Variants
install/0000_30_machine-api-operator_03_machineset.CustomNoUpgrade.crd.yaml, install/0000_30_machine-api-operator_03_machineset.Default.crd.yaml, install/0000_30_machine-api-operator_03_machineset.DevPreviewNoUpgrade.crd.yaml, install/0000_30_machine-api-operator_03_machineset.OKD.crd.yaml, install/0000_30_machine-api-operator_03_machineset.TechPreviewNoUpgrade.crd.yaml
Added status.selector field (string) to CRD status schema; updated scale subresource labelSelectorPath from .status.labelSelector to .status.selector for autoscaler resolution.
MachineSet Controller Status
pkg/controller/machineset/status.go
Updated status calculation to set Selector field using metav1.FormatLabelSelector() and modified comparison logic to include selector comparison for status update determination.
MachineSet Status Tests
pkg/controller/machineset/status_test.go
Added TestMachineSetStatusSelectorMatchesScaleSubresource test validating that computed status.selector matches the formatted spec.selector across different label selector configurations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 9 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title only references a Jira ticket URL without describing the actual change; it lacks meaningful information about what the PR does. Consider a more descriptive title that summarizes the main change, such as 'Add status.selector field to MachineSet CRD' or similar.
✅ Passed checks (9 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Stable And Deterministic Test Names ✅ Passed The test file uses standard Go testing with hardcoded, descriptive test names that are stable and deterministic across runs, following best practices.
Test Structure And Quality ✅ Passed The PR adds a standard Go unit test using testing.T, not a Ginkgo test, so this check is not applicable.
Microshift Test Compatibility ✅ Passed The pull request does not add any Ginkgo e2e tests, only a standard Go unit test file. The custom check is not applicable to this PR.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new test file status_test.go is a standard Go unit test using testing.T, not a Ginkgo e2e test, so the SNO compatibility check does not apply.
Topology-Aware Scheduling Compatibility ✅ Passed PR changes add status.selector field to MachineSet CRD and update scale subresource metadata without introducing any topology-aware scheduling constraints, pod affinity rules, nodeSelector constraints, or topology-dependent configurations.
Ote Binary Stdout Contract ✅ Passed PR changes do not introduce process-level stdout writes. Code modifications only add status field calculation logic and standard unit tests without violating the OTE Binary Stdout Contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds only a standard Go unit test using testing.T framework, not Ginkgo e2e tests. Custom check applies only to Ginkgo patterns (It(), Describe(), Context(), When()), which are absent.

✏️ 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.11.4)

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


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 requested review from damdo and racheljpg April 16, 2026 09:44
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 16, 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 damdo 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

@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 Apr 16, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 16, 2026

Hi @rgordill. 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.

@RadekManak
Copy link
Copy Markdown
Contributor

/close
Thanks, I'll merge this on #1490

@openshift-ci openshift-ci bot closed this Apr 16, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 16, 2026

@RadekManak: Closed this PR.

Details

In response to this:

/close
Thanks, I'll merge this on #1490

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.

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

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants