canonical / cluster-api-control-plane-provider-microk8s

This project offers a cluster API control plane controller that manages the control plane of a MicroK8s cluster. It is expected to be used along with the respective MicroK8s specific machine bootstrap provider.
https://microk8s.io
7 stars 5 forks source link

Added support for control plane upgrades #29

Closed sachinkumarsingh092 closed 1 year ago

sachinkumarsingh092 commented 1 year ago

Summary

The worker nodes can do a rolling upgrade when we switch their versions due to the underlying Machinetemplates machinery. For the control plane, a lot of providers use kubeadm which has an inbuilt feature for these upgrades. In microk8s, we now implement the rolling upgrades by comparing the machines' versions (Major and minor only) and rolling out new machines based on the newer version. We scale up and down one-by-one, roll out a new versioned machine, and remove an older version of the machine.

Changes

We sort all the machines on the basis of their creation timestamp and take the first machine in them to be the older version and the last to be the newer version. We then find out about the older machines and remove them (scale down by one). The reconciler then rolls out newer versioned machines and this goes until an equi-versioned machine equilibrium. Once all the machines have the same version, the default scaling up and scaling down take place.