-
Notifications
You must be signed in to change notification settings - Fork 132
Description
What problem are you facing?
The Ready status of a resource is reflected nicely when the resource is being created, but not so when updating or doing other things.
For example, when a resource needs to be updated, there is no status indicating this to the user, except for an event and log saying "Successfully requested update of external resource". The Ready status will just be true while this is happening. Successfully updating a resource also doesn't return reconcile.Result{Requeue: true}..., which means it won't trigger an observe right after to confirm that the update did its job.
When creating a resource, the Ready status is set to false with Creating as the reason both when it errors and succeeds, which is the correct way to do it. It also returns reconcile.Result{Requeu: true}... to make sure the resource is ready for use.
How could Crossplane help solve your problem?
I don't see why Create should be different than Update, so I would prefer if they were consistent.
I would personally add a ConditionReason for this as well as a helper function to set the Ready status for you, like its done with Create and Delete:
const ReasonUpdating ConditionReason = "Updating"
// Updating returns a condition that indicates the resource is currently
// being updated.
func Updating() Condition {
return Condition{
Type: TypeReady,
Status: corev1.ConditionFalse,
LastTransitionTime: metav1.Now(),
Reason: ReasonUpdating,
}
}The code that executes external.Update should be updated to return this reconcile.Result:
return reconcile.Result{Requeue: true}, errors.Wrap(r.client.Status().Update(ctx, managed), errUpdateManagedStatus)
All the returns related to the update should also add xpv1.Updating() to its SetCondition:
managed.SetConditions(xpv1.Updating(), xpv1.ReconcileSuccess())
Metadata
Metadata
Assignees
Labels
Type
Projects
Status