Skip to content

Commit 0a0a965

Browse files
committed
fixes
1 parent 2977fbf commit 0a0a965

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

internal/controllers/machineset/machineset_controller_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,10 @@ func TestMachineSetReconcile(t *testing.T) {
624624
Client: c,
625625
recorder: rec,
626626
}
627-
_, _ = msr.Reconcile(ctx, request)
627+
res, err := msr.Reconcile(ctx, request)
628628
g.Eventually(rec.Events).Should(Receive())
629+
_ = res
630+
_ = err
629631
})
630632

631633
t.Run("reconcile successfully when labels are missing", func(t *testing.T) {

internal/controllers/machineset/machineset_status.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ import (
3535
// comply with the recommendation in the Kubernetes API guidelines.
3636
// Note: v1beta1 conditions are not managed by this func.
3737
func (r *Reconciler) reconcileStatus(_ context.Context, s *scope) {
38-
if s.machineSet.Status.V1Beta2 == nil {
39-
s.machineSet.Status.V1Beta2 = &clusterv1.MachineSetV1Beta2Status{}
40-
}
41-
4238
// Update the following fields in status from the machines list.
4339
// - ReadyReplicas
4440
// - AvailableReplicas
@@ -77,6 +73,10 @@ func setReplicas(ms *clusterv1.MachineSet, machines []*clusterv1.Machine) {
7773
}
7874
}
7975

76+
if ms.Status.V1Beta2 == nil {
77+
ms.Status.V1Beta2 = &clusterv1.MachineSetV1Beta2Status{}
78+
}
79+
8080
ms.Status.V1Beta2.ReadyReplicas = ptr.To(readyReplicas)
8181
ms.Status.V1Beta2.AvailableReplicas = ptr.To(availableReplicas)
8282
}
@@ -225,6 +225,7 @@ func setMachinesReadyCondition(machineSet *clusterv1.MachineSet, machines []*clu
225225
Reason: clusterv1.MachineSetMachineInvalidConditionReportedV1Beta2Reason,
226226
Message: err.Error(),
227227
})
228+
return
228229
}
229230

230231
// Overwrite the message for the true case.

0 commit comments

Comments
 (0)