feedback

package
v0.0.42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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).

func (*Bridge[O, R]) Reconcile

func (b *Bridge[O, R]) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile implements the 6-step feedback reconciliation policy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL