rancher / system-upgrade-controller

In your Kubernetes, upgrading your nodes
Apache License 2.0
676 stars 83 forks source link

Add a Complete condition to Plans when all nodes are up to date #291

Closed sfackler closed 4 months ago

sfackler commented 4 months ago

Is your feature request related to a problem? Please describe. It's currently a bit tricky to figure out if a Plan is "complete" - you need to check that every node matching the plan's selector has a plan.upgrade.cattle.io/my-job label matching the plan's latestHash. While this is doable, I don't think it can be done in a one-liner, and in particular means that you can't kubectl wait on a plan completing.

Describe the solution you'd like It'd be great if the SUC would add a Complete: True condition to the plan when all of the selected nodes have completed the current revision of the plan. This would align with e.g. the k8s Job's conditions and allow you to easily wait on completion: kubectl wait --for=condition=Complete plan my-plan.

Describe alternatives you've considered Some things like rke2-upgrade try to do this by looking at the status.applying field, but that seems a bit racy - you might load the plan before it's been mutated by the SUC and think it's complete.

Additional context Unlike a job, a plan can transition out of the completed state if new nodes start to match the plan's selector but I don't think that's too surprising.

brandond commented 4 months ago

This sounds useful. A PR would be appreciated!

sfackler commented 4 months ago

Will do!