🐛 Filter machines being deleted from updatedReplicas count #575
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
UpToDateMachines
method operates onc.Machines
and removes the result ofc.MachinesNeedingRollout()
from it. This result doesn't include machines being deleted becauseMachinesNeedingRollout
method removes them in the beginning of the definition using:Thus duplication of code to ensure machines being deleted aren't calculated in updatedReplicas
Which issue(s) this PR fixes:
Fixes #355
Special notes for your reviewer:
The way I kept a tab on the
updatedReplicas
count was using below commands (in separate terminals, of course):$ watch -c -n1 "kubectl get rke2controlplane rke2-docker-control-plane -o json | jq '{observedGeneration: .status.observedGeneration, ready: .status.ready, readyReplicas: .status.readyReplicas, replicas: .status.replicas, updatedReplicas: .status.updatedReplicas}'" $ watch -n1 kubectl get machines -l cluster.x-k8s.io/control-plane=
And for testing purpose I used Docker example in CAPRKE2 docs. Changing the replicas for the rke2controlplane resource or the version of RKE2 will trigger deletion of the machines.
Checklist: