@@ -29,6 +29,7 @@ import (
29
29
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
30
30
"k8s.io/utils/pointer"
31
31
"sigs.k8s.io/cluster-api/util/annotations"
32
+ "sigs.k8s.io/cluster-api/util/conditions"
32
33
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
33
34
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
34
35
"sigs.k8s.io/controller-runtime/pkg/handler"
@@ -172,12 +173,6 @@ func (r *MachineReconciler) reconcileBootstrap(ctx context.Context, cluster *clu
172
173
}
173
174
bootstrapConfig := externalResult .Result
174
175
175
- // If the bootstrap data is populated, set ready and return.
176
- if m .Spec .Bootstrap .DataSecretName != nil {
177
- m .Status .BootstrapReady = true
178
- return nil
179
- }
180
-
181
176
// If the bootstrap config is being deleted, return early.
182
177
if ! bootstrapConfig .GetDeletionTimestamp ().IsZero () {
183
178
return nil
@@ -187,7 +182,22 @@ func (r *MachineReconciler) reconcileBootstrap(ctx context.Context, cluster *clu
187
182
ready , err := external .IsReady (bootstrapConfig )
188
183
if err != nil {
189
184
return err
190
- } else if ! ready {
185
+ }
186
+
187
+ // Report a summary of current status of the bootstrap object defined for this machine.
188
+ conditions .SetMirrorCondition (m , clusterv1 .BootstrapReadyCondition ,
189
+ conditions .UnstructuredGetter (bootstrapConfig ),
190
+ conditions .WithFallbackValue (ready , clusterv1 .WaitingForDataSecretFallbackReason , clusterv1 .ConditionSeverityInfo , "" ),
191
+ )
192
+
193
+ // If the bootstrap data is populated, set ready and return.
194
+ if m .Spec .Bootstrap .DataSecretName != nil {
195
+ m .Status .BootstrapReady = true
196
+ return nil
197
+ }
198
+
199
+ // If the bootstrap provider is not ready, requeue.
200
+ if ! ready {
191
201
return errors .Wrapf (& capierrors.RequeueAfterError {RequeueAfter : externalReadyWait },
192
202
"Bootstrap provider for Machine %q in namespace %q is not ready, requeuing" , m .Name , m .Namespace )
193
203
}
@@ -236,6 +246,14 @@ func (r *MachineReconciler) reconcileInfrastructure(ctx context.Context, cluster
236
246
return err
237
247
}
238
248
m .Status .InfrastructureReady = ready
249
+
250
+ // Report a summary of current status of the infrastructure object defined for this machine.
251
+ conditions .SetMirrorCondition (m , clusterv1 .InfrastructureReadyCondition ,
252
+ conditions .UnstructuredGetter (infraConfig ),
253
+ conditions .WithFallbackValue (ready , clusterv1 .WaitingForInfrastructureFallbackReason , clusterv1 .ConditionSeverityInfo , "" ),
254
+ )
255
+
256
+ // If the infrastructure provider is not ready, return early.
239
257
if ! ready {
240
258
return errors .Wrapf (& capierrors.RequeueAfterError {RequeueAfter : externalReadyWait },
241
259
"Infrastructure provider for Machine %q in namespace %q is not ready, requeuing" , m .Name , m .Namespace ,
0 commit comments