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 CheckAppArmor(installPrereqs bool) error
- func CheckCgroups(installPrereqs bool) error
- func CheckContainerEngine() error
- func CheckDockerConflict() error
- func CheckHostname() error
- func CheckIptablesComment() error
- func CheckNetfilterTools(installPrereqs bool) error
- func CheckPorts(pprofServer bool) error
- func CheckRoot() error
- func Report(checks []Check) types.PreflightReport
- func RunSuite(checks []Check) error
- type Check
- type Warning
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAppArmor ¶ added in v1.2.3
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 ¶
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
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 ¶
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.
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. 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.