@@ -118,6 +118,11 @@ func (r *clusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_
118
118
return r .reconcileDelete (ctx , clusterContext )
119
119
}
120
120
121
+ if cluster == nil {
122
+ log .Info ("Waiting for Cluster controller to set OwnerRef on VSphereCluster" )
123
+ return reconcile.Result {}, nil
124
+ }
125
+
121
126
// Handle non-deleted clusters
122
127
return r .reconcileNormal (ctx , clusterContext )
123
128
}
@@ -131,28 +136,15 @@ func (r *clusterReconciler) patch(ctx context.Context, clusterCtx *capvcontext.C
131
136
),
132
137
)
133
138
134
- if ! v1beta2conditions .Has (clusterCtx .VSphereCluster , infrav1 .VSphereClusterVCenterAvailableV1Beta2Condition ) {
135
- v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
136
- Type : infrav1 .VSphereClusterVCenterAvailableV1Beta2Condition ,
137
- Status : metav1 .ConditionFalse ,
138
- Reason : infrav1 .VSphereClusterVCenterNotAvailableV1Beta2Reason ,
139
- Message : "did not observe VCenterAvailable status" ,
140
- })
141
- }
142
-
143
- if ! v1beta2conditions .Has (clusterCtx .VSphereCluster , infrav1 .VSphereClusterClusterModulesReadyV1Beta2Condition ) {
144
- v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
145
- Type : infrav1 .VSphereClusterClusterModulesReadyV1Beta2Condition ,
146
- Status : metav1 .ConditionFalse ,
147
- Reason : infrav1 .VSphereClusterClusterModulesNotReadyV1Beta2Reason ,
148
- Message : "did not observe cluster module status" ,
149
- })
150
- }
151
-
152
139
if err := v1beta2conditions .SetSummaryCondition (clusterCtx .VSphereCluster , clusterCtx .VSphereCluster , infrav1 .VSphereClusterReadyV1Beta2Condition ,
153
140
v1beta2conditions.ForConditionTypes {
154
- infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
155
141
infrav1 .VSphereClusterVCenterAvailableV1Beta2Condition ,
142
+ // FailureDomainsReady and ClusterModuelsReady may not be always set.
143
+ infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
144
+ infrav1 .VSphereClusterClusterModulesReadyV1Beta2Condition ,
145
+ },
146
+ v1beta2conditions.IgnoreTypesIfMissing {
147
+ infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
156
148
infrav1 .VSphereClusterClusterModulesReadyV1Beta2Condition ,
157
149
},
158
150
// Using a custom merge strategy to override reasons applied during merge.
@@ -171,7 +163,6 @@ func (r *clusterReconciler) patch(ctx context.Context, clusterCtx *capvcontext.C
171
163
}
172
164
173
165
return clusterCtx .PatchHelper .Patch (ctx , clusterCtx .VSphereCluster ,
174
- patch.WithOwnedConditions {Conditions : []clusterv1.ConditionType {}},
175
166
patch.WithOwnedV1Beta2Conditions {Conditions : []string {
176
167
clusterv1 .PausedV1Beta2Condition ,
177
168
infrav1 .VSphereClusterReadyV1Beta2Condition ,
@@ -190,13 +181,11 @@ func (r *clusterReconciler) reconcileDelete(ctx context.Context, clusterCtx *cap
190
181
Status : metav1 .ConditionFalse ,
191
182
Reason : infrav1 .VSphereClusterVCenterAvailableDeletingV1Beta2Reason ,
192
183
})
193
-
194
184
v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
195
185
Type : infrav1 .VSphereClusterClusterModulesReadyV1Beta2Condition ,
196
186
Status : metav1 .ConditionFalse ,
197
187
Reason : infrav1 .VSphereClusterClusterModulesDeletingV1Beta2Reason ,
198
188
})
199
-
200
189
v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
201
190
Type : infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
202
191
Status : metav1 .ConditionFalse ,
@@ -265,6 +254,7 @@ func (r *clusterReconciler) reconcileDelete(ctx context.Context, clusterCtx *cap
265
254
func (r * clusterReconciler ) reconcileNormal (ctx context.Context , clusterCtx * capvcontext.ClusterContext ) (reconcile.Result , error ) {
266
255
log := ctrl .LoggerFrom (ctx )
267
256
257
+ // Reconcile failure domains.
268
258
ok , err := r .reconcileDeploymentZones (ctx , clusterCtx )
269
259
if err != nil {
270
260
v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
@@ -276,22 +266,10 @@ func (r *clusterReconciler) reconcileNormal(ctx context.Context, clusterCtx *cap
276
266
return reconcile.Result {}, err
277
267
}
278
268
if ! ok {
279
- v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
280
- Type : infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
281
- Status : metav1 .ConditionFalse ,
282
- Reason : infrav1 .VSphereClusterFailureDomainsWaitingForFailureDomainStatusV1Beta2Reason ,
283
- Message : "waiting for failure domains to report ready status" ,
284
- })
285
269
return reconcile.Result {RequeueAfter : 10 * time .Second }, nil
286
270
}
287
- v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
288
- Type : infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
289
- Status : metav1 .ConditionTrue ,
290
- Reason : infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Reason ,
291
- })
292
-
293
- // TODO check all occurencies of infrav1.VCenterAvailableCondition and infrav1.ClusterModulesAvailable/ready condition
294
271
272
+ // Reconcile vCenter availability.
295
273
if err := r .reconcileIdentitySecret (ctx , clusterCtx ); err != nil {
296
274
conditions .MarkFalse (clusterCtx .VSphereCluster , infrav1 .VCenterAvailableCondition , infrav1 .VCenterUnreachableReason , clusterv1 .ConditionSeverityError , err .Error ())
297
275
v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
@@ -322,6 +300,7 @@ func (r *clusterReconciler) reconcileNormal(ctx context.Context, clusterCtx *cap
322
300
Reason : infrav1 .VSphereClusterVCenterAvailableV1Beta2Reason ,
323
301
})
324
302
303
+ // Reconcile cluster modules.
325
304
err = r .reconcileVCenterVersion (clusterCtx , vcenterSession )
326
305
if err != nil || clusterCtx .VSphereCluster .Status .VCenterVersion == "" {
327
306
conditions .MarkFalse (clusterCtx .VSphereCluster , infrav1 .ClusterModulesAvailableCondition , infrav1 .MissingVCenterVersionReason , clusterv1 .ConditionSeverityWarning , err .Error ())
@@ -470,14 +449,31 @@ func (r *clusterReconciler) reconcileDeploymentZones(ctx context.Context, cluste
470
449
if readyNotReported > 0 {
471
450
log .Info ("Waiting for failure domains to be reconciled" )
472
451
conditions .MarkFalse (clusterCtx .VSphereCluster , infrav1 .FailureDomainsAvailableCondition , infrav1 .WaitingForFailureDomainStatusReason , clusterv1 .ConditionSeverityInfo , "waiting for failure domains to report ready status" )
452
+ v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
453
+ Type : infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
454
+ Status : metav1 .ConditionTrue ,
455
+ Reason : infrav1 .VSphereClusterFailureDomainsNotReadyV1Beta2Reason ,
456
+ Message : "Waiting for failure domains to report ready status" ,
457
+ })
473
458
return false , nil
474
459
}
475
460
476
461
if len (failureDomains ) > 0 {
477
462
if notReady > 0 {
478
463
conditions .MarkFalse (clusterCtx .VSphereCluster , infrav1 .FailureDomainsAvailableCondition , infrav1 .FailureDomainsSkippedReason , clusterv1 .ConditionSeverityInfo , "one or more failure domains are not ready" )
464
+ v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
465
+ Type : infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
466
+ Status : metav1 .ConditionTrue ,
467
+ Reason : infrav1 .VSphereClusterFailureDomainsNotReadyV1Beta2Reason ,
468
+ Message : "One or more failure domains are not ready" ,
469
+ })
479
470
} else {
480
471
conditions .MarkTrue (clusterCtx .VSphereCluster , infrav1 .FailureDomainsAvailableCondition )
472
+ v1beta2conditions .Set (clusterCtx .VSphereCluster , metav1.Condition {
473
+ Type : infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Condition ,
474
+ Status : metav1 .ConditionTrue ,
475
+ Reason : infrav1 .VSphereClusterFailureDomainsReadyV1Beta2Reason ,
476
+ })
481
477
}
482
478
} else {
483
479
// Remove the condition if failure domains do not exist
0 commit comments