host

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: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyAttestation

func ApplyAttestation(log *slog.Logger, attest *provision.AgentAttestConfig, machineName string, goalState *goalstates.NodeStart) phases.Task

ApplyAttestation returns a task that performs TPM attestation when the provided config enables it. If attest is nil or its URL is empty, the task succeeds immediately without contacting the TPM or any server.

On successful attestation the bootstrap token (and, if present, the cluster CA certificate) in goalState.Kubelet are replaced with the values obtained from the attestation server.

func CleanupAttestArtifacts

func CleanupAttestArtifacts()

CleanupAttestArtifacts is a no-op now that the attestation is performed entirely in Go. The TPM handles are cleaned up when the device file descriptor is closed, and no scripts or config files are written to disk.

func ConfigureNFTables

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

ConfigureNFTables returns a task that installs a oneshot systemd unit which flushes all nftables rules to a clean state before kubelet starts. This ensures stale rules (e.g. left behind by Docker) do not interfere with Kubernetes networking.

func ConfigureOS

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

ConfigureOS returns a task that writes host-level OS configuration (e.g. sysctl tunables) that must be in place before any nspawn machine starts so that kubelet inside the container sees the correct kernel parameter values.

func DisableDocker

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

DisableDocker returns a task that disables the Docker service and configures the Docker daemon with "iptables": false. This prevents Docker from manipulating iptables rules, which would conflict with Kubernetes networking.

func DisableSwap

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

DisableSwap returns a task that disables swap on the host. Kubernetes requires swap to be off so the kubelet memory management and pod QoS guarantees work correctly. The task runs swapoff -a and comments out any swap entries in /etc/fstab so swap stays disabled across reboots.

func EnableDaemon

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 InstallPackages

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

InstallPackages returns a task that installs the required OS packages on the host.

TODO: support package managers beyond apt (e.g. dnf, zypper) for non-Debian distros.

func TPMAttest

func TPMAttest(log *slog.Logger, attestURL, machineName string, result *AttestResult) phases.Task

TPMAttest returns a task that performs TPM attestation against a metalman serve-pxe instance to obtain a bootstrap token. The attestation uses the google/go-tpm library to interact with the TPM device directly via /dev/tpmrm0, eliminating the need for tpm2-tools or Python.

The result pointer is populated on success so that subsequent phases can use the retrieved token.

Types

type AttestResult

type AttestResult struct {
	// Token is the bootstrap token obtained from the attestation server.
	Token string
	// CACert is the PEM-encoded cluster CA certificate returned by the
	// server. May be empty if the server did not include it.
	CACert string
}

AttestResult holds the output of a successful TPM attestation.

Jump to

Keyboard shortcuts

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