1
1
# Metadata propagation
2
2
Cluster API controllers implement consistent metadata (labels & annotations) propagation across the core API resources.
3
3
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.
5
31
6
32
## KubeadmControlPlane
7
33
Top-level labels and annotations do not propagate at all.
8
34
- ` .labels ` => Not propagated.
9
35
- ` .annotations ` => Not propagated.
10
36
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.
12
38
- ` .spec.machineTemplate.metadata.labels ` => ` Machine.labels ` , ` InfraMachine.labels ` , ` BootstrapConfig.labels `
13
39
- ` .spec.machineTemplate.metadata.annotations ` => ` Machine.annotations ` , ` InfraMachine.annotations ` , ` BootstrapConfig.annotations `
14
40
15
41
## MachineDeployment
16
42
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.
18
44
- ` .labels ` => Not propagated.
19
45
- ` .annotations ` => MachineSet.annotations
20
46
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.
23
49
- ` .spec.template.metadata.labels ` => ` MachineSet.labels ` , ` MachineSet.spec.template.metadata.labels `
24
50
- ` .spec.template.metadata.annotations ` => ` MachineSet.spec.template.metadata.annotations `
25
51
@@ -28,6 +54,18 @@ Top-level labels and annotations do not propagate at all.
28
54
- ` .labels ` => Not propagated.
29
55
- ` .annotations ` => Not propagated.
30
56
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.
32
58
- ` .spec.template.metadata.labels ` => ` Machine.labels ` , ` InfraMachine.labels ` , ` BootstrapConfig.labels `
33
59
- ` .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
+
0 commit comments