Skip to content

Commit 9f45df1

Browse files
authored
Merge pull request #8319 from ykakarap/node-label-docs-update
📖 update book on in-place propagation
2 parents 87a1c9d + 8405ec5 commit 9f45df1

11 files changed

+106
-17
lines changed

docs/book/src/developer/architecture/controllers/machine-deployment.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@ Its main responsibilities are:
1111
* Updating the status of MachineDeployment objects
1212

1313
![](../../../images/cluster-admission-machinedeployment-controller.png)
14+
15+
## In-place propagation
16+
Changes to the following fields of the MachineDeployment are propagated in-place to the MachineSet and do not trigger a full rollout:
17+
- `.annotations`
18+
- `.spec.template.metadata.labels`
19+
- `.spec.template.metadata.annotations`
20+
- `.spec.minReadySeconds`
21+
- `.spec.template.spec.nodeDrainTimeout`
22+
- `.spec.template.spec.nodeDeletionTimeout`
23+
- `.spec.template.spec.nodeVolumeDetachTimeout`
24+
- `.spec.strategy.rollingUpdate.deletePolicy`
25+
26+
Note: In cases where changes to any of these fields are paired with rollout causing changes, the new values are propagated only to the new MachineSet.
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MachineSet
22

3-
A MachineSet is an immutable abstraction over [Machines](./machine.md).
3+
A MachineSet is an abstraction over [Machines](./machine.md).
44

55
Its main responsibilities are:
66
* Adopting unowned Machines that aren't assigned to a MachineSet
@@ -9,3 +9,17 @@ Its main responsibilities are:
99
* Monitoring the status of those booted machines
1010

1111
![](../../../images/cluster-admission-machineset-controller.png)
12+
13+
## In-place propagation
14+
Changes to the following fields of MachineSet are propagated in-place to the Machine without needing a full rollout:
15+
- `.spec.template.metadata.labels`
16+
- `.spec.template.metadata.annotations`
17+
- `.spec.template.spec.nodeDrainTimeout`
18+
- `.spec.template.spec.nodeDeletionTimeout`
19+
- `.spec.template.spec.nodeVolumeDetachTimeout`
20+
21+
Changes to the following fields of MachineSet are propagated in-place to the InfrastructureMachine and BootstrapConfig:
22+
- `.spec.machineTemplate.metadata.labels`
23+
- `.spec.machineTemplate.metadata.annotations`
24+
25+
Note: Changes to these fields will not be propagated to Machines that are marked for deletion (example: because of scale down).
Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,51 @@
11
# Metadata propagation
22
Cluster API controllers implement consistent metadata (labels & annotations) propagation across the core API resources.
33
This behaviour tries to be consistent with Kubernetes apps/v1 Deployment and ReplicaSet.
4-
New providers should behave accordingly fitting within the following pattern:
4+
New providers should behave accordingly fitting within the following pattern:
5+
6+
![](../../../images/metadata-propagation.jpg)
7+
8+
## Cluster Topology
9+
ControlPlaneTopology labels are labels and annotations are continuously propagated to ControlPlane top-level labels and annotations
10+
and ControlPlane MachineTemplate labels and annotations.
11+
- `.spec.topology.controlPlane.metadata.labels` => `ControlPlane.labels`, `ControlPlane.spec.machineTemplate.metadata.labels`
12+
- `.spec.topology.controlPlane.metadata.annotations` => `ControlPlane.annotations`, `ControlPlane.spec.machineTemplate.metadata.annotations`
13+
14+
MachineDeploymentTopology labels and annotations are continuously propagated to MachineDeployment top-level labels and annotations
15+
and MachineDeployment MachineTemplate labels and annotations.
16+
- `.spec.topology.machineDeployments[i].metadata.labels` => `MachineDeployment.labels`, `MachineDeployment.spec.template.metadata.labels`
17+
- `.spec.topology.machineDeployments[i].metadata.annotations` => `MachineDeployment.annotations`, `MachineDeployment.spec.template.metadata.annotations`
18+
19+
## ClusterClass
20+
ControlPlaneClass labels are labels and annotations are continuously propagated to ControlPlane top-level labels and annotations
21+
and ControlPlane MachineTemplate labels and annotations.
22+
- `.spec.controlPlane.metadata.labels` => `ControlPlane.labels`, `ControlPlane.spec.machineTemplate.metadata.labels`
23+
- `.spec.controlPlane.metadata.annotations` => `ControlPlane.annotations`, `ControlPlane.spec.machineTemplate.metadata.annotations`
24+
Note: ControlPlaneTopology labels and annotations take precedence over ControlPlaneClass labels and annotations.
25+
26+
MachineDeploymentClass labels and annotations are continuously propagated to MachineDeployment top-level labels and annotations
27+
and MachineDeployment MachineTemplate labels and annotations.
28+
- `.spec.workers.machineDeployments[i].template.metadata.labels` => `MachineDeployment.labels`, `MachineDeployment.spec.template.metadata.labels`
29+
- `.spec.worker.machineDeployments[i].template.metadata.annotations` => `MachineDeployment.annotations`, `MachineDeployment.spec.template.metadata.annotations`
30+
Note: MachineDeploymentTopology labels and annotations take precedence over MachineDeploymentClass labels and annotations.
531

