preflight

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 10 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 CheckAlpineNetworking

func CheckAlpineNetworking(installPrereqs bool) error

CheckAlpineNetworking verifies that the networking tools required by KubeSolo's kube-proxy are present on Alpine Linux.

On Alpine, iptables-legacy kernel modules are absent so kube-proxy uses nftables mode. It still invokes the `iptables` binary (which Alpine's iptables package provides as an iptables-nft wrapper) as well as `nft` directly. Both packages must be installed. On all other distros this check is a no-op.

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 honours DOCKER_HOST so it matches what the Docker client (client.FromEnv) actually connects to: a unix socket by default, or a TCP endpoint when DOCKER_HOST is set to tcp://. 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 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 RunSuite

func RunSuite(checks []Check) error

RunSuite executes every check in suite, stopping on the first failure. Each passing check emits one detail line; 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) []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. nftables on Alpine Linux). pprofServer mirrors the --pprof-server flag; when true, port 6060 is added to the port availability check.

Jump to

Keyboard shortcuts

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