Skip to content

Commit

Permalink
Export machine annotation key (#663)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ingvagabund authored and k8s-ci-robot committed Jan 9, 2019
1 parent 59a129b commit 63aeb27
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/controller/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ import (
)

const (
machineAnnotationKey = "cluster.k8s.io/machine"
// MachineAnnotationKey annotation used to link node and machine resource
MachineAnnotationKey = "cluster.k8s.io/machine"
)

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

val, ok := node.ObjectMeta.Annotations[machineAnnotationKey]
val, ok := node.ObjectMeta.Annotations[MachineAnnotationKey]
if !ok {
return nil
}
Expand Down Expand Up @@ -86,7 +87,7 @@ func (c *ReconcileNode) link(node *corev1.Node) error {
}

func (c *ReconcileNode) unlink(node *corev1.Node) error {
val, ok := node.ObjectMeta.Annotations[machineAnnotationKey]
val, ok := node.ObjectMeta.Annotations[MachineAnnotationKey]
if !ok {
return nil
}
Expand Down

0 comments on commit 63aeb27

Please sign in to comment.