Skip to content

Commit aa892ef

Browse files
Merge pull request #575 from dharmit/fix-355
🐛 Filter machines being deleted from updatedReplicas count
2 parents ce1ae57 + 3dc3103 commit aa892ef

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pkg/rke2/control_plane.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,18 @@ func (c *ControlPlane) MachinesNeedingRollout() collections.Machines {
298298
)
299299
}
300300

301-
// UpToDateMachines returns the machines that are up to date with the control
301+
// UpToDateMachines returns the machines that are up-to-date with the control
302302
// plane's configuration and therefore do not require rollout.
303303
func (c *ControlPlane) UpToDateMachines() collections.Machines {
304-
return c.Machines.Difference(c.MachinesNeedingRollout())
304+
// Ignore machines to be deleted.
305+
machines := c.Machines.Filter(collections.Not(collections.HasDeletionTimestamp))
306+
// Filter machines if they are scheduled for rollout or if with an outdated configuration.
307+
machines.AnyFilter(
308+
// Machines that do not match with RCP config.
309+
collections.Not(matchesRCPConfiguration(c.infraResources, c.rke2Configs, c.RCP)),
310+
)
311+
312+
return machines.Difference(c.MachinesNeedingRollout())
305313
}
306314

307315
// getInfraResources fetches the external infrastructure resource for each machine in the collection

0 commit comments

Comments
 (0)