Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Oct 16, 2024
1 parent 2977fbf commit 0a0a965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,10 @@ func TestMachineSetReconcile(t *testing.T) {
Client: c,
recorder: rec,
}
_, _ = msr.Reconcile(ctx, request)
res, err := msr.Reconcile(ctx, request)
g.Eventually(rec.Events).Should(Receive())
_ = res
_ = err
})

t.Run("reconcile successfully when labels are missing", func(t *testing.T) {
Expand Down
9 changes: 5 additions & 4 deletions internal/controllers/machineset/machineset_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ import (
// comply with the recommendation in the Kubernetes API guidelines.
// Note: v1beta1 conditions are not managed by this func.
func (r *Reconciler) reconcileStatus(_ context.Context, s *scope) {
if s.machineSet.Status.V1Beta2 == nil {
s.machineSet.Status.V1Beta2 = &clusterv1.MachineSetV1Beta2Status{}
}

// Update the following fields in status from the machines list.
// - ReadyReplicas
// - AvailableReplicas
Expand Down Expand Up @@ -77,6 +73,10 @@ func setReplicas(ms *clusterv1.MachineSet, machines []*clusterv1.Machine) {
}
}

if ms.Status.V1Beta2 == nil {
ms.Status.V1Beta2 = &clusterv1.MachineSetV1Beta2Status{}
}

ms.Status.V1Beta2.ReadyReplicas = ptr.To(readyReplicas)
ms.Status.V1Beta2.AvailableReplicas = ptr.To(availableReplicas)
}
Expand Down Expand Up @@ -225,6 +225,7 @@ func setMachinesReadyCondition(machineSet *clusterv1.MachineSet, machines []*clu
Reason: clusterv1.MachineSetMachineInvalidConditionReportedV1Beta2Reason,
Message: err.Error(),
})
return
}

// Overwrite the message for the true case.
Expand Down

0 comments on commit 0a0a965

Please sign in to comment.