nodepreflight

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package nodepreflight judges the facts a joining node reports about itself (Docker, kernel WireGuard, disk, clock, architecture, mesh port) and turns each problem into a concrete fix. The agent only gathers facts; judging happens on the control plane so thresholds and wording live in one place.

Index

Constants

View Source
const (
	EnvMinDiskFree   = "APP_NODE_PREFLIGHT_MIN_DISK_FREE_MB"
	EnvMaxClockSkew  = "APP_NODE_PREFLIGHT_MAX_CLOCK_SKEW"
	EnvArchitectures = "APP_NODE_PREFLIGHT_ARCHITECTURES"
)

Environment variables that tune the judgement. They are read on the control plane.

View Source
const (
	StatusPass = "pass"
	StatusWarn = "warn"
	StatusFail = "fail"
	// StatusUnknown means the agent cannot verify it from the node itself.
	StatusUnknown = "unknown"
)

Status of one check.

View Source
const (
	CheckDocker       = "docker"
	CheckArchitecture = "architecture"
	CheckDisk         = "disk"
	CheckClock        = "clock"
	CheckWireGuard    = "wireguard"
	CheckMeshPort     = "mesh_port"
	CheckFirewall     = "firewall"
	CheckControlPlane = "control_plane"
)

Check IDs, stable so the dashboard can translate their titles.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	ID         string `json:"id"`
	Status     string `json:"status"`
	Detail     string `json:"detail"`
	Fix        string `json:"fix,omitempty"`
	FixCommand string `json:"fix_command,omitempty"`
}

Check is one judged fact. Fix is empty when the check passed. FixCommand is an optional shell command the operator can run on the node.

func Evaluate

func Evaluate(f Facts, receivedAt time.Time, cfg Config) []Check

Evaluate judges facts received at receivedAt. The result order is fixed.

type Config

type Config struct {
	MinDiskFreeBytes uint64
	MaxClockSkew     time.Duration
	Architectures    []string
}

Config holds the thresholds.

func ConfigFromEnv

func ConfigFromEnv(lookup func(string) (string, bool)) Config

ConfigFromEnv reads the thresholds, falling back to documented defaults on a missing or malformed value.

type Facts

type Facts struct {
	OS, Arch         string
	DockerOK         bool
	DockerError      string
	DockerVersion    string
	WireGuardKernel  bool
	MeshEnabled      bool
	MeshPort         int
	MeshPortBindable bool
	DiskTotalBytes   uint64
	DiskFreeBytes    uint64
	AgentTime        time.Time
	Provider         string
}

Facts is what the agent measured. AgentTime is its wall clock when it built the report.

type Summary

type Summary struct {
	Pass    int  `json:"pass"`
	Warn    int  `json:"warn"`
	Fail    int  `json:"fail"`
	Unknown int  `json:"unknown"`
	Ready   bool `json:"ready"`
}

Summary counts checks by status. Ready is true when nothing failed.

func Summarize

func Summarize(checks []Check) Summary

Summarize tallies checks.

Jump to

Keyboard shortcuts

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