daemon

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package daemon implements nspawn machine updates for the unbounded-agent. When a desired AgentConfig differs from the currently applied config, this package orchestrates:

  1. Provisioning a new nspawn machine (the alternate of the current one)
  2. Stopping the old machine
  3. Starting the new machine and verifying kubelet is running
  4. Removing the old machine
  5. Persisting the new applied config

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

TODO: Add a trigger mechanism (e.g. file watch, signal, API) to invoke updateNode when the desired config changes.

func UpdateNode

func UpdateNode(ctx context.Context, log *slog.Logger, active *ActiveMachine, newCfg *provision.AgentConfig) error

UpdateNode performs the nspawn machine update:

  1. Provision a new rootfs on the alternate machine
  2. Stop the old machine (graceful service shutdown + nspawn teardown)
  3. Start the new machine (configure, boot nspawn, start services, persist config)
  4. Verify kubelet health
  5. Remove the old machine and its applied config

Types

type ActiveMachine

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

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

Jump to

Keyboard shortcuts

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