Repository navigation
Commit 124ecf2
committed
CKS: restart the nodes of a cluster with new node settings, a few at a time
A CloudManaged Kubernetes cluster could get a new service offering only
through a scale, which changes every node at once with no drain, its
affinity groups only while stopped, and its root disk size not at all.
updateKubernetesCluster sets, for each node type (control, worker,
etcd), the service offering, the root disk size and the affinity
groups. The nodes created from then on get them. A cluster created
before its node types had settings of their own first gets the service
offering of the cluster copied to them; templates are left as they are.
With rollout=true, the nodes that differ from the settings of their
type are restarted with them: the external etcd nodes, then the control
nodes, one at a time, then the worker nodes, maxunavailable at a time
(1 by default, and always leaving a worker running). For each batch:
- every other node must be running and Ready, and a control or etcd
node is only taken down if the others keep a quorum
- each Kubernetes node is annotated with its boot ID, unless someone
else cordoned it, then cordoned and drained
- its VM is stopped, given the offering, a larger root disk and the
affinity groups, and started, which places it by its new groups;
cloud-init grows the root partition and file system at boot
- once it is Ready with another boot ID, and etcd is healthy, it is
uncordoned and the annotation removed
A control or etcd node type with too few nodes to lose one (a single
control node, a 2-node stacked control plane, 2 etcd nodes) can not be
rolled: a rollout=true that would make one of its nodes differ from the
settings is refused, and its nodes that differ anyway are left out and
reported in lasterror, while the other types are still rolled.
Nodes are restarted rather than changed live, which CloudStack can not
do reliably for a KVM VM, and which would leave the guest and kubelet
unaware of the new resources.
Nothing else is recorded: the nodes that still differ, are stopped or
carry the annotation are the work left, and go first when the rollout
is run again, which is how one that failed is resumed. However a rollout
ends, it uncordons the nodes that are back, leaving the others cordoned,
counts the CPU cores and memory of the cluster from its VMs, and moves
the cluster from the new Updating state to Running, or to Alert if it is
not healthy. Why it stopped is shown as lasterror. cancelrollout=true
stops a rollout between two batches. Other operations are refused while
a cluster is Updating, and the state scanner moves a cluster left
Updating by a management server that stopped to Alert.
The response also shows the number of nodes of each type that differ
from the settings of their type.
Signed-off-by: Brad House <bhouse@nexthop.ai>1 parent 8a8b89e commit 124ecf2
19 files changed
Lines changed: 3009 additions & 25 deletions
File tree
- api/src/main/java
- com/cloud/kubernetes/cluster
- org/apache/cloudstack/api
- engine/schema/src/main/resources/META-INF/db
- plugins/integrations/kubernetes-service/src
- main/java
- com/cloud/kubernetes/cluster
- actionworkers
- dao
- utils
- org/apache/cloudstack/api
- command/user/kubernetes/cluster
- response
- test/java
- com/cloud/kubernetes/cluster
- actionworkers
- org/apache/cloudstack/api/command/user/kubernetes/cluster
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
111 | 119 | | |
112 | 120 | | |
113 | 121 | | |
| |||
155 | 163 | | |
156 | 164 | | |
157 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
158 | 169 | | |
159 | 170 | | |
160 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1324 | 1324 | | |
1325 | 1325 | | |
1326 | 1326 | | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
1327 | 1337 | | |
1328 | 1338 | | |
1329 | 1339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
0 commit comments