Skip to content

Commit

Permalink
Revert "[release-4.12] OCPBUGS-5413: Append annotations from machine …
Browse files Browse the repository at this point in the history
…template spec to the node"
  • Loading branch information
deepsm007 committed Jan 12, 2023
1 parent a99a63b commit 8490038
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 5 additions & 4 deletions FAQ.md
Original file line number Diff line number Diff line change
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 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 a 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 an Annotation or Label to a Machine, and later decide to remove it, you will need to remove it from the Machine first to prevent it from being reapplied, and then remove it from the Node object.
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.

### 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,6 +100,9 @@ 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 @@ -111,9 +114,7 @@ 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 unless added directly to the Machine.

If you wish to remove a taint from a 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.
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.

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
4 changes: 0 additions & 4 deletions pkg/controller/nodelink/nodelink_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,6 @@ func (r *ReconcileNodeLink) Reconcile(ctx context.Context, request reconcile.Req
modNode.Annotations = map[string]string{}
}
modNode.Annotations[machineAnnotationKey] = fmt.Sprintf("%s/%s", machine.GetNamespace(), machine.GetName())
for k, v := range machine.Spec.Annotations {
klog.V(4).Infof("Copying annotation %s = %s", k, v)
modNode.Annotations[k] = v
}

if modNode.Labels == nil {
modNode.Labels = map[string]string{}
Expand Down

0 comments on commit 8490038

Please sign in to comment.