Documentation
¶
Index ¶
- Constants
- func CheckCgroups(log *slog.Logger) preflight.Checker
- func CheckContainerBackend(log *slog.Logger) preflight.Checker
- func CheckContainerdActive(log *slog.Logger) preflight.Checker
- func CheckDiskSpace(log *slog.Logger) preflight.Checker
- func CheckDockerActive(log *slog.Logger) preflight.Checker
- func CheckExistingDeployment(log *slog.Logger) preflight.Checkerdeprecated
- func CheckExistingDeploymentFor(log *slog.Logger, mode isolation.Mode) preflight.Checker
- func CheckHostOSConfiguration(log *slog.Logger) preflight.Checker
- func CheckHostPackages(log *slog.Logger) preflight.Checker
- func CheckIsPrivilegedUser(log *slog.Logger) preflight.Checker
- func CheckKubeletActive(log *slog.Logger) preflight.Checker
- func CheckNSpawnRuntime(log *slog.Logger) preflight.Checker
- func CheckNoneBackend(log *slog.Logger) preflight.Checker
- func CheckNvidiaDriver(log *slog.Logger) preflight.Checker
- func CheckSwapActive(log *slog.Logger) preflight.Checker
- func ConfigureDocker(*slog.Logger) phases.Task
- func ConfigureNFTables(log *slog.Logger) phases.Task
- func ConfigureNFTablesFor(log *slog.Logger, mode isolation.Mode) phases.Task
- func ConfigureOS(log *slog.Logger) phases.Task
- func DisableContainerd(log *slog.Logger) phases.Task
- func DisableDocker(log *slog.Logger) phases.Task
- func DisableKubelet(log *slog.Logger) phases.Task
- func DisableSwap(log *slog.Logger) phases.Task
- func EnsureNoExistingDeployment(ctx context.Context, log *slog.Logger) error
- func EnsureNoExistingDeploymentFor(ctx context.Context, log *slog.Logger, mode isolation.Mode) error
- func HardenAPT(log *slog.Logger) phases.Task
- func InstallPackages(log *slog.Logger) phases.Task
- func InstallPackagesFor(log *slog.Logger, mode isolation.Mode) phases.Task
- func Preflight(log *slog.Logger, cfg config.AgentConfig, _ *goalstates.MachineGoalState) []preflight.Checker
- func RemoveAPTHardening(log *slog.Logger) phases.Task
Constants ¶
const CheckExistingDeploymentName = "existing-deployment"
CheckExistingDeploymentName identifies the clean-host check, which a resumed installation intentionally skips.
Variables ¶
This section is empty.
Functions ¶
func CheckCgroups ¶ added in v0.1.20
CheckCgroups verifies the host cgroup filesystem is available.
func CheckContainerBackend ¶ added in v0.24.0
CheckContainerBackend runs the container backend's own preflight: cgroup v2, systemd 254 or newer, an SELinux label the kernel accepts when enforcing, and writable /etc, /opt and /var. The OCI runtime itself is installed by the agent later in bootstrap, so a missing runtime is not an error here. PROVISIONAL: the container mode is experimental and these checks are modeled on the design, not on a verified Azure Container Linux node. It mutates nothing.
func CheckContainerdActive ¶ added in v0.2.1
CheckContainerdActive warns when the host containerd service is active.
func CheckDiskSpace ¶ added in v0.1.20
CheckDiskSpace verifies enough free disk is available for bootstrap.
func CheckDockerActive ¶ added in v0.1.20
CheckDockerActive warns when Docker is active.
func CheckExistingDeployment
deprecated
added in
v0.1.22
func CheckExistingDeploymentFor ¶ added in v0.24.0
CheckExistingDeploymentFor verifies the host does not already contain node deployment artifacts. Bootstrap must start from a clean host; otherwise partial state from a prior run can be reused accidentally. Modes other than nspawn also look for the artifacts of a host-native node.
func CheckHostOSConfiguration ¶ added in v0.1.20
CheckHostOSConfiguration verifies host OS configuration paths are writable.
func CheckHostPackages ¶ added in v0.1.20
CheckHostPackages verifies all required host packages are already installed.
func CheckIsPrivilegedUser ¶ added in v0.1.20
CheckIsPrivilegedUser verifies preflight is running as root.
func CheckKubeletActive ¶ added in v0.2.1
CheckKubeletActive warns when the host kubelet service is active.
func CheckNSpawnRuntime ¶ added in v0.1.20
CheckNSpawnRuntime verifies systemd-nspawn runtime tools are available.
func CheckNoneBackend ¶ added in v0.24.0
CheckNoneBackend runs the none backend's own preflight: it fails when the host already has a kubelet or containerd the agent does not own (unit, binary or running process), or when /etc, /opt or /var is not writable. The failure names the mode to use instead, rather than switching silently. It mutates nothing.
func CheckNvidiaDriver ¶ added in v0.1.20
CheckNvidiaDriver validates the host NVIDIA driver stack when NVIDIA GPU hardware is present. It is a no-op success on hosts without NVIDIA GPUs.
func CheckSwapActive ¶ added in v0.1.20
CheckSwapActive warns when host swap is active.
func ConfigureDocker ¶ added in v0.2.1
ConfigureDocker returns a task that prevents Docker from manipulating iptables rules, which would conflict with Kubernetes networking.
func ConfigureNFTables ¶
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 ConfigureNFTablesFor ¶ added in v0.24.0
ConfigureNFTablesFor is ConfigureNFTables for an isolation mode. The nspawn mode, and the empty mode, install exactly the unit they always did. The other modes have no nspawn machine to order against and no machined to ask about registered machines (their hosts do not install systemd-container), so the unit is ordered before the node's own units and "is a node running" is answered from those units.
func ConfigureOS ¶
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 DisableContainerd ¶ added in v0.2.1
DisableContainerd returns a task that stops and masks containerd on the host.
func DisableDocker ¶
DisableDocker returns a task that stops and masks Docker on the host.
func DisableKubelet ¶ added in v0.2.1
DisableKubelet returns a task that stops and masks kubelet on the host.
func DisableSwap ¶
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. It also masks any active systemd swap units, such as Fedora's zram swap unit, because those are generated outside of /etc/fstab.
func EnsureNoExistingDeployment ¶ added in v0.1.22
EnsureNoExistingDeployment returns an error when the host already contains node deployment artifacts. It is used by start before any bootstrap task mutates host state.
func EnsureNoExistingDeploymentFor ¶ added in v0.24.0
func EnsureNoExistingDeploymentFor(ctx context.Context, log *slog.Logger, mode isolation.Mode) error
EnsureNoExistingDeploymentFor is EnsureNoExistingDeployment for an isolation mode.
func HardenAPT ¶
HardenAPT returns a task that writes drop-ins which prevent unattended-upgrades and needrestart from restarting systemd-machined (and thereby killing the running nspawn container). Idempotent.
func InstallPackages ¶
InstallPackages returns a task that installs the required OS packages on the host.
func InstallPackagesFor ¶ added in v0.24.0
InstallPackagesFor is InstallPackages for an isolation mode. Modes other than nspawn do not require systemd-container.
func Preflight ¶ added in v0.1.20
func Preflight(log *slog.Logger, cfg config.AgentConfig, _ *goalstates.MachineGoalState) []preflight.Checker
Preflight returns the standard host environment checks required before provisioning an nspawn machine.
The mode comes from cfg. For nspawn the list is the one this package has always returned. For none the nspawn runtime check is replaced by the none backend's own preflight, which refuses a host that already runs a kubelet or containerd the agent does not own, or whose /etc, /opt or /var is read only, and the systemd-container package is not required. The kubelet and containerd "active" checks stay: they report the same conflict early with the check names operators already know.
func RemoveAPTHardening ¶ added in v0.24.0
RemoveAPTHardening returns a task that removes the drop-ins HardenAPT writes. They exist only to keep a package upgrade from restarting systemd-machined under a running nspawn machine, so a mode without one removes them: they would otherwise hold back systemd and libcap security upgrades and disable needrestart for no reason. First-boot provisioning writes them for every mode, which is why bootstrap removes them rather than never writing them. Missing files are not an error.
Types ¶
This section is empty.