Documentation
¶
Overview ¶
Package setup builds the cache and engine configuration the UI runs on, for callers that run the engine themselves, such as a one-shot CLI (D-053). pkg/app builds its own configuration here, so the two cannot drift.
Nothing here waits. The time-based checks (restart hold, grace periods, scope-verifier persistence) read as pending in a single pass. A fresh metrics result reads OK, and Next marks when it goes stale. engine.Model.Next and each health.Report.Next say when computing again can change the result. Waiting, and for how long, is the caller's.
Before a single pass, wait with cache.Cache.Settled, not by receiving on Changes. Settled covers the required informers only. Then wait until each optional watch in Snapshot().Access (cache.ProxyPodsGVR, cache.CRDsGVR, cache.EventsGVR, cache.ServicesGVR, cache.EndpointSlicesGVR, when present) and each list-only served kind (kinds.Descriptor.ListOnly) is OK or has an Err. Otherwise a pass can read them as not yet read, and the output varies between runs.
To stop, cancel the context passed to cache.Cache.Start, then call cache.Cache.Wait, which returns once every goroutine Start launched has exited.
Controller logs and proxy stats come from long-running collectors that pkg/app runs and this package does not. A caller without them gets those inputs as not read, never as healthy (D-006): controllerLogs reads as not read, and the checks over proxy stats report them not collected.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Clients ¶
type Clients struct {
Dynamic dynamic.Interface
Kube kubernetes.Interface
Discovery kinds.DiscoveryClient
// Metadata reads CRD metadata; nil means no CRD watch.
Metadata metadata.Interface
}
Clients are the Kubernetes clients the cache and kind discovery read.
type Config ¶
type Config struct {
Cache cache.Config
Engine engine.Config
// Kinds re-resolves the served kinds and the Catalog; Build has refreshed it
// once. A long-running caller runs it; a one-shot caller can ignore it.
Kinds *kinds.Monitor
// Changes is the one coalescing recompute signal the cache, the kinds
// monitor and the engine share (D-019). A one-shot caller waits with
// Cache.Settled and the optional and list-only Access entries, not on Changes.
Changes *trigger.Signal
}
Config is what Build returns. The caller creates the cache from Cache, sets Engine.Snapshots to it and, to read controller metrics, Engine.Metrics.
func Build ¶
Build validates o and reg, resolves the served kinds and lists the Catalog once, and returns the cache and engine configuration pkg/app runs on. Engine.Metrics is an empty ctrlmetrics.Static until the caller sets it; Engine.Snapshots is the caller's to set.
type Options ¶
type Options struct {
// Pinned restricts the model to one install: its ID, or namespace/name (D-016).
Pinned string
// MetricsInterval is the controller metrics collection interval; it must be
// positive. Metrics staleness and scope-verifier persistence derive from it.
MetricsInterval time.Duration
// DelegationEdgeCap caps the selected delegation edges per install; zero
// means computed.DefaultBounds.Edges. It must not be negative.
DelegationEdgeCap int
// NoEvents and NoCRDs turn off the Warning Event and CRD metadata watches.
NoEvents, NoCRDs bool
// NoEndpoints turns off the Service and EndpointSlice watches; the zero value keeps them on.
NoEndpoints bool
// Clock drives the engine and stamps snapshots; nil means the real clock.
Clock clock.WithTicker
}
Options are the settings both configs derive from.