Documentation
¶
Overview ¶
Package app provides the CtrlPlane root orchestrator that wires all subsystems together. It is separated from the root ctrlplane package to avoid import cycles, since domain packages embed ctrlplane.Entity.
Index ¶
- type CtrlPlane
- func (cp *CtrlPlane) Auth() auth.Provider
- func (cp *CtrlPlane) Config() ctrlplane.Config
- func (cp *CtrlPlane) Events() event.Bus
- func (cp *CtrlPlane) Extensions() *plugin.Registry
- func (cp *CtrlPlane) Providers() *provider.Registry
- func (cp *CtrlPlane) Routes() http.Handler
- func (cp *CtrlPlane) Scheduler() *worker.Scheduler
- func (cp *CtrlPlane) SetAuditRecorder(r audithook.Recorder)
- func (cp *CtrlPlane) SetVault(v secrets.Vault)
- func (cp *CtrlPlane) Start(ctx context.Context) error
- func (cp *CtrlPlane) Stop(ctx context.Context) error
- func (cp *CtrlPlane) Store() store.Store
- func (cp *CtrlPlane) Vault() secrets.Vault
- type Option
- func WithAuth(p auth.Provider) Option
- func WithBootstrapHook(h bootstrap.Hook) Option
- func WithConfig(cfg ctrlplane.Config) Option
- func WithCredentialsResolver(r provider.CredentialsResolver) Option
- func WithDefaultProvider(name string) Option
- func WithEventBus(b event.Bus) Option
- func WithExtension(ext plugin.Extension) Option
- func WithLeaderElector(e worker.LeaderElector) Option
- func WithMetrics(m gometrics.Metrics) Option
- func WithProvider(name string, p provider.Provider) Option
- func WithStore(s store.Store) Option
- func WithVault(v secrets.Vault) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CtrlPlane ¶
type CtrlPlane struct {
// Services are the public subsystem interfaces.
Datacenters datacenter.Service
Instances instance.Service
Workloads workload.Service
Deploys deploy.Service
Templates template.Service
Health health.Service
Metrics metrics.Service
ProviderHealth *providerhealth.Cache
Telemetry telemetry.Service
Network network.Service
Secrets secrets.Service
Admin admin.Service
Bootstraps bootstrap.Service
// contains filtered or unexported fields
}
CtrlPlane is the root orchestrator that wires all subsystems together.
func (*CtrlPlane) Extensions ¶ added in v0.0.3
Extensions returns the plugin registry.
func (*CtrlPlane) Routes ¶
Routes returns an http.Handler with all ctrlplane API routes mounted. This is a stub that will be filled in when the api/ package is implemented.
func (*CtrlPlane) SetAuditRecorder ¶ added in v1.5.1
SetAuditRecorder swaps the audit-trail backend used by the default audit_hook plugin. Pass a chronicle-backed adapter (or any audithook.Recorder) to redirect audit events from the in-store table to a richer system. No-op when audit_hook wasn't constructed (e.g. cp.extensions==nil during a stripped-down test build).
func (*CtrlPlane) SetVault ¶ added in v1.3.0
SetVault replaces the vault and propagates it to dependent services.
type Option ¶
Option configures a CtrlPlane instance.
func WithBootstrapHook ¶ added in v1.5.1
WithBootstrapHook registers a bootstrap.Hook with the control plane.
Hooks are the programmatic-contribution path for shared platform services that auto-deploy on every datacenter (declarative contributions live on Datacenter.BootstrapServices). The reconciler worker calls every registered hook on every datacenter on every tick — hooks self-filter by inspecting the supplied DatacenterInfo.
Re-registering a hook with the same Name replaces the previous entry, supporting hot-reload of an extension's hook definition.
func WithCredentialsResolver ¶ added in v1.8.0
func WithCredentialsResolver(r provider.CredentialsResolver) Option
WithCredentialsResolver makes Ctrl Plane fetch a provider's credentials before each call to it, keyed by the provider's registry key. Providers read them with provider.CredentialsFromContext. Use it when credentials rotate or expire and handing them over once at construction is not enough.
func WithDefaultProvider ¶
WithDefaultProvider sets the default provider name.
func WithEventBus ¶
WithEventBus replaces the default in-memory event bus.
func WithExtension ¶ added in v0.0.3
WithExtension registers a plugin extension with the control plane.
func WithLeaderElector ¶ added in v1.8.0
func WithLeaderElector(e worker.LeaderElector) Option
WithLeaderElector runs background workers only on the replica e elects as leader. Use it when you run several replicas against one store, or each replica runs every worker. With the postgres store, pass store.LeaderElector(name).
func WithMetrics ¶ added in v1.8.0
WithMetrics records Ctrl Plane's metrics on m: worker passes and leader election, provider calls and credential lookups, deployments and readiness waits, provider and instance health checks, bootstrap and garbage collection activity, the resource poller, lifecycle events and plugin hook errors. In a Forge app pass app.Metrics(); the ctrlplane extension does that for you. A nil m records nothing.
It registers an observability.MetricsExtension on m for the lifecycle event counter, unless WithExtension already registered one.
Outside Forge, m must keep one series per name and label set: the vector metrics here call m.Counter(name, metrics.WithLabels(...)) once per label combination. go-utils' NewMetricsCollector keys series by name alone and would merge them; forge's metrics, which app.Metrics() returns, do not.
Spans need no option. They go to the global OpenTelemetry tracer provider, which forge.New installs.
func WithProvider ¶
WithProvider registers a named infrastructure provider.