Documentation
¶
Overview ¶
Package reconciler implements the engine that converges the STUNner object tree to a desired StunnerConfig. The tree shape is fully described by the object catalog (internal/object); the engine walks it recursively, asks each object to Inspect its desired config (constructing missing objects on the fly), and applies the resulting operations in globally ordered phases: plan -> construct -> stop -> reconcile -> register -> delete -> start.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog stores the object kind specifications walked by the reconciler.
func NewCatalogFromKinds ¶
NewCatalogFromKinds builds a catalog from explicit kind specs.
type KindSpec ¶
type KindSpec struct {
// Type is the object kind described by this spec.
Type runtime.ObjectType
// Children lists the child kinds living under instances of this kind.
Children []runtime.ObjectType
// New constructs an instance. The parent is the owning node (nil for the root).
New func(parent runtime.Runnable, conf stnrv2.Config, rt *runtime.Runtime) (runtime.Runnable, error)
// ExtractConfigs answers: "given this parent and this full desired config, which instances of
// this kind should exist under the parent, and with what configs?" It is given the parent's
// name rather than the parent object, so it can only read the desired config and never stale
// parent object state (parentName is "" for the root's kind).
ExtractConfigs func(parentName string, full *stnrv2.StunnerConfig) ([]stnrv2.Config, error)
// Singleton marks kinds with exactly one instance per parent; SingletonName resolves the
// instance name from the parent's name ("" for the root's kind).
Singleton bool
SingletonName func(parentName string) string
}
KindSpec is the complete declarative description of one object kind: its constructor, its desired-config resolver, and its child kinds.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler converges the object tree to a desired config, driven by the catalog.
func New ¶
func New(catalog *Catalog, rt *runtime.Runtime, logger logging.LoggerFactory) *Reconciler
New creates a Reconciler over a catalog and a runtime.
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile(req *stnrv2.StunnerConfig, p Policy) error
Reconcile runs one reconcile against the tree and applies root-only behavior (validation, snapshotting, rollback, dry-run).
func (*Reconciler) Shutdown ¶
func (r *Reconciler) Shutdown() error
Shutdown closes every object in the tree with shutdown=true (children-first) and removes it from the registry.