@@ -201,6 +201,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
201
201
setInstallStatus (ext , nil )
202
202
setResolutionStatus (ext , nil )
203
203
setResolvedStatusConditionFailed (ext , err .Error ())
204
+ setStatusProgressing (ext , err )
204
205
ensureAllConditionsWithReason (ext , ocv1alpha1 .ReasonFailed , err .Error ())
205
206
return ctrl.Result {}, err
206
207
}
@@ -216,6 +217,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
216
217
setInstallStatus (ext , nil )
217
218
// TODO: use Installed=Unknown
218
219
setInstalledStatusConditionFailed (ext , err .Error ())
220
+ setStatusProgressing (ext , err )
219
221
return ctrl.Result {}, err
220
222
}
221
223
@@ -227,6 +229,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
227
229
setInstallStatus (ext , nil )
228
230
setResolutionStatus (ext , nil )
229
231
setResolvedStatusConditionFailed (ext , err .Error ())
232
+ setStatusProgressing (ext , err )
230
233
ensureAllConditionsWithReason (ext , ocv1alpha1 .ReasonFailed , err .Error ())
231
234
return ctrl.Result {}, err
232
235
}
@@ -264,20 +267,15 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
264
267
unpackResult , err := r .Unpacker .Unpack (ctx , bundleSource )
265
268
if err != nil {
266
269
setStatusUnpackFailed (ext , err .Error ())
270
+ setStatusProgressing (ext , err )
267
271
return ctrl.Result {}, err
268
272
}
269
273
270
274
switch unpackResult .State {
271
- case rukpaksource .StatePending :
272
- setStatusUnpackFailed (ext , unpackResult .Message )
273
- ensureAllConditionsWithReason (ext , ocv1alpha1 .ReasonFailed , "unpack pending" )
274
- return ctrl.Result {}, nil
275
275
case rukpaksource .StateUnpacked :
276
276
setStatusUnpacked (ext , unpackResult .Message )
277
277
default :
278
- setStatusUnpackFailed (ext , "unexpected unpack status" )
279
- // We previously exit with a failed status if error is not nil.
280
- return ctrl.Result {}, fmt .Errorf ("unexpected unpack status: %v" , unpackResult .Message )
278
+ panic (fmt .Sprintf ("unexpected unpack state %q" , unpackResult .State ))
281
279
}
282
280
283
281
objLbls := map [string ]string {
@@ -304,6 +302,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
304
302
managedObjs , _ , err := r .Applier .Apply (ctx , unpackResult .Bundle , ext , objLbls , storeLbls )
305
303
if err != nil {
306
304
setInstalledStatusConditionFailed (ext , err .Error ())
305
+ setStatusProgressing (ext , err )
307
306
return ctrl.Result {}, err
308
307
}
309
308
@@ -325,6 +324,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
325
324
Message : err .Error (),
326
325
ObservedGeneration : ext .Generation ,
327
326
})
327
+ setStatusProgressing (ext , err )
328
328
return ctrl.Result {}, err
329
329
}
330
330
@@ -338,13 +338,20 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
338
338
Message : err .Error (),
339
339
ObservedGeneration : ext .Generation ,
340
340
})
341
+ setStatusProgressing (ext , err )
341
342
return ctrl.Result {}, err
342
343
}
343
344
344
345
// If we have successfully established the watches, remove the "Healthy" condition.
345
346
// It should be interpreted as "Unknown" when not present.
346
347
apimeta .RemoveStatusCondition (& ext .Status .Conditions , ocv1alpha1 .TypeHealthy )
347
348
349
+ // If we made it here, we have successfully reconciled the ClusterExtension
350
+ // and have reached the desired state. Since the Progressing status should reflect
351
+ // our progress towards the desired state, we also set it when we have reached
352
+ // the desired state by providing a nil error value.
353
+ setStatusProgressing (ext , nil )
354
+
348
355
return ctrl.Result {}, nil
349
356
}
350
357
0 commit comments