Documentation
¶
Overview ¶
Package agent supervises member processes and the authenticated node API.
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
Index ¶
- func Readiness(ctx context.Context, o Options, args []string, engines ...Engine) error
- func ReexecIfPID1() (handled bool, code int, err error)
- func RenderConfig(c agentapi.MemberConfig, dataDir string) ([]byte, error)
- func Run(ctx context.Context, o Options, engines ...Engine) error
- type Engine
- type Metric
- type Node
- func (n *Node) Action(ctx context.Context, name, action string) error
- func (n *Node) Config() agentapi.MemberConfig
- func (n *Node) Configure(name string, spec ProcessSpec) error
- func (n *Node) DataDir() string
- func (n *Node) LogTail(name string, lines int) []agentapi.LogLine
- func (n *Node) Logger() *slog.Logger
- func (n *Node) Maintenance() bool
- func (n *Node) Options() Options
- func (n *Node) Signal(name string, signal syscall.Signal) error
- func (n *Node) Snapshot() (map[string]agentapi.ProcessStatus, bool)
- func (n *Node) Start(ctx context.Context, name string) error
- func (n *Node) Stop(ctx context.Context, name string) error
- func (n *Node) Stopped(name string) bool
- func (n *Node) WithLock(ctx context.Context, fn func(*Node) error) error
- func (n *Node) WriteFile(name string, data []byte, mode os.FileMode) error
- type Options
- type ProcessSpec
- type ShutdownBudgetEngine
- type ShutdownEngine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReexecIfPID1 ¶ added in v0.2.0
ReexecIfPID1 isolates init duties from the real member process. The child owns its os/exec waits; this parent alone reaps daemonized descendants adopted by PID 1. A broad reaper in the real member would race its command waiters. Outside a PID namespace's init position this function does nothing.
func RenderConfig ¶
func RenderConfig(c agentapi.MemberConfig, dataDir string) ([]byte, error)
RenderConfig renders a MongoDB configuration, rejecting overrides of agent-owned keys.
Types ¶
type Engine ¶
type Engine interface {
Name() string
Processes() []string
Apply(context.Context, *Node, agentapi.MemberConfig) ([]string, error)
Readiness(context.Context, Options, []string) error
Version(context.Context) string
Metrics(context.Context, *Node) []Metric
Routes(*http.ServeMux, *Node)
}
Engine supplies node-local mechanisms; the agent owns transport and supervision.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node exposes protected files and process control to an in-process engine.
func (*Node) Action ¶
Action applies engine intent without releasing durable operator holds. Explicit API start/restart actions, unlike configuration pulls, release stop holds.
func (*Node) Config ¶
func (n *Node) Config() agentapi.MemberConfig
func (*Node) Maintenance ¶
func (*Node) Signal ¶ added in v0.2.0
Signal targets only the supervisor's current owned child, never a discovered PID.
func (*Node) Start ¶ added in v0.4.0
Start releases a durable engine stop hold and reapplies start intent. The caller must only release a hold it owns; maintenance and desired intent remain enforced by Action.
func (*Node) Stop ¶ added in v0.2.0
Stop persists a stop hold before stopping a process. Configuration pulls and restarts preserve the hold; an explicit process API start/restart releases it.
func (*Node) WithLock ¶
WithLock serializes an engine command with Apply and generic control changes. The callback toolkit allows nested Actions without re-locking. It is scoped to the callback and must not escape it. Context cancellation bounds the lock wait; the callback is responsible for using ctx to bound its own work.
type Options ¶
type Options struct {
ControlPlaneURL, InternalCAPEM, Token, Cluster, Member, DataDir string
Listen string
Engine string
Logger *slog.Logger
}
Options configures node identity, its pinned control-plane connection and local storage.
func OptionsFromEnv ¶
OptionsFromEnv loads the member configuration injected by the infrastructure backend.
type ProcessSpec ¶
type ProcessSpec struct {
Binary string
Args, Env []string
Dir string
// StopSignal defaults to SIGTERM. Engines may select another graceful
// shutdown mode, such as PostgreSQL's SIGINT fast shutdown.
StopSignal syscall.Signal
// StopTimeout optionally increases the shutdown checkpoint budget.
StopTimeout time.Duration
}
ProcessSpec describes a supervised executable, not a remote execution request. Engine processes start from a minimal environment (PATH, LANG, LC_ALL, TZ) plus Env; they never inherit the agent's environment or credentials.
type ShutdownBudgetEngine ¶ added in v0.2.0
ShutdownBudgetEngine optionally reserves more than the default four seconds for native session draining. The agent caps this at 45 seconds to leave time for dependency-ordered child shutdown within its 60-second total budget.
type ShutdownEngine ¶ added in v0.2.0
ShutdownEngine optionally hands off leadership before the supervisor signals children. The context is independent of the canceled runtime context. Engines must not wait for control-plane publication. An unsuccessful handoff never skips the normal dependency-ordered shutdown.
Source Files
¶
- agent.go
- config.go
- controls.go
- engine.go
- inherited_files_linux.go
- init.go
- metrics.go
- mongo.go
- mongo_health.go
- ownership.go
- pbm.go
- pbm_memory.go
- pbm_restart_fence.go
- process_group_linux.go
- process_tree.go
- resources.go
- resources_linux.go
- restart_receipt.go
- restart_retention.go
- shutdown.go
- startup.go
- supervisor.go
- volume.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package datamcp supervises private, authenticated data MCP upstreams.
|
Package datamcp supervises private, authenticated data MCP upstreams. |
|
Package elastic renders and supervises secured Elastic Stack node processes.
|
Package elastic renders and supervises secured Elastic Stack node processes. |
|
Package keycloak supervises the native Keycloak distribution.
|
Package keycloak supervises the native Keycloak distribution. |
|
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
|
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors |
|
Package neo4j supervises a single native Neo4j Community server JVM.
|
Package neo4j supervises a single native Neo4j Community server JVM. |
|
The member configuration is cached in plaintext by the shared agent.
|
The member configuration is cached in plaintext by the shared agent. |
|
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
|
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors |
|
Package rabbitmq renders and supervises a RabbitMQ member using the shared agent.Engine protocol.
|
Package rabbitmq renders and supervises a RabbitMQ member using the shared agent.Engine protocol. |
|
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
|
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors |
|
gateway
Package gateway renders a self-contained Envoy 1.39 bootstrap.
|
Package gateway renders a self-contained Envoy 1.39 bootstrap. |
|
initsql
Package initsql owns the curated Supabase prerequisites on PostgreSQL 17.
|
Package initsql owns the curated Supabase prerequisites on PostgreSQL 17. |
|
logship
Package logship pushes bounded batches of supervised process logs to a private Vector HTTP source.
|
Package logship pushes bounded batches of supervised process logs to a private Vector HTTP source. |
|
Package temporal supervises native Temporal server roles and the Web UI.
|
Package temporal supervises native Temporal server roles and the Web UI. |