Skip to content

Conversation

@huangmingxia
Copy link
Contributor

@huangmingxia huangmingxia commented Jan 13, 2026

What does this PR do

  • Simplifies ownership detection in the MachinePool controller: an object (e.g. MachineSet / MachineAutoscaler) is treated as controlled by a MachinePool only if its hive.openshift.io/machine-pool label value equals MachinePool.spec.name. The previous name-prefix / hive.openshift.io/managed fallback is removed.
  • Removes unused parameters introduced by the simplification (e.g. dropping cd from syncMachineAutoscalers and updating call sites).

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 13, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 13, 2026

@huangmingxia: This pull request references HIVE-2199 which is a valid jira issue.

Details

In response to this:

Fix isControlledByMachinePool to use infraID when building the prefix for identifying MachineSets. MachineSet names follow the format {infraID}-{poolName}-{zone}, not {clusterName}-{poolName}-{zone}.

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.

@huangmingxia
Copy link
Contributor Author

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 13, 2026
@openshift-ci openshift-ci bot requested review from 2uasimojo and suhanime January 13, 2026 11:13
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 13, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 50.39%. Comparing base (b574bb2) to head (bc52047).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
...g/controller/machinepool/machinepool_controller.go 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2829      +/-   ##
==========================================
- Coverage   50.40%   50.39%   -0.01%     
==========================================
  Files         279      279              
  Lines       34194    34189       -5     
==========================================
- Hits        17235    17231       -4     
- Misses      15595    15597       +2     
+ Partials     1364     1361       -3     
Files with missing lines Coverage Δ
...g/controller/machinepool/machinepool_controller.go 63.02% <80.00%> (-0.55%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@huangmingxia huangmingxia force-pushed the HIVE-2199 branch 2 times, most recently from 1424218 to f8ab8d0 Compare January 15, 2026 08:44
@2uasimojo
Copy link
Member

This is looking good. Please remember to update the PR title/description and commit message.

@huangmingxia
Copy link
Contributor Author

huangmingxia commented Jan 15, 2026

/retitle HIVE-2199: Drop prefix-based ownership checks in MachinePool controller

@openshift-ci openshift-ci bot changed the title HIVE-2199: Use infraID for MachineSet identification HIVE-2199: Drop prefix-based ownership checks in MachinePool controller Jan 15, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 15, 2026

@huangmingxia: This pull request references HIVE-2199 which is a valid jira issue.

Details

In response to this:

What does this PR do

  • Simplifies ownership detection in the MachinePool controller: an object (e.g. MachineSet / MachineAutoscaler) is treated as controlled by a MachinePool only if its hive.openshift.io/machine-pool label value equals MachinePool.spec.name. The previous name-prefix / hive.openshift.io/managed fallback is removed.
  • Removes unused parameters introduced by the simplification (e.g. dropping cd from syncMachineAutoscalers and updating call sites).

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.

@huangmingxia
Copy link
Contributor Author

@2uasimojo Thank you very much for your review :)
I would appreciate it if you could help fix the security job issue.

@2uasimojo
Copy link
Member

@huangmingxia Almost there. Need to update the commit message as well (which will unfortunately require a fresh push and CI run).

The security issue is being tracked via HIVE-3053. As long as the failure matches, and is limited to, what's in that card, we can /override the job in PRs. You may not have the power to do that, but I can take care of it when I do the final review.

The isControlledByMachinePool function previously used a two-step
approach: first checking for the machinePoolNameLabel, then falling
back to prefix-based matching with HiveManagedLabel. This fallback
logic was error-prone and could cause false positives.

This commit simplifies the ownership detection to only check the
machinePoolNameLabel, making it explicit and safer. Objects are
now considered controlled by a MachinePool only if they have the
hive.openshift.io/machine-pool label matching the pool name.

Changes:
- Remove prefix-based fallback logic from isControlledByMachinePool
- Remove unused cd parameter from syncMachineAutoscalers function
- Update all call sites to match the simplified function signatures
- Update unit tests to reflect the label-only ownership model

This ensures that MachineSets and MachineAutoscalers are only
managed when they are explicitly labeled, preventing accidental
modification or deletion of objects that happen to match naming
patterns but aren't actually managed by Hive.
@huangmingxia
Copy link
Contributor Author

@2uasimojo Ah, my bad - I missed that. Thanks for the reminder!

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 16, 2026

@huangmingxia: 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 bc52047 link true /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.

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

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants