daemon

package
v0.1.20-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableDaemon added in v0.1.1

func EnableDaemon(log *slog.Logger) phases.Task

EnableDaemon returns a task that installs, enables, and starts the unbounded-agent-daemon systemd unit on the host. The unit runs "unbounded-agent daemon" which watches the Machine CR for this node and reconciles the local state to match.

func PersistAppliedConfig added in v0.1.1

func PersistAppliedConfig(log *slog.Logger, machineName string, cfg *config.AgentConfig) phases.Task

PersistAppliedConfig returns a task that writes the agent config to the applied config file for the nspawn machine. The daemon reads this file on startup to detect configuration drift.

func RecordAgentUpgradeFailureSignal added in v0.1.4

func RecordAgentUpgradeFailureSignal(message string) error

RecordAgentUpgradeFailureSignal records that the daemon failed after an AgentUpgrade.

func RemoveAgentArtifacts added in v0.1.1

func RemoveAgentArtifacts(log *slog.Logger) phases.Task

RemoveAgentArtifacts returns a task that removes the agent binary, install script, legacy uninstall script, config directory, and temp files.

func RemoveAppliedConfig added in v0.1.1

func RemoveAppliedConfig(log *slog.Logger, machineName string) phases.Task

RemoveAppliedConfig returns a task that removes the applied agent config file and its checksum sidecar for the named machine. Errors are logged but do not fail the task.

func RemoveDaemonUnit added in v0.1.4

func RemoveDaemonUnit(log *slog.Logger) phases.Task

RemoveDaemonUnit returns a task that disables and removes the unbounded-agent-daemon systemd unit without stopping the running service.

func ResetAgentResources added in v0.1.4

func ResetAgentResources(log *slog.Logger) phases.Task

ResetAgentResources returns a task that removes the unbounded-agent and all associated resources without stopping the daemon process.

func Run

func Run(ctx context.Context, log *slog.Logger) error

Run is the main daemon entry point. It discovers the active nspawn machine, builds a Kubernetes client, registers the Machine CR if needed, and blocks until the context is cancelled.

func StopDaemon added in v0.1.1

func StopDaemon(log *slog.Logger) phases.Task

StopDaemon returns a task that stops, disables, and removes the unbounded-agent-daemon systemd unit. Errors from stop and disable are logged but do not fail the task since the unit may not be present.

Types

type ActiveMachine

type ActiveMachine struct {
	Name   string
	Config *provision.AgentConfig
}

ActiveMachine holds the currently active nspawn machine name and its applied agent configuration.

type BootstrapStatusReporter

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

BootstrapStatusReporter publishes the agent's initial bootstrap progress to the Machine status. It is best-effort so bootstrap can continue when the cluster is temporarily unavailable or RBAC has not been updated yet.

func NewBootstrapStatusReporter

func NewBootstrapStatusReporter(ctx context.Context, log *slog.Logger, cfg *provision.AgentConfig) *BootstrapStatusReporter

NewBootstrapStatusReporter builds a best-effort Machine status reporter from bootstrap credentials in cfg. When credentials are incomplete, the returned reporter logs and skips updates.

func (*BootstrapStatusReporter) Failed

func (r *BootstrapStatusReporter) Failed(ctx context.Context, reason string, err error)

Failed reports that initial bootstrap failed.

func (*BootstrapStatusReporter) Running

func (r *BootstrapStatusReporter) Running(ctx context.Context)

Running reports that initial bootstrap is in progress.

func (*BootstrapStatusReporter) Succeeded

func (r *BootstrapStatusReporter) Succeeded(ctx context.Context)

Succeeded reports that initial bootstrap completed successfully.

Jump to

Keyboard shortcuts

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