controller

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 60 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 controller runs the controller process: the REST API, and the watchers and the heartbeat that run beside it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenVaults added in v0.3.0

func OpenVaults(
	ctx context.Context,
	nc *natsclient.Client,
	cfg config.Config,
) (*vault.Set, error)

OpenVaults makes each vault of controller.secrets.vaults, with nc as the NATS connection of a type that needs one. A command that resolves a reference of the config, such as osapi controller token generate, opens the vaults with it, as the controller does.

Types

type Controller added in v0.3.0

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the controller process.

func New added in v0.3.0

func New(
	ctx context.Context,
	log *slog.Logger,
	cfg config.Config,
	opts ...Option,
) (*Controller, error)

New connects to NATS as cfg.Controller.NATS tells, and makes the REST API with each handler. It starts the heartbeat, and the enrollment and condition watchers that cfg turns on. They run until ctx ends. Start serves the API.

func (*Controller) CheckHealth added in v0.3.0

func (c *Controller) CheckHealth(
	ctx context.Context,
) error

CheckHealth tells whether NATS and the jobs bucket answer.

func (*Controller) Start added in v0.3.0

func (c *Controller) Start()

Start serves the REST API without blocking.

func (*Controller) Stop added in v0.3.0

func (c *Controller) Stop(
	ctx context.Context,
)

Stop asks the REST API to stop, ends the health metrics refresh, then closes the NATS connection: nothing reads NATS after it closes.

func (*Controller) SubComponents added in v0.3.0

func (c *Controller) SubComponents() map[string]job.SubComponentInfo

SubComponents returns the parts of the controller that its heartbeat and its metrics server report.

func (*Controller) Vaults added in v0.3.0

func (c *Controller) Vaults() *vault.Set

Vaults are the vaults of controller.secrets.vaults, by name.

type Option added in v0.3.0

type Option func(*options)

Option changes how New makes the controller.

func WithMeterProvider added in v0.3.0

func WithMeterProvider(
	mp *sdkmetric.MeterProvider,
) Option

WithMeterProvider sends the HTTP metrics, the NATS metrics and the job metrics of the controller to mp.

func WithVersion added in v0.3.0

func WithVersion(
	version string,
) Option

WithVersion is the build version of the binary, such as v0.2.1-0.20261119003517-f6bc5af55ceb. The heartbeat and the health status report it; the UI, which the controller serves, shows it.

Directories

