Documentation
¶
Overview ¶
Package app wires the backend together. Both the upstream main and downstream mains use it; downstreams pass extension options.
Index ¶
- Constants
- func ApplyMemoryLimit() int64
- func CoreCapabilities(snap *cache.Snapshot, d Diagnostics, collected collect.Snapshot) []api.Capability
- func Run(ctx context.Context, kubeconfig string, o Options, opts ...extension.Option) error
- func RunWith(ctx context.Context, kubeconfig string, o Options, reg *extension.Registry) error
- type App
- type Clients
- type Diagnostics
- type Options
Constants ¶
const MemoryLimitEnv = "SNELLIUS_MEMORY_LIMIT"
MemoryLimitEnv holds the pod's memory limit in bytes; the chart sets it from limits.memory.
Variables ¶
This section is empty.
Functions ¶
func ApplyMemoryLimit ¶
func ApplyMemoryLimit() int64
ApplyMemoryLimit sets the Go memory target to 90 % of the limit in MemoryLimitEnv (D-025). An explicit GOMEMLIMIT wins; a missing, zero or unparsable limit is ignored and logged. It returns the target set, or zero. Run calls it first; repeated calls are harmless.
func CoreCapabilities ¶
func CoreCapabilities(snap *cache.Snapshot, d Diagnostics, collected collect.Snapshot) []api.Capability
CoreCapabilities returns the core inputs' states for /api/v1/meta; a syncing or unstarted watch, and proxy stats before their first round, have none.
Types ¶
type App ¶
type App struct {
Engine *engine.Engine
Handler http.Handler
// contains filtered or unexported fields
}
App is a built, not yet started, backend.
func Build ¶
Build resolves the served kinds and constructs every component. Both intervals must be positive and the delegation edge cap not negative.
func (*App) Start ¶
Start runs the cache, the pack and extension collectors, the model loop and the served-kinds monitor until ctx is done. PollInterval is the loop's safety timer. The controller metrics collector starts as soon as the first install is discovered over a settled cache, so the first metrics do not wait for a tick.
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
// InCluster selects direct pod-IP metric scraping; otherwise pods/proxy is used.
InCluster bool
// Scraper overrides the metrics scraper InCluster selects; nil keeps it.
Scraper ctrlmetrics.Scraper
}
Clients are the Kubernetes clients the app uses.
type Diagnostics ¶
type Diagnostics struct {
NoEvents, NoCRDs, NoProxyStats, NoEndpoints bool
ControllerLogs bool
// ControllerLogsNamespaces are the install namespaces whose controller logs are read.
ControllerLogsNamespaces []string
}
Diagnostics toggles the optional inputs (design §18.1): No* turns off a default-on input, ControllerLogs turns on a default-off one.
type Options ¶
type Options struct {
// Listen is the HTTP address; empty means :8080 in-cluster and 127.0.0.1:8080 locally.
Listen string
// Pinned restricts the UI to one install: its ID, or namespace/name (D-016).
Pinned string
// PollInterval is the maximum time between model recomputes: the safety
// timer. Object, access, metrics and served-kind changes recompute sooner (D-019).
PollInterval time.Duration
// MetricsInterval is the controller metrics scrape interval.
MetricsInterval time.Duration
// DelegationEdgeCap caps the selected delegation edges per install (rules
// §5.7); zero means computed.DefaultBounds.Edges. A higher cap needs more
// memory (D-025).
DelegationEdgeCap int
// KindsInterval is how often served kinds are re-resolved; zero means 60 s.
KindsInterval time.Duration
// UI is the single-page application served at /.
UI fs.FS
// ConfirmEvery is the engine's confirm tick interval; zero means
// engine.ConfirmEvery. Tests only.
ConfirmEvery time.Duration
// OnLoop receives the engine's loop transitions. Tests only.
OnLoop func(engine.LoopEvent)
// Clock drives the engine and stamps snapshots and collected values; nil
// means the real clock. Tests only.
Clock clock.WithTicker
// Diagnostics toggles the optional inputs; the zero value keeps the defaults.
Diagnostics Diagnostics
// ClassOnlyInstalls adds an install per GatewayClass controllerName that no
// detector claims, known from Gateway API status alone.
ClassOnlyInstalls bool
}
Options are the runtime settings.