Documentation
¶
Overview ¶
Package feedback provides shared reconciliation infrastructure for feedback controllers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge[O clnt.Object, R proto.Message] struct { Client clnt.Client Finalizer string IDLabel string // Kind and IDKey are used only for log messages (e.g. "Subnet", "subnetID"). Kind string IDKey string NewObject func() O // Fetch retrieves the remote record by ID. The implementation should // initialise empty Spec/Status sub-messages if needed. Fetch func(ctx context.Context, id string) (R, error) // Save persists an updated remote record. Called only when the record // has changed (the Bridge does the proto.Equal comparison). Save func(ctx context.Context, remote R) error // Signal notifies the fulfillment service after the last finalizer is // removed. Errors are logged but do not fail the reconcile. Signal func(ctx context.Context, id string) error // SyncUpdate maps CR state to the remote record on the non-delete path. // The Bridge adds the finalizer before calling this. SyncUpdate func(ctx context.Context, obj O, remote R) error // SyncDelete maps CR state to the remote record on the delete path. SyncDelete func(ctx context.Context, obj O, remote R) error // ResultForUpdate chooses the reconcile result from the synced objects after // any remote changes have been saved. If nil, the zero result is returned. ResultForUpdate func(obj O, remote R) ctrl.Result // PostSaveOnDelete is an optional callback invoked after Save completes // on the delete path, before finalizer removal. Use it for cross-resource // side effects that must happen after this resource's state is persisted // (e.g. clearing a parent resource's "attached" flag). The remote record // is provided for callbacks that need to reference it (e.g. reading a // parent resource ID from the proto spec). // If nil, this step is skipped. PostSaveOnDelete func(ctx context.Context, obj O, remote R) error // IsNotFound determines whether a Fetch error means the remote record // does not exist. If nil, defaults to gRPC codes.NotFound. IsNotFound func(error) bool }
Bridge implements the shared feedback reconciliation policy for all feedback controllers. Each resource supplies type-specific callbacks (Fetch, Save, Signal, SyncUpdate, SyncDelete); the Bridge owns the finalizer lifecycle, remote-NotFound handling, clone-compare-save, and last-finalizer Signal.
O is the Kubernetes CR type (e.g. *v1alpha1.Subnet). R is the remote proto type (e.g. *privatev1.Subnet).