Skip to content

Commit

Permalink
Add the node's UID to the machine's noderef.
Browse files Browse the repository at this point in the history
  • Loading branch information
spew committed Jun 14, 2018
1 parent ca0cee6 commit 46718d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/controller/machine/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ func (c *MachineControllerImpl) reconcileNode(key string) error {
}

func objectRef(node *corev1.Node) *corev1.ObjectReference {
glog.Errorf("updating object reference for node: %v, %v", node.ObjectMeta.Name, node.UID)
return &corev1.ObjectReference{
Kind: "Node",
Name: node.ObjectMeta.Name,
UID: node.UID,
}
}
4 changes: 4 additions & 0 deletions pkg/controller/machine/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func TestReconcileNode(t *testing.T) {
node := &corev1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "bar",
UID: "the-uid",
Annotations: make(map[string]string),
},
}
Expand Down Expand Up @@ -240,6 +241,9 @@ func TestReconcileNode(t *testing.T) {
if actualMachine.Status.NodeRef.Name != "bar" {
t.Errorf("got %v node ref name, expected bar node ref name.", actualMachine.Status.NodeRef.Name)
}
if actualMachine.Status.NodeRef.UID != "the-uid" {
t.Errorf("got '%v' node ref uid, expected 'the-uid' node ref uid", actualMachine.Status.NodeRef.UID)
}
}
if !test.expectLinked {
if actualMachine != nil && actualMachine.Status.NodeRef != nil {
Expand Down

0 comments on commit 46718d6

Please sign in to comment.