Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Filter machines being deleted from updatedReplicas count #575

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

dharmit
Copy link
Contributor

@dharmit dharmit commented Feb 18, 2025

What this PR does / why we need it:
UpToDateMachines method operates on c.Machines and removes the result of c.MachinesNeedingRollout() from it. This result doesn't include machines being deleted because MachinesNeedingRollout method removes them in the beginning of the definition using:

// Ignore machines to be deleted.
machines := c.Machines.Filter(collections.Not(collections.HasDeletionTimestamp))

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:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@dharmit dharmit added the kind/bug Something isn't working label Feb 18, 2025
@dharmit dharmit requested a review from a team as a code owner February 18, 2025 15:26
@kkaempf kkaempf added this to the v0.12.0 milestone Feb 18, 2025
Copy link
Member

@alexander-demicev alexander-demicev left a comment

Choose a reason for hiding this comment

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

thanks!

@furkatgofurov7
Copy link
Contributor

@dharmit can you please sign the commit?

@furkatgofurov7 furkatgofurov7 changed the title Filter machines being deleted from updatedReplicas count 🐛 Filter machines being deleted from updatedReplicas count Feb 20, 2025
UpToDateMachines method operates on `c.Machines` and removes the result
of `c.MachinesNeedingRollout()` from it. This result doesn't include
machines being deleted because MachinesNeedingRollout method removes
them in the beginning of the definition using:

```go
// Ignore machines to be deleted.
machines := c.Machines.Filter(collections.Not(collections.HasDeletionTimestamp))
```

Thus duplication of code to ensure machines being deleted aren't
calculated in updatedReplicas
Copy link
Contributor

@furkatgofurov7 furkatgofurov7 left a comment

Choose a reason for hiding this comment

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

Thanks!

@furkatgofurov7 furkatgofurov7 merged commit aa892ef into rancher:main Feb 20, 2025
5 checks passed
@dharmit dharmit deleted the fix-355 branch February 20, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Controller reports innacurate UpdatedReplicas count
4 participants