632
## KubeadmControlPlane
733
Top-level labels and annotations do not propagate at all.
834
- `.labels` => Not propagated.
935
- `.annotations` => Not propagated.
1036

11-
MachineTemplate labels and annotations propagate to Machines, InfraMachines and BootstrapConfigs.
37+
MachineTemplate labels and annotations continuously propagate to new and existing Machines, InfraMachines and BootstrapConfigs.
1238
- `.spec.machineTemplate.metadata.labels` => `Machine.labels`, `InfraMachine.labels`, `BootstrapConfig.labels`
1339
- `.spec.machineTemplate.metadata.annotations` => `Machine.annotations`, `InfraMachine.annotations`, `BootstrapConfig.annotations`
1440

1541
## MachineDeployment
1642
Top-level labels do not propagate at all.
17-
Top-level annotations propagate to MachineSets top-level annotations.
43+
Top-level annotations continuously propagate to MachineSets top-level annotations.
1844
- `.labels` => Not propagated.
1945
- `.annotations` => MachineSet.annotations
2046

21-
Template labels propagate to MachineSets top-level and MachineSets template metadata.
22-
Template annotations propagate to MachineSets template metadata.
47+
Template labels continuously propagate to MachineSets top-level and MachineSets template metadata.
48+
Template annotations continuously propagate to MachineSets template metadata.
2349
- `.spec.template.metadata.labels` => `MachineSet.labels`, `MachineSet.spec.template.metadata.labels`
2450
- `.spec.template.metadata.annotations` => `MachineSet.spec.template.metadata.annotations`
2551

@@ -28,6 +54,18 @@ Top-level labels and annotations do not propagate at all.
2854
- `.labels` => Not propagated.
2955
- `.annotations` => Not propagated.
3056

31-
Template labels and annotations propagate to Machines, InfraMachines and BootstrapConfigs.
57+
Template labels and annotations continuously propagate to new and existing Machines, InfraMachines and BootstrapConfigs.
3258
- `.spec.template.metadata.labels` => `Machine.labels`, `InfraMachine.labels`, `BootstrapConfig.labels`
3359
- `.spec.template.metadata.annotations` => `Machine.annotations`, `InfraMachine.annotations`, `BootstrapConfig.annotations`
60+
61+
## Machine
62+
Top-level labels that meet a specific cretria are propagated to the Node labels and top-level annotatation are not propagated.
63+
- `.labels.[label-meets-criteria]` => `Node.labels`
64+
- `.annotations` => Not propagated.
65+
66+
Label should meet one of the following criterias to propate to Node:
67+
- Has `node-role.kubernetes.io` as prefix.
68+
- Belongs to `node-restriction.kubernetes.io` domain.
69+
- Belongs to `node.cluster.x-k8s.io` domain.
70+
71+

docs/book/src/images/cluster-admission-machinedeployment-controller.plantuml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ repeat
2121
else
2222
if (RollingUpdate Deployment Strategy) then (yes)
2323
:Select newest MachineSet;
24+
:Propagate in-place changes to newest MachineSet;
2425
if (Too Many replicas) then (yes)
2526
#LightBlue:Scale machineSet down;
2627
elseif (Not Enough Replicas)
@@ -33,6 +34,7 @@ repeat
3334
endif
3435
elseif (OnDelete Deployment Strategy) then (yes)
3536
:Select newest MachineSet;
37+
:Propagate in-place changes to newest MachineSet;
3638
if (Too Many replicas) then (yes)
3739
#LightBlue:Scale machineSet down;
3840
elseif (Not Enough Replicas)
2.92 KB
Loading

docs/book/src/images/cluster-admission-machineset-controller.plantuml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ repeat
1111
#LightBlue:Adopt machine;
1212
endif
1313
repeat while (More machines) is (yes)
14+
:Propagate in-place changes to existing Machines;
1415
if (Not enough replicas) then (yes)
1516
#LightBlue:Boot new machine;
1617
elseif (Too many replicas) then (yes)
2.4 KB
Loading
170 KB
Loading
37.1 KB
Binary file not shown.

docs/book/src/tasks/control-plane/kubeadm-control-plane.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,19 @@ Cluster API Machines:
3737
[Machine Deletion Phase Hooks proposal](https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20200602-machine-deletion-phase-hooks.md)
3838
for additional details.
3939

40+
### In-place propagation
41+
Changes to the following fields of KubeadmControlPlane are propagated in-place to the Machines and do not trigger a full rollout:
42+
- `.spec.machineTemplate.metadata.labels`
43+
- `.spec.machineTemplate.metadata.annotations`
44+
- `.spec.nodeDrainTimeout`
45+
- `.spec.nodeDeletionTimeout`
46+
- `.spec.nodeVolumeDetachTimeout`
47+
48+
Changes to the following fields of KubeadmControlPlane are propagated in-place to the InfrastructureMachine and KubeadmConfig:
49+
- `.spec.machineTemplate.metadata.labels`
50+
- `.spec.machineTemplate.metadata.annotations`
51+
52+
Note: Changes to these fields will not be propagated to Machines, InfraMachines and KubeadmConfigs that are marked for deletion (example: because of scale down).
53+
4054
<!-- links -->
4155
[upgrades]: ../upgrading-clusters.md#how-to-upgrade-the-kubernetes-control-plane-version

0 commit comments

Comments
 (0)