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 ¶
- func CheckAlpineNetworking(installPrereqs bool) error
- func CheckCgroups(installPrereqs bool) error
- func CheckContainerEngine() error
- func CheckDockerConflict() error
- func CheckHostname() error
- func CheckIptablesComment() error
- func CheckPorts(pprofServer bool) error
- func CheckRoot() error
- func RunSuite(checks []Check) error
- type Check
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAlpineNetworking ¶
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 ¶
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 ¶
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.
Types ¶
type Check ¶
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 ¶
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.