Skip to content
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

MachinePool: Properly handle labels & taints #2069

Conversation

2uasimojo
Copy link
Member

@2uasimojo 2uasimojo commented Jul 26, 2023

With this commit, MachinePool grows two new statusfields: OwnedLabels and OwnedTaints. These keep track of the labels and taints that were added to the remote MachineSets at the behest of this MachinePool. Conversely, this allows us to identify which ones were added on the remote side, and thus shouldn't be touched by our controller.

We also fix the logic for matching taints, which are "keyed" by the combination of the Key and Effect fields.

To summarize the behavior with this commit in play:

  • Labels and taints listed in MachinePool.Spec are synced to the remote MachineSets.
  • Labels and taints that are not in MachinePool.Spec are removed from the remote MachineSets iff they are present in
    MachinePool.Status.Owned{Labels|Taints}.
  • Upon successful syncing, we update MachinePool.Status.Owned{Labels|Taints} to match the spec.

The effect is that editing MachinePool.Spec to remove a label or taint should cause that label/taint to be removed from the remote MachineSets, BUT labels/taints that only exist on the remote MachineSets remain untouched.

HIVE-2035
HIVE-2276
HIVE-2279
HIVE-2268

With this commit, MachinePool grows two new statusfields: `OwnedLabels`
and `OwnedTaints`. These keep track of the labels and taints that were
added to the remote MachineSets at the behest of this MachinePool.
Conversely, this allows us to identify which ones were added on the
remote side, and thus shouldn't be touched by our controller.

We also fix the logic for matching taints, which are "keyed" by the
combination of the `Key` and `Effect` fields.

To summarize the behavior with this commit in play:
- Labels and taints listed in MachinePool.Spec are synced to the remote
MachineSets.
- Labels and taints that are *not* in MachinePool.Spec are removed from
the remote MachineSets *iff* they are present in
MachinePool.Status.Owned{Labels|Taints}.
- Upon successful syncing, we update
MachinePool.Status.Owned{Labels|Taints} to match the spec.

The effect is that editing MachinePool.Spec to remove a label or taint
should cause that label/taint to be removed from the remote MachineSets,
BUT labels/taints that only exist on the remote MachineSets remain
untouched.

HIVE-2035
HIVE-2276
HIVE-2279
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 26, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 26, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 26, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 2uasimojo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 26, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 3, 2023

@2uasimojo: all tests passed!

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@suhanime
Copy link
Contributor

suhanime commented Aug 9, 2023

Superseded by 2082

@suhanime suhanime closed this Aug 9, 2023
@2uasimojo 2uasimojo deleted the HIVE-2276/mp-deleted-labels-taints branch August 9, 2023 15:41
}

if gTaint, foundTaint := gTaintsByID[tid]; foundTaint && gTaint.Value != rTaint.Value {
Copy link
Member Author

Choose a reason for hiding this comment

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

BUG: if the rMS has duplicates, we'll replace the first one, but then because we deleted it from gTaintsByID, subsequent dups will be added as is.

}
sort.SliceStable(taints, func(i, j int) bool {
Copy link
Member Author

Choose a reason for hiding this comment

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

POSSIBLE BUG: Does taint order matter to k8s? If so, this is not the right thing to do. We should in fact be conveying the ordering from the MachinePool to the extent that is feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants