Skip to content

Commit 63aeb27

Browse files
ingvagabundk8s-ci-robot
authored andcommitted
Export machine annotation key (#663)
The node controller is not the only consumer of the machine annotation. Other consumers like cluster autoscaler or controller annotating nodes with machine reuses the same literal. All consumers should be allow to import the variable instead of defining the same literal locally.
1 parent 59a129b commit 63aeb27

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/controller/node/node.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ import (
3131
)
3232

3333
const (
34-
machineAnnotationKey = "cluster.k8s.io/machine"
34+
// MachineAnnotationKey annotation used to link node and machine resource
35+
MachineAnnotationKey = "cluster.k8s.io/machine"
3536
)
3637

37-
// We are using "machine" annotation to link node and machine resource. The "machine"
38+
// We are using "cluster.k8s.io/machine" annotation to link node and machine resource. The "cluster.k8s.io/machine"
3839
// annotation is an implementation detail of how the two objects can get linked together, but it is
3940
// not required behavior. However, in the event that a Machine.Spec update requires replacing the
4041
// Node, this can allow for faster turn-around time by allowing a new Node to be created with a new
@@ -52,7 +53,7 @@ func (c *ReconcileNode) link(node *corev1.Node) error {
5253
}
5354
}
5455

55-
val, ok := node.ObjectMeta.Annotations[machineAnnotationKey]
56+
val, ok := node.ObjectMeta.Annotations[MachineAnnotationKey]
5657
if !ok {
5758
return nil
5859
}
@@ -86,7 +87,7 @@ func (c *ReconcileNode) link(node *corev1.Node) error {
8687
}
8788

8889
func (c *ReconcileNode) unlink(node *corev1.Node) error {
89-
val, ok := node.ObjectMeta.Annotations[machineAnnotationKey]
90+
val, ok := node.ObjectMeta.Annotations[MachineAnnotationKey]
9091
if !ok {
9192
return nil
9293
}

0 commit comments

Comments
 (0)