Skip to content

Commit bca2579

Browse files
committed
Add comment elucidating the need for exclusion of terminating machines
1 parent 73e4577 commit bca2579

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pkg/controller/machineset.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,13 @@ func (c *controller) manageReplicas(ctx context.Context, allMachines []*v1alpha1
340340
machinesWithoutUpdateSuccessfulLabel []*v1alpha1.Machine
341341
)
342342
for _, m := range allMachines {
343+
// Machines that are terminating are skipped when computing the diff for the required
344+
// machineSet replicas since either:
345+
// 1. There was a scale-down event that led to the machine being marked for removal,
346+
// in which case there's no need to process it for further iterations; or
347+
// 2. This was a `failed` machine that was terminated in which case the machineSet
348+
// replicas won't change and hence there's a new machine that should be spawned
349+
// in place of the failed one.
343350
if m.Status.CurrentStatus.Phase != v1alpha1.MachineTerminating {
344351
numNonTerminatingMachines++
345352
if m.Labels[v1alpha1.LabelKeyNodeUpdateResult] != v1alpha1.LabelValueNodeUpdateSuccessful {

0 commit comments

Comments
 (0)