Resource status#

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#

PhaseMeaning
PendingResource was just created, waiting for first reconciliation
RunningReconciliation is in progress or succeeded (check the Ready condition to distinguish)
SucceededAll reconcilers completed, resource is fully reconciled
FailedA reconciler failed, backoff is in progress
DeletingResource is being deleted, delete reconcilers are running
UnknownResource state could not be determined (avoid this)

Key status fields#

FieldDescription
phaseCurrent lifecycle phase (see above)
messageHuman-readable message (set by Fail / Requeue)
lastTransitionTimeWhen the last reconciliation occurred
nextTransitionTimeWhen the next reconciliation is scheduled
retryIndexNumber of consecutive retries (reset on success)
conditionsStandard 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=60s

Ready 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:

ResponseStep conditionPhase / Ready
operators.Succeed()True, reason CompletedRunning / 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 messageRunning / False
operators.Fail(message) / operators.FailWithError(err) / returned errorFalse, reason ErrorOccured, error as condition messageFailed / False, backoff applied
Failure on an ignored stepTrue, reason ErrorIgnored, error as condition messageThe 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")