-
Notifications
You must be signed in to change notification settings - Fork 254
HIVE-2199: Improve isControlledByMachinePool robustness #2822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@huangmingxia: This pull request references HIVE-2199 which is a valid jira issue. DetailsIn response to this:
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. |
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: huangmingxia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/hold |
|
@huangmingxia: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2822 +/- ##
=======================================
Coverage 50.39% 50.40%
=======================================
Files 279 279
Lines 34190 34194 +4
=======================================
+ Hits 17231 17235 +4
Misses 15595 15595
Partials 1364 1364
🚀 New features to boost your workflow:
|
2uasimojo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it.
|
|
||
| func isControlledByMachinePool(cd *hivev1.ClusterDeployment, pool *hivev1.MachinePool, obj metav1.Object) bool { | ||
| // Primary check: MachineSets with the machinePoolNameLabel matching the pool name are controlled. | ||
| if obj.GetLabels()[machinePoolNameLabel] == pool.Spec.Name { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also have a branch that short circuits false if the label exists but doesn't match. That would cover the "prefix scenario" -- where one pool's spec.name is the prefix of another's, like worker and worker2. (I've seen this happen in the field, and I think it was the impetus for the card.)
Require HiveManagedLabel for prefix-based matching to prevent false positives where MachineSets match the naming prefix but aren't actually managed by Hive. This ensures only MachineSets under Hive management are identified as controlled, preventing unexpected deletion of externally managed resources.
Require HiveManagedLabel for prefix-based matching to prevent false positives where MachineSets match the naming prefix but aren't actually managed by Hive. This ensures only MachineSets under Hive management are identified as controlled, preventing unexpected deletion of externally managed resources.