Skip to content

Commit 1bfe0b4

Browse files
committed
review fixes
1 parent 81c0296 commit 1bfe0b4

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

internal/controllers/machine/machine_controller_noderef.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,10 @@ func (r *Reconciler) patchNode(ctx context.Context, remoteClient client.Client,
311311
} else {
312312
hasTaintChanges = taints.RemoveNodeTaint(newNode, clusterv1.NodeOutdatedRevisionTaint) || hasTaintChanges
313313
}
314+
}
314315

315-
if !hasAnnotationChanges && !hasLabelChanges && !hasTaintChanges {
316-
return nil
317-
}
316+
if !hasAnnotationChanges && !hasLabelChanges && !hasTaintChanges {
317+
return nil
318318
}
319319

320320
return remoteClient.Patch(ctx, newNode, client.StrategicMergeFrom(node))

internal/controllers/machine/machine_controller_noderef_test.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,18 @@ func TestPatchNode(t *testing.T) {
780780
Name: fmt.Sprintf("node-%s", util.RandomString(6)),
781781
},
782782
},
783+
newLabels: map[string]string{
784+
"label-from-machine": "foo",
785+
},
786+
newAnnotations: map[string]string{
787+
"annotation-from-machine": "foo",
788+
},
789+
expectedLabels: map[string]string{
790+
"label-from-machine": "foo",
791+
},
783792
expectedAnnotations: map[string]string{
784-
clusterv1.LabelsFromMachineAnnotation: "",
793+
"annotation-from-machine": "foo",
794+
clusterv1.LabelsFromMachineAnnotation: "label-from-machine",
785795
},
786796
expectedTaints: []corev1.Taint{
787797
{Key: "node.kubernetes.io/not-ready", Effect: "NoSchedule"}, // Added by the API server

0 commit comments

Comments
 (0)