@@ -114,6 +114,7 @@ func setBootstrapReadyCondition(_ context.Context, machine *clusterv1.Machine, b
114
114
Status : metav1 .ConditionUnknown ,
115
115
Reason : clusterv1 .MachineBootstrapConfigInternalErrorV1Beta2Reason ,
116
116
Message : "Please check controller logs for errors" ,
117
+ // NOTE: the error is logged by reconcileBootstrap.
117
118
})
118
119
return
119
120
}
@@ -169,6 +170,7 @@ func setInfrastructureReadyCondition(_ context.Context, machine *clusterv1.Machi
169
170
Status : metav1 .ConditionUnknown ,
170
171
Reason : clusterv1 .MachineInfrastructureInternalErrorV1Beta2Reason ,
171
172
Message : "Please check controller logs for errors" ,
173
+ // NOTE: the error is logged by reconcileInfrastructure.
172
174
})
173
175
return
174
176
}
@@ -276,13 +278,15 @@ func setNodeHealthyAndReadyConditions(ctx context.Context, machine *clusterv1.Ma
276
278
Status : metav1 .ConditionUnknown ,
277
279
Reason : clusterv1 .MachineNodeInternalErrorV1Beta2Reason ,
278
280
Message : "Please check controller logs for errors" ,
281
+ // NOTE: the error is logged by reconcileNode.
279
282
})
280
283
281
284
v1beta2conditions .Set (machine , metav1.Condition {
282
285
Type : clusterv1 .MachineNodeHealthyV1Beta2Condition ,
283
286
Status : metav1 .ConditionUnknown ,
284
287
Reason : clusterv1 .MachineNodeInternalErrorV1Beta2Reason ,
285
288
Message : "Please check controller logs for errors" ,
289
+ // NOTE: the error is logged by reconcileNode.
286
290
})
287
291
return
288
292
}
@@ -592,14 +596,14 @@ func setReadyCondition(ctx context.Context, machine *clusterv1.Machine) {
592
596
}
593
597
594
598
readyCondition , err := v1beta2conditions .NewSummaryCondition (machine , clusterv1 .MachineReadyV1Beta2Condition , summaryOpts ... )
595
- if err != nil || readyCondition == nil {
599
+ if err != nil {
596
600
// Note, this could only happen if we hit edge cases in computing the summary, which should not happen due to the fact
597
601
// that we are passing a non empty list of ForConditionTypes.
598
- log .Error (err , "Failed to set ready condition" )
602
+ log .Error (err , "Failed to set Ready condition" )
599
603
readyCondition = & metav1.Condition {
600
604
Type : clusterv1 .MachineReadyV1Beta2Condition ,
601
605
Status : metav1 .ConditionUnknown ,
602
- Reason : clusterv1 .MachineErrorComputingReadyV1Beta2Reason ,
606
+ Reason : clusterv1 .MachineReadyInternalErrorV1Beta2Reason ,
603
607
Message : "Please check controller logs for errors" ,
604
608
}
605
609
}
@@ -650,16 +654,18 @@ func calculateDeletingConditionForSummary(machine *clusterv1.Machine) v1beta2con
650
654
}
651
655
}
652
656
653
- func setAvailableCondition (_ context.Context , machine * clusterv1.Machine ) {
657
+ func setAvailableCondition (ctx context.Context , machine * clusterv1.Machine ) {
658
+ log := ctrl .LoggerFrom (ctx )
654
659
readyCondition := v1beta2conditions .Get (machine , clusterv1 .MachineReadyV1Beta2Condition )
655
660
656
661
if readyCondition == nil {
657
662
// NOTE: this should never happen given that setReadyCondition is called before this method and
658
663
// it always add a ready condition.
664
+ log .Error (errors .New ("Ready condition must be set before setting the available condition" ), "Failed to set Available condition" )
659
665
v1beta2conditions .Set (machine , metav1.Condition {
660
666
Type : clusterv1 .MachineAvailableV1Beta2Condition ,
661
667
Status : metav1 .ConditionUnknown ,
662
- Reason : clusterv1 .MachineReadyNotYetReportedV1Beta2Reason ,
668
+ Reason : clusterv1 .MachineAvailableInternalErrorV1Beta2Reason ,
663
669
Message : "Please check controller logs for errors" ,
664
670
})
665
671
return
0 commit comments