Skip to content

Commit

Permalink
Update FAQ to describe annotation and label logic
Browse files Browse the repository at this point in the history
The FAQ says that Annotations, Labels and Taits are only added to the
node when it is created. This is not the case. They are appended to the
node if missing whenever the machine or its node is reconciled.
  • Loading branch information
RadekManak committed Jan 2, 2023
1 parent f132083 commit e90d2df
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions FAQ.md
Expand Up @@ -91,7 +91,7 @@ This is set via the MCO’s config, not the Machine-api. The config a Machine re
The user-data is generated by the installer. The Machine-api is just a consumer of the user-data and simply passes the data to the cloud. Refer to documentation for the Machine-config-operator (not part of the Machine-api) for creating new Machine pools and user-data.

## Adding Annotations and Labels to Nodes via Machines
Annotations and Labels are only added to Nodes via Machines at creation time. You can add arbitrary Annotations and Labels which are applied to Nodes immediately after they join the cluster. Adding subsequent Annotations and Labels on the Machine object (or in a MachineSet’s template) will have no effect on the Node.
Annotations and Labels are added to Nodes via Machines whenever the machine or its node is updated. You can add arbitrary Annotations and Labels which are applied to Nodes immediately after they join the cluster. Removing Annotations or Labels from Machine won't remove them from its node. If you want to add an Annotation or Label that you will later remove, consider adding it directly to the node object. If you add it to Machine, you will need to remove it from the machine first to prevent it from being reapplied, and then remove it from the node object.

### Which Annotations and Labels get added to Nodes?
MachineSets can be used to help mark the Machines and Nodes that are created from them by using Annotations and Labels. To do this you will need to add this information in various places on your MachineSet depending on where you would like this information. **Note** this information will only be applied to new Machines and Nodes created from the MachineSet, they will not be retroactively applied.
Expand All @@ -100,9 +100,6 @@ Setting Labels or Annotations in a MachineSet in its `.spec.template.metadata` f

Setting Labels or Annotations in the MachineSet resource's `.spec.template.spec.metadata` field will cause them to be applied to every Machine and Node object created from the MachineSet. In the case of Machine objects, these Labels and Annotations will be applied in resource's `.spec.metadata` field. For Node objects, these values will be applied to `.metadata` field.

Remember, after a Node is created, additional Annotations and Labels cannot be added via the
Machine or MachineSet and should be applied to the Node directly.

### Which Annotations and Labels won't get added to Nodes?
There are two other areas for Annotations and Labels that won't result in them being added to
the Node object after creation.
Expand All @@ -114,7 +111,9 @@ are applied to each Machine object, but not copied to the Node. In the case of
MachineSet, these are in the `.spec.template.metadata` field, or just the `.metadata` field when applied to an individual Machine.

## Adding Taints to Nodes via Machines
Similar to Annotations and Labels, MachineSets can be used to add Taints to the Machines and Nodes that it creates. To do this you will need to add the Taint information to your MachineSets. **Note** that these Taints will only be applied to the new Machines and Nodes created from the MachineSet, they will not be retroactively applied.
Similar to Annotations and Labels, MachineSets can be used to add Taints to the Machines and Nodes that it creates. To do this you will need to add the Taint information to your MachineSets. **Note** that these Taints will only be applied to the new Machines and Nodes created from the MachineSet, they will not be retroactively applied unless added directly to the Machine.

If you wish to remove taint from Node, you will need to remove it from the Machine first to prevent it from being reapplied, and then remove it from the node object.

Setting Taints in a MachineSet's `.spec.template.spec.taints` field will cause them to be applied to every Machine and Node object created from the MachineSet. In the case of Machine objects, the Taints will appear in `.spec.taints` field, and for Node objects they will be in the `.spec.taints` field.

Expand Down

0 comments on commit e90d2df

Please sign in to comment.