Path Synopsis
Package admission is the controller side of admission: it receives an agent's request over NATS, and admits, rejects or revokes its key.
Package admission is the controller side of admission: it receives an agent's request over NATS, and admits, rejects or revokes its key.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
api
Package api provides the REST API server and handler registration.
Package api provides the REST API server and handler registration.
apierr
Package apierr answers, in one place, which HTTP status a failed job deserves.
Package apierr answers, in one place, which HTTP status a failed job deserves.
ui
Package ui provides the HTTP handler for serving the embedded React UI.
Package ui provides the HTTP handler for serving the embedded React UI.
Package certrotation rotates the NATS server's self-signed certificate with no restart and no new join of the agents.
Package certrotation rotates the NATS server's self-signed certificate with no restart and no new join of the agents.
mocks
Package mocks holds the generated doubles of the dependencies of the rotation of the NATS server's certificate, for its tests.
Package mocks holds the generated doubles of the dependencies of the rotation of the NATS server's certificate, for its tests.
Package endpoint is the DSL for the controller's own API: the operations that run on the controller, such as the agents, the jobs and the audit log, and not on a host.
Package endpoint is the DSL for the controller's own API: the operations that run on the controller, such as the agents, the jobs and the audit log, and not on a host.
command
Package command is the endpoint layer's runner of the generated CLI commands of the endpoint groups.
Package command is the endpoint layer's runner of the generated CLI commands of the endpoint groups.
gen command
Command gen writes the files that come from the endpoint groups: for each group that Uses a type, its gen/api.yaml, the routes in gen/api.go and the decoders in gen/decode.go, and internal/controller/endpoints/all/gen, which registers every group's routes.
Command gen writes the files that come from the endpoint groups: for each group that Uses a type, its gen/api.yaml, the routes in gen/api.go and the decoders in gen/decode.go, and internal/controller/endpoints/all/gen, which registers every group's routes.
gen/genutil
Package genutil holds what the endpoint layer's writers share: the fields of an input as JSON reads them, and the house layout of a jen group.
Package genutil holds what the endpoint layer's writers share: the fields of an input as JSON reads them, and the house layout of a jen group.
gen/routegen
Package routegen writes the route table and the decoders of an endpoint group, for the endpoint generator and the behavior generator alike, so a behavior's routes are the same code as an endpoint's.
Package routegen writes the route table and the decoders of an endpoint group, for the endpoint generator and the behavior generator alike, so a behavior's routes are the same code as an endpoint's.
gen/specgen
Package specgen writes the specs as the repository keeps them, for the endpoint generator and the behavior generator alike: the spec of each group, and the full spec of the API, which joins them.
Package specgen writes the specs as the repository keeps them, for the endpoint generator and the behavior generator alike: the spec of each group, and the full spec of the API, which joins them.
server
Package server is the runtime the generated routes of an endpoint group call.
Package server is the runtime the generated routes of an endpoint group call.
endpoints
admission
Package admission is the endpoint group for admission: the nodes that ask to join, the nodes osapi has admitted, and the decisions against nodes.
Package admission is the endpoint group for admission: the nodes that ask to join, the nodes osapi has admitted, and the decisions against nodes.
admission/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
agent
Package agent is the endpoint group for the agents of the fleet: the agents that report, and the actions on one agent.
Package agent is the endpoint group for the agents of the fleet: the agents that report, and the actions on one agent.
agent/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
all
Package all registers every endpoint group, one blank import each.
Package all registers every endpoint group, one blank import each.
all/gen
Package gen registers the routes of every endpoint group that is served.
Package gen registers the routes of every endpoint group that is served.
audit
Package audit is the endpoint group for the audit log: the record of each request the controller served.
Package audit is the endpoint group for the audit log: the record of each request the controller served.
audit/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
catalog
Package catalog is the catalog endpoint group: what the UI reads from the controller after sign-in.
Package catalog is the catalog endpoint group: what the UI reads from the controller after sign-in.
file
Package file is the endpoint group for the files in the Object Store: what a deploy writes to a host.
Package file is the endpoint group for the files in the Object Store: what a deploy writes to a host.
file/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
health
Package health is the endpoint group for the controller's health: the liveness and readiness probes, and the status of each component.
Package health is the endpoint group for the controller's health: the liveness and readiness probes, and the status of each component.
health/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
job
Package job is the endpoint group for the job queue: the jobs the controller sent to the agents.
Package job is the endpoint group for the job queue: the jobs the controller sent to the agents.
job/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
pki
Package pki is the pki endpoint group: the certificates of the fleet, the controller's and each agent's, through the API.
Package pki is the pki endpoint group: the certificates of the fleet, the controller's and each agent's, through the API.
pki/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
secret
Package secret is the endpoint group of the secrets in the vaults of the controller: the vaults, the metadata of each key, and a write of a value.
Package secret is the endpoint group of the secrets in the vaults of the controller: the vaults, the metadata of each key, and a write of a value.
secret/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
telemetry
Package telemetry is the endpoint group for what the controller reads from the telemetry backends, such as the spans of a trace.
Package telemetry is the endpoint group for what the controller reads from the telemetry backends, such as the spans of a trace.
telemetry/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package health provides health check API handlers.
Package health provides health check API handlers.
mocks
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.
Package jointoken is the store of join tokens: a token that admits an agent at its join (osapi-io/osapi#1313).
Package jointoken is the store of join tokens: a token that admits an agent at its join (osapi-io/osapi#1313).
Package keyrotation rotates the controller's key with no new admission of the agents.
Package keyrotation rotates the controller's key with no new admission of the agents.
mocks
Package mocks holds the generated doubles of the dependencies of the rotation of the controller's key, for its tests.
Package mocks holds the generated doubles of the dependencies of the rotation of the controller's key, for its tests.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package notify provides a pluggable condition notification system that watches the registry KV bucket for component condition transitions and dispatches events via configurable notifiers.
Package notify provides a pluggable condition notification system that watches the registry KV bucket for component condition transitions and dispatches events via configurable notifiers.
mocks
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.

Jump to

Keyboard shortcuts

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