Skip to content

kubernetes-nodes: raising minReplicas does not raise the MachineDeployment's replicas on upgrade #4786

Open

Description

Raising minReplicas on an existing node pool does not raise the MachineDeployment's replicas, although the comment above spec in nodegroup.yaml says CAPI clamps the live value into [min, max] on update.

The clamp in CAPI's calculateMachineDeploymentReplicas (v1.10.1, internal/webhooks/machinedeployment.go) runs only when the incoming object has spec.replicas unset. helm-controller applies the chart through Helm's three-way merge, so the object the webhook sees still carries the live value, and the function returns it unchanged at its first check.

I saw this in the computeplane e2e suite. Its pool is first rendered with minReplicas: 0, then upgraded to min and max 2. After the upgrade the MachineDeployment had the min-size annotation at "2" and spec.replicas: 0. What then lifts such a pool is the cluster-autoscaler, through --enforce-node-group-min-size or a scale-up for pending pods. That path was deadlocked by a separate autoscaler defect, fixed in #4768.

With the autoscaler fixed the pool does reach its min, so this is mostly a wrong comment: the guarantee it describes holds for create, not for update. It also means a pool raised above its live size waits on the autoscaler's next loop rather than on the upgrade itself.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/needs-triageIndicates an issue needs triage by a maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions