@@ -42,39 +42,17 @@ func (r *Reconciler) reconcileStatus(_ context.Context, s *scope) {
42
42
// - ScalingUp
43
43
// - ScalingDown
44
44
setReplicas (s .machineSet , s .machines )
45
- setScalingUpCondition (s .machineSet , s .machines )
46
- setScalingDownCondition (s .machineSet , s .machines )
47
45
48
46
// Conditions
49
47
50
- // MachinesReady
51
- readyCondition , err := v1beta2conditions .NewAggregateCondition (
52
- s .machines , clusterv1 .MachineReadyV1Beta2Condition ,
53
- v1beta2conditions .TargetConditionType (clusterv1 .MachineSetMachinesReadyV1Beta2Condition ))
54
- if err != nil {
55
- v1beta2conditions .Set (s .machineSet , metav1.Condition {
56
- Type : clusterv1 .MachineSetMachinesReadyV1Beta2Condition ,
57
- Status : metav1 .ConditionFalse ,
58
- Reason : "TODOFailedDuringAggregation" ,
59
- Message : "something TODO at MachinesReady" ,
60
- })
61
- } else if readyCondition .Status == metav1 .ConditionTrue {
62
- readyCondition .Message = "All Machines are ready."
63
- }
64
- v1beta2conditions .Set (s .machineSet , * readyCondition )
48
+ // Update the ScalingUp and ScalingDown condition, which requires the above setReplicas function.
49
+ setScalingUpCondition (s .machineSet , s .machines )
50
+ setScalingDownCondition (s .machineSet , s .machines )
65
51
52
+ // MachinesReady
53
+ setMachinesReadyCondition (s .machineSet , s .machines )
66
54
// MachinesUpToDate
67
- if err := v1beta2conditions .SetAggregateCondition (s .machines , s .machineSet ,
68
- clusterv1 .MachinesUpToDateV1Beta2Condition ,
69
- v1beta2conditions .TargetConditionType (clusterv1 .MachineSetMachinesUpToDateV1Beta2Condition ),
70
- ); err != nil {
71
- v1beta2conditions .Set (s .machineSet , metav1.Condition {
72
- Type : clusterv1 .MachineSetMachinesUpToDateV1Beta2Condition ,
73
- Status : metav1 .ConditionFalse ,
74
- Reason : "TODOFailedDuringAggregation" ,
75
- Message : "something TODO on MachinesUpToDate" ,
76
- })
77
- }
55
+ setMachinesUpToDateCondition (s .machineSet , s .machines )
78
56
79
57
// Deleting
80
58
setDeletingCondition (s .machineSet )
@@ -176,6 +154,38 @@ func setScalingDownCondition(ms *clusterv1.MachineSet, machines []*clusterv1.Mac
176
154
})
177
155
}
178
156
157
+ func setMachinesReadyCondition (machineSet * clusterv1.MachineSet , machines []* clusterv1.Machine ) {
158
+ readyCondition , err := v1beta2conditions .NewAggregateCondition (
159
+ machines , clusterv1 .MachineReadyV1Beta2Condition ,
160
+ v1beta2conditions .TargetConditionType (clusterv1 .MachineSetMachinesReadyV1Beta2Condition ))
161
+ if err != nil {
162
+ v1beta2conditions .Set (machineSet , metav1.Condition {
163
+ Type : clusterv1 .MachineSetMachinesReadyV1Beta2Condition ,
164
+ Status : metav1 .ConditionFalse ,
165
+ Reason : "TODOFailedDuringAggregation" ,
166
+ Message : "something TODO at MachinesReady" ,
167
+ })
168
+ } else if readyCondition .Status == metav1 .ConditionTrue {
169
+ readyCondition .Message = "All Machines are ready."
170
+ }
171
+ v1beta2conditions .Set (machineSet , * readyCondition )
172
+ }
173
+
174
+ func setMachinesUpToDateCondition (machineSet * clusterv1.MachineSet , machines []* clusterv1.Machine ) {
175
+ if err := v1beta2conditions .SetAggregateCondition (machines , machineSet ,
176
+ clusterv1 .MachinesUpToDateV1Beta2Condition ,
177
+ v1beta2conditions .TargetConditionType (clusterv1 .MachineSetMachinesUpToDateV1Beta2Condition ),
178
+ ); err != nil {
179
+ v1beta2conditions .Set (machineSet , metav1.Condition {
180
+ Type : clusterv1 .MachineSetMachinesUpToDateV1Beta2Condition ,
181
+ Status : metav1 .ConditionFalse ,
182
+ Reason : "TODOFailedDuringAggregation" ,
183
+ Message : "something TODO on MachinesUpToDate" ,
184
+ })
185
+ }
186
+
187
+ }
188
+
179
189
func setDeletingCondition (ms * clusterv1.MachineSet ) {
180
190
if ! ms .DeletionTimestamp .IsZero () {
181
191
v1beta2conditions .Set (ms , metav1.Condition {
0 commit comments