Status and Conditions
Every resource embeds BaseStatus which genop manages automatically. You
generally don’t need to set these fields yourself — genop updates them
based on your reconciler responses.
Phases
| Phase | Meaning |
|---|---|
Pending | Resource was just created, waiting for first reconciliation |
Running | Reconciliation is in progress or succeeded (check the Ready condition to distinguish) |
Succeeded | All reconcilers completed, resource is fully reconciled |
Failed | A reconciler failed, backoff is in progress |
Deleting | Resource is being deleted, delete reconcilers are running |
Unknown | Resource state could not be determined (avoid this) |
Key status fields
| Field | Description |
|---|---|
phase | Current lifecycle phase (see above) |
message | Human-readable message (set by Fail / Requeue) |
lastTransitionTime | When the last reconciliation occurred |
nextTransitionTime | When the next reconciliation is scheduled |
retryIndex | Number of consecutive retries (reset on success) |
conditions | Standard Kubernetes conditions list, including the Ready condition (see below) |
The Ready condition
BaseStatus exposes readiness as a standard Ready condition (Type: "Ready")
rather than a bare boolean field, so kubectl wait --for=condition=Ready works
against any resource built on genop:
kubectl wait --for=condition=Ready mysqldatabase/my-db --timeout=60sReady is True once reconciliation has succeeded — for both Running
(settled, still checked periodically) and Succeeded (one-shot, done for
good) resources — and False for every other phase, including while paused.
Reason mirrors the current phase (Running, Succeeded, Pending,
Failed, Deleting, or Unknown).
Step conditions
Each step declares a condition type through GetConditionType() (see
Lifecycle and phases).
You never set this condition yourself — genop derives it from the response
your reconciler returns:
| Response | Step condition | Phase / Ready |
|---|---|---|
operators.Succeed() | True, reason Completed | Running / False while later steps remain; after the last step, the final phase with Ready=True |
operators.Requeue(duration, message) | False, reason RequeueRequested, message as condition message | Running / False |
operators.Fail(message) / operators.FailWithError(err) / returned error | False, reason ErrorOccured, error as condition message | Failed / False, backoff applied |
| Failure on an ignored step | True, reason ErrorIgnored, error as condition message | The chain continues |
ObservedGeneration and LastTransitionTime are filled in for you, and the
top-level Ready condition (see above) is updated in the same pass. Returning
the right response is all a reconciler has to do.
Custom conditions
Step conditions are managed for you, but a reconciler can still report additional, fine-grained conditions of its own:
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
resource.GetStatus().AppendCondition(metav1.Condition{
Type: "DatabaseReady",
Status: metav1.ConditionTrue,
Reason: "Connected",
Message: "Successfully connected to the database",
})Conditions use replace semantics — if a condition with the same Type
already exists, it is replaced. LastTransitionTime and Reason are set
automatically if omitted.
To remove a condition:
resource.GetStatus().DeleteCondition("DatabaseReady")