Reconciler Logic
Reconcilers are the async business-logic layer of a grafana-app-sdk app. The SDK enqueues a reconcile event when a resource is created, updated, or deleted; the reconciler observes the current state and drives the system toward the desired state.
Common Workflows
Implementing a new reconciler end-to-end
If the operator starts but no reconcile events fire when you create a resource:
- Check
BasicReconcileOptions.Namespacematches the resource's namespace - Check
BasicReconcileOptions.LabelFilters/FieldSelectors— most "no events" issues are filter mismatches (kubectl get <resource> -o yamlto see labels) - Confirm the reconciler was attached to the right (latest) version of the kind
TypedReconciler — preferred pattern
operator.TypedReconciler handles type assertion and provides a strongly-typed ReconcileFunc:
ReconcileAction values: ReconcileActionCreated, ReconcileActionUpdated, ReconcileActionDeleted, ReconcileActionResynced.
To requeue after a delay (e.g. polling an external system):
Status updates with resource.UpdateObject
Always use resource.UpdateObject for status writes — it fetches the latest version before applying your update function, avoiding 409 Conflict errors when multiple reconcile events race:
Do not use client.Update for status — it sends the full object and races with spec changes made by users.
Generation-based skip
Check LastObservedGeneration at the top of the reconcile function to avoid re-processing unchanged resources:
ReconcileOptions
Control informer behavior via BasicReconcileOptions on the AppManagedKind entry:
UsePlain: false (the default) wraps your reconciler in OpinionatedReconciler, which manages finalizers automatically so the SDK can guarantee clean deletion.
References
references/watchers.md[blocked] —Watcheralternative (event-style Add/Update/Delete callbacks) + decision matrix for watcher vs reconcilerreferences/unmanaged-kinds.md[blocked] —UnmanagedKindsfor reconciling resources your app doesn't own, withUseOpinionated: falseguidance and common failure modesreferences/registration.md[blocked] — fullapp.gowiring (client setup, multi-version registration,ValidateManifest) + common failure modes


