preflight

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package preflight implements all pre-installation validation checks. Each check is an independent function that returns a descriptive error if the check fails, making them individually testable and easy to extend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAppArmor added in v1.2.3

func CheckAppArmor(installPrereqs bool) error

CheckAppArmor warns when the kernel has AppArmor enabled but apparmor_parser is missing, installing it when installPrereqs is set. containerd needs the parser to load its default profile: without it every container runs unconfined, and a pod that asks for an AppArmor profile fails with "apparmor is not supported" because the kubelet sees AppArmor enabled. That is a warning rather than a failure, since everything else works.

func CheckCgroups

func CheckCgroups(installPrereqs bool) error

CheckCgroups verifies that all required cgroup controllers are available. It handles both cgroup v2 (unified hierarchy) and cgroup v1 (per-subsystem mount).

On Alpine with OpenRC, the cgroups init service must be running before controllers are visible. This mirrors the bash installer's ensure_alpine_cgroups_service call, which runs before check_cgroups: the service is enabled and started proactively if controllers are absent, then the check re-reads to confirm.

func CheckContainerEngine

func CheckContainerEngine() error

CheckContainerEngine verifies the container engine is reachable. It resolves the engine as the Docker client does — DOCKER_HOST, else the active Docker context — so it checks what kubesoloctl actually connects to: a unix socket by default, or a TCP endpoint. Schemes it cannot cheaply probe (ssh://, npipe://, …) are left to the client at container-create time rather than failed here.

func CheckDockerConflict

func CheckDockerConflict() error

CheckDockerConflict ensures Docker is not installed or running. Docker's network bridge and iptables rules conflict with KubeSolo's CNI.

func CheckHostname

func CheckHostname() error

CheckHostname verifies that the machine's hostname is RFC 1123 compliant. Kubernetes uses the hostname as the Node name, so a non-compliant hostname will prevent the kubelet from registering.

func CheckIptablesComment

func CheckIptablesComment() error

CheckIptablesComment verifies that the kernel's xt_comment netfilter module is available, which KubeSolo's networking stack requires.

func CheckNetfilterTools added in v1.2.3

func CheckNetfilterTools(installPrereqs bool) error

CheckNetfilterTools verifies that the netfilter tools KubeSolo shells out to are present, installing the missing ones when installPrereqs is set.

iptables is required everywhere: the pod masquerade rule, kube-proxy's iptables mode and the CNI portmap plugin all invoke it. nft is required as well where KubeSolo falls back to nftables mode, which is on Alpine (its kernels lack the legacy ip_tables module) and on any kernel where ip_tables cannot be loaded. Minimal images of RHEL 10 and its rebuilds ship neither tool, so without this check KubeSolo installs cleanly and then crash-loops on its first iptables call.

func CheckPorts

func CheckPorts(pprofServer bool) error

CheckPorts verifies that KubeSolo's required ports are not in use. We probe via net.Listen rather than shelling out to lsof/ss/netstat. pprofServer should match the --pprof-server flag; when true, port 6060 is also checked so a conflict is caught at preflight rather than at runtime.

func CheckRoot

func CheckRoot() error

CheckRoot verifies the installer is running as the root user (UID 0).

func Report added in v1.2.3

func Report(checks []Check) types.PreflightReport

Report executes every check in suite, carrying on past failures, and returns each one's result.

func RunSuite

func RunSuite(checks []Check) error

RunSuite executes every check in suite, stopping on the first failure. Each passing check emits one detail line, after its warning if it has one; the caller owns the enclosing step/ok Printer calls.

Types

type Check

type Check struct {
	Name string
	Run  func() error
}

Check represents a single pre-flight validation step.

func ContainerSuite

func ContainerSuite() []Check

ContainerSuite returns pre-flight checks for container run mode (macOS, Windows WSL2, or Linux). Only verifies the container engine is reachable — port conflicts are surfaced by the engine itself when the container starts.

func Suite

func Suite(installPrereqs, pprofServer bool, nodeIP string) []Check

Suite returns the ordered list of pre-flight checks to run before installation. installPrereqs controls whether missing OS packages are installed automatically (e.g. iptables or nftables). pprofServer mirrors the --pprof-server flag; when true, port 6060 is added to the port availability check. nodeIP mirrors the --node-ip flag and is the address the firewall check connects to.

type Warning added in v1.2.3

type Warning string

Warning is returned by a check that found a problem the install can carry on past.

func (Warning) Error added in v1.2.3

func (w Warning) Error() string

Jump to

Keyboard shortcuts

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