hostprobe

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthyForRuntimeAdmission

func HealthyForRuntimeAdmission(decision Decision) bool

HealthyForRuntimeAdmission separates immutable/runtime host failures from resource pressure that the admission journal evaluates against the complete Incus allocation set. Capacity, live available memory, disk and inode findings remain fail-closed in admission; only their accounting moves to the layer that can atomically reserve or preempt speculative warm capacity.

One-minute load is delegated only on a dedicated host, and the distinction is not cosmetic. On a retained-workloads host, load is the single signal about consumption the journal cannot see, because the legacy listeners and the retained application stacks are not fleet VMs; it must stay a blocker there. On a dedicated host the fleet is the only consumer, the journal already holds exact per-VM CPU-unit accounting against project_max_cpu_units, and the proxy contributes a feedback loop instead of safety: one 4-vCPU worker takes an 8-core host past any reserve on its own, so the host then refuses to replenish the warm VM it just consumed, and each refusal keeps load high enough to refuse the next one.

It remains a blocker in the cold-pilot decision for both modes, because that is an operator gate rather than an automatic retry.

Types

type CPU

type CPU struct {
	Logical        int     `json:"logical"`
	PhysicalCores  int     `json:"physical_cores"`
	Sockets        int     `json:"sockets"`
	ThreadsPerCore int     `json:"threads_per_core"`
	NUMANodes      int     `json:"numa_nodes"`
	Load1          float64 `json:"load_1"`
	Load5          float64 `json:"load_5"`
	Load15         float64 `json:"load_15"`
}

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, name string, args ...string) ([]byte, error)
}

type Decision

type Decision struct {
	PilotReady              bool      `json:"pilot_ready"`
	Pool                    string    `json:"pool"`
	HostReserveMode         string    `json:"host_reserve_mode,omitempty"`
	RequiredCPUUnits        int       `json:"required_cpu_units"`
	RequiredMemoryMiB       int       `json:"required_memory_mib"`
	RequiredFreeDiskPercent int       `json:"required_free_disk_percent"`
	Findings                []Finding `json:"findings"`
}

func EvaluateColdPilot

func EvaluateColdPilot(snapshot Snapshot, reserve config.HostReserve, pool config.Pool) Decision

EvaluateColdPilot fails closed against the same host reserve and pool resource policy used by runtime admission. Legacy listeners and workers are reported but are not treated as a blocker because coexistence is required.

func EvaluateContainerImageBuild

func EvaluateContainerImageBuild(snapshot Snapshot, reserve config.HostReserve, pool config.Pool) Decision

EvaluateContainerImageBuild verifies the host that will build and smoke an Incus container image. It deliberately excludes KVM and nested-KVM: neither participates in a container build. A pending host reboot remains visible but cannot invalidate image bytes produced entirely in the container userspace; runtime capacity and failed fleet dependencies still fail closed.

type ExecRunner

type ExecRunner struct{}

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, name string, args ...string) ([]byte, error)

type Filesystem

type Filesystem struct {
	Source            string `json:"source"`
	Type              string `json:"type"`
	TotalMiB          uint64 `json:"total_mib"`
	AvailableMiB      uint64 `json:"available_mib"`
	FreePercent       int    `json:"free_percent"`
	FreeInodesPercent int    `json:"free_inodes_percent"`
	Rotational        bool   `json:"rotational"`
	RotationalKnown   bool   `json:"rotational_known"`
}

type Finding

type Finding struct {
	Code     string   `json:"code"`
	Severity Severity `json:"severity"`
	Message  string   `json:"message"`
}

type KVM

type KVM struct {
	Present    bool `json:"present"`
	Accessible bool `json:"accessible"`
	Nested     bool `json:"nested"`
}

type LegacyRunners

type LegacyRunners struct {
	Listeners int `json:"listeners"`
	Workers   int `json:"workers"`
}

type Maintenance

type Maintenance struct {
	RebootRequired bool   `json:"reboot_required"`
	SystemState    string `json:"system_state"`
	// FailedUnits names the failed systemd services behind a degraded
	// SystemState. The aggregate alone cannot distinguish a failed fleet
	// dependency from an unrelated unit, and admission must not close the
	// whole host for the second kind.
	FailedUnits []string `json:"failed_units,omitempty"`
}

type Memory

type Memory struct {
	TotalMiB      int    `json:"total_mib"`
	AvailableMiB  int    `json:"available_mib"`
	SwapTotalMiB  int    `json:"swap_total_mib"`
	SwapFreeMiB   int    `json:"swap_free_mib"`
	OOMKillsTotal uint64 `json:"oom_kills_total"`
}

type OperatingSystem

type OperatingSystem struct {
	ID           string `json:"id"`
	VersionID    string `json:"version_id"`
	PrettyName   string `json:"pretty_name"`
	Kernel       string `json:"kernel"`
	Architecture string `json:"architecture"`
}

type Pressure

type Pressure struct {
	Available bool             `json:"available"`
	CPU       PressureResource `json:"cpu"`
	Memory    PressureResource `json:"memory"`
	IO        PressureResource `json:"io"`
}

type PressureResource

type PressureResource struct {
	Some PressureWindow `json:"some"`
	Full PressureWindow `json:"full"`
}

type PressureWindow

type PressureWindow struct {
	Avg10       float64 `json:"avg10"`
	Avg60       float64 `json:"avg60"`
	Avg300      float64 `json:"avg300"`
	TotalMicros uint64  `json:"total_micros"`
}

type Severity

type Severity string
const (
	SeverityInfo    Severity = "info"
	SeverityWarning Severity = "warning"
	SeverityBlocker Severity = "blocker"
)

type Snapshot

type Snapshot struct {
	SchemaVersion   int             `json:"schema_version"`
	CapturedAt      string          `json:"captured_at"`
	Hostname        string          `json:"hostname"`
	OperatingSystem OperatingSystem `json:"operating_system"`
	Virtualization  string          `json:"virtualization"`
	CPU             CPU             `json:"cpu"`
	Memory          Memory          `json:"memory"`
	Pressure        Pressure        `json:"pressure"`
	RootFilesystem  Filesystem      `json:"root_filesystem"`
	KVM             KVM             `json:"kvm"`
	Maintenance     Maintenance     `json:"maintenance"`
	Software        Software        `json:"software"`
	LegacyRunners   LegacyRunners   `json:"legacy_runners"`
}

Snapshot is a read-only, secret-free observation of one Linux runner host. It is intentionally small enough to persist alongside deployment audit records and stable enough to compare before and after maintenance.

func Collect

func Collect(ctx context.Context) (Snapshot, error)

Collect observes local Linux state without changing it. It never reads process environments, service credentials, runner configuration, or container metadata that could contain secrets.

type Software

type Software struct {
	Incus  SoftwareVersion `json:"incus"`
	Docker SoftwareVersion `json:"docker"`
}

type SoftwareVersion

type SoftwareVersion struct {
	Present bool   `json:"present"`
	Version string `json:"version,omitempty"`
}

Jump to

Keyboard shortcuts

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