Skip to content

Commit 6129e87

Browse files
committed
more conditions
1 parent 426b355 commit 6129e87

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

internal/controllers/machineset/machineset_status.go

+15-10
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,20 @@ func (r *Reconciler) reconcileStatus(_ context.Context, s *scope) {
4848
// Conditions
4949

5050
// MachinesReady
51-
if err := v1beta2conditions.SetAggregateCondition(s.machines, s.machineSet,
52-
clusterv1.MachineReadyV1Beta2Condition,
53-
v1beta2conditions.TargetConditionType(clusterv1.MachineSetMachinesReadyV1Beta2Condition),
54-
); err != nil {
51+
readyCondition, err := v1beta2conditions.NewAggregateCondition(
52+
s.machines, clusterv1.MachineReadyV1Beta2Condition,
53+
v1beta2conditions.TargetConditionType(clusterv1.MachineSetMachinesReadyV1Beta2Condition))
54+
if err != nil {
5555
v1beta2conditions.Set(s.machineSet, metav1.Condition{
5656
Type: clusterv1.MachineSetMachinesReadyV1Beta2Condition,
5757
Status: metav1.ConditionFalse,
5858
Reason: "TODOFailedDuringAggregation",
5959
Message: "something TODO at MachinesReady",
6060
})
61+
} else if readyCondition.Status == metav1.ConditionTrue {
62+
readyCondition.Message = "All Machines are ready."
6163
}
64+
v1beta2conditions.Set(s.machineSet, *readyCondition)
6265

6366
// MachinesUpToDate
6467
if err := v1beta2conditions.SetAggregateCondition(s.machines, s.machineSet,
@@ -126,9 +129,10 @@ func setScalingUpCondition(ms *clusterv1.MachineSet, machines []*clusterv1.Machi
126129
}
127130

128131
v1beta2conditions.Set(ms, metav1.Condition{
129-
Type: clusterv1.MachineSetScalingUpV1Beta2Condition,
130-
Status: metav1.ConditionFalse,
131-
Reason: "NotScalingUp", // TODO: create a const.
132+
Type: clusterv1.MachineSetScalingUpV1Beta2Condition,
133+
Status: metav1.ConditionFalse,
134+
Reason: "NotScalingUp", // TODO: create a const.
135+
Message: "MachineSet is not scaling up",
132136
})
133137
}
134138

@@ -150,9 +154,10 @@ func setScalingDownCondition(ms *clusterv1.MachineSet, machines []*clusterv1.Mac
150154

151155
if int32(len(machines)) <= (desiredReplicas) {
152156
v1beta2conditions.Set(ms, metav1.Condition{
153-
Type: clusterv1.MachineSetScalingDownV1Beta2Condition,
154-
Status: metav1.ConditionFalse,
155-
Reason: "NotScalingDown", // TODO: create a const.
157+
Type: clusterv1.MachineSetScalingDownV1Beta2Condition,
158+
Status: metav1.ConditionFalse,
159+
Reason: "NotScalingDown", // TODO: create a const.
160+
Message: "MachineSet is not scaling down",
156161
})
157162
return
158163
}

0 commit comments

Comments
 (0)