Skip to content

OCPBUGS-82584: Add labelSelector to MachineSet status for scale subresource#2807

Open
RadekManak wants to merge 1 commit intoopenshift:masterfrom
openshift-cloud-team:OCPBUGS-82584
Open

OCPBUGS-82584: Add labelSelector to MachineSet status for scale subresource#2807
RadekManak wants to merge 1 commit intoopenshift:masterfrom
openshift-cloud-team:OCPBUGS-82584

Conversation

@RadekManak
Copy link
Copy Markdown
Contributor

Summary

MachineSet already advertises a scale subresource with labelSelectorPath: .status.labelSelector, but the API/schema does not define that status field.

  • adds status.labelSelector to machine.openshift.io/v1beta1 MachineSetStatus

The paired openshift/machine-api-operator#1490 change populates status.labelSelector from spec.selector during MachineSet status reconciliation so the /scale subresource can expose Scale.status.selector for HPA/KEDA-style consumers.

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Apr 16, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@RadekManak: This pull request references Jira Issue OCPBUGS-82584, 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

MachineSet already advertises a scale subresource with labelSelectorPath: .status.labelSelector, but the API/schema does not define that status field.

  • adds status.labelSelector to machine.openshift.io/v1beta1 MachineSetStatus

The paired openshift/machine-api-operator#1490 change populates status.labelSelector from spec.selector during MachineSet status reconciliation so the /scale subresource can expose Scale.status.selector for HPA/KEDA-style consumers.

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-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Apr 16, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 16, 2026

Hello @RadekManak! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c52e9b95-bb23-4f39-bb72-7751cb5ec7b3

📥 Commits

Reviewing files that changed from the base of the PR and between 62d795b and 6cb9185.

⛔ Files ignored due to path filters (10)
  • machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-Default.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-DevPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-OKD.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machine/v1beta1/zz_generated.crd-manifests/0000_10_machine-api_01_machinesets-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machine/v1beta1/zz_generated.featuregated-crd-manifests/machinesets.machine.openshift.io/AAA_ungated.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • machine/v1beta1/zz_generated.featuregated-crd-manifests/machinesets.machine.openshift.io/MachineAPIMigration.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • machine/v1beta1/zz_generated.swagger_doc_generated.go is excluded by !**/zz_generated*
  • openapi/generated_openapi/zz_generated.openapi.go is excluded by !openapi/**, !**/zz_generated*
  • openapi/openapi.json is excluded by !openapi/**
📒 Files selected for processing (1)
  • machine/v1beta1/types_machineset.go

📝 Walkthrough

Walkthrough

An optional LabelSelector field of type string was added to MachineSetStatus in machine/v1beta1/types_machineset.go (JSON: labelSelector,omitempty, validation: MaxLength=4096). It represents the serialized label selector for the MachineSet's machines and is exposed via the scale subresource as status.selector. If omitted, it indicates the controller has not yet reconciled spec.selector into status.labelSelector. No other spec or status fields or control-flow logic were changed.

🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding a labelSelector field to MachineSet status for the scale subresource, directly matching the changeset which adds exactly this field.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation (scale subresource compatibility), the change being made (adding status.labelSelector field), and the paired implementation work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Stable And Deterministic Test Names ✅ Passed This PR modifies API type definitions only without adding or modifying any Ginkgo tests, so no test names exist to evaluate.
Test Structure And Quality ✅ Passed This custom check is not applicable to the provided pull request. The PR only modifies the machine/v1beta1/types_machineset.go file, which is a types definition file that adds a LabelSelector field to the MachineSetStatus struct. The custom check is designed to review Ginkgo test code for quality requirements such as single responsibility, setup/cleanup patterns, timeouts, and assertion messages. Since this PR contains no test files or test code changes, there is no test code to review against the specified quality criteria.
Microshift Test Compatibility ✅ Passed PR adds LabelSelector field to MachineSetStatus struct only; contains no new Ginkgo e2e tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This pull request does not introduce any new Ginkgo e2e tests. The change is purely a Kubernetes API schema modification that adds a LabelSelector field to the MachineSetStatus type to support the scale subresource.
Topology-Aware Scheduling Compatibility ✅ Passed PR adds a single optional LabelSelector field to MachineSetStatus API type definition, a pure schema enhancement without introducing scheduling constraints, affinity rules, deployment manifests, or topology-dependent logic.
Ote Binary Stdout Contract ✅ Passed PR modifies only API type definitions in machine/v1beta1/types_machineset.go with no process-level code or binary entry points that could violate OTE Binary Stdout Contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add any new Ginkgo e2e tests. Changes consist solely of adding a new optional field to an API type definition file.

✏️ 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: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented
The command is terminated due to an error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented


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

@openshift-ci openshift-ci bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 16, 2026
@openshift-ci openshift-ci bot requested review from everettraven and mandre April 16, 2026 10:18
@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 everettraven 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

@RadekManak
Copy link
Copy Markdown
Contributor Author

/jira refresh

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

@RadekManak: This pull request references Jira Issue OCPBUGS-82584, which is valid.

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 POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

// It is exposed via the scale subresource as status.selector.
// When omitted, the MachineSet controller has not yet reconciled spec.selector into status.labelSelector.
// +optional
LabelSelector string `json:"labelSelector,omitempty"`
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.

Is there a reasonable upper bounds we can set here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The labelSelector for MachineSet is typically the machineset name and cluster name. Additionally, user could add their own. There is no limit on how many they can add on the spec. Set this to 4096 as reasonable high number that won't cause issue to existing clusters.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 16, 2026

@RadekManak: The following tests 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/lint 6cb9185 link true /test lint
ci/prow/verify-hypershift-integration 6cb9185 link true /test verify-hypershift-integration

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-moderate Referenced Jira bug's severity is moderate 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants