Skip to content

Conversation

@fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR simplifies fake ms controller in the rollout planner, to get rid of unnecessary code and to change an assumption that would have been racy when implementing the same in the prod code for the ms controller.

Which issue(s) this PR fixes:
Part of #12291

/area machinedeployment

@k8s-ci-robot k8s-ci-robot added area/machinedeployment Issues or PRs related to machinedeployments cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 27, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 27, 2025
Comment on lines -685 to -691
// Prevent deletion of machines not yet acknowledged after a move operation.
// Note: as soon as an in-place upgrade is started, CAPI Should always try to complete it
// before taking further actions on the same machine.
if notAcknowledgeMoveReplicas.Has(m.Name) {
machinesSetMachines = append(machinesSetMachines, m)
continue
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This if has been dropped because unnecessary (probably a left over of a previous iteration)

Comment on lines -623 to -626
// Limit the number of machines to be moved to avoid to exceed the final number of replicas for the target MS.
// TODO(in-place): consider using the DesiredReplicasAnnotation which is propagated together with the other decisions of the rollout planner
// another option to consider is to shift this check on the newMS (so we perform move, but we don't start the in-place upgrade).
machinesToMove := min(machinesToDeleteOrMove, ptr.Deref(scope.machineDeployment.Spec.Replicas, 0)-ptr.Deref(targetMS.Spec.Replicas, 0))
Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed during review, this would have been racy when implemented in the prod code for the oldMS reconciliation.

So now we are moving all the machines, and deferring to the newMS to get rid of exceeding machines.
This leads to the ideal results - perform the minimal number of in place upgrades/avoid unnecessary in place updates - under the assumption that machines upgrading in place have the highest deletion priority.

Notes about how to change the prod code have been changed accordingly

Copy link
Member

Choose a reason for hiding this comment

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

Nice, thx!

@sbueringer
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 16d6547d160f6cbceb5bec2bee2ee1038fd18342

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2025
@k8s-ci-robot k8s-ci-robot merged commit 1957ad0 into kubernetes-sigs:main Oct 27, 2025
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.12 milestone Oct 27, 2025
@fabriziopandini fabriziopandini deleted the simplify-rollout-planner branch November 11, 2025 16:09
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. area/machinedeployment Issues or PRs related to machinedeployments cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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