Documentation
¶
Overview ¶
Package hostconformance produces StackKits-owned, provider-neutral evidence about the host on which the probe is running. It never selects, provisions, addresses, or manages that host.
Index ¶
- Constants
- func Attach(inventory resolvedplan.InventoryFacts, nodeRef string, ...) (resolvedplan.InventoryFacts, error)
- func MergeNodeInventoryFacts(inventory resolvedplan.InventoryFacts, nodeRef string, ...) (resolvedplan.InventoryFacts, error)
- type Candidate
- type Check
- type Facts
- type InitSystemFacts
- type LocalProbe
- type LocalSource
- type NodeInventoryFacts
- type OSFacts
- type OSPolicy
- type Observation
- type Probe
- type ProbeError
- type Producer
- type RuntimeFacts
- type StorageCapacityFacts
- type StorageFilesystemClass
- type StorageFilesystemFacts
- type UnverifiedOSPolicy
- type VirtualizationFacts
Constants ¶
const ( // InitSystemNameSystemd is emitted only when PID 1 and the systemd // manager agree that the local manager is active. InitSystemNameSystemd = "systemd" // InitSystemNameOther identifies a known non-systemd PID 1. It is not a // scheduler capability claim. InitSystemNameOther = "other" // InitSystemNameUnknown means the local init system could not be safely // identified or its manager was not active. InitSystemNameUnknown = "unknown" InitSystemPID1Systemd = "systemd" InitSystemPID1Other = "other" InitSystemPID1Unknown = "unknown" InitSystemStateInitializing = "initializing" InitSystemStateStarting = "starting" InitSystemStateRunning = "running" InitSystemStateDegraded = "degraded" InitSystemStateMaintenance = "maintenance" InitSystemStateStopping = "stopping" InitSystemStateOffline = "offline" InitSystemStateUnknown = "unknown" )
const ( ReceiptAPIVersion = "stackkit.host-conformance-receipt/v1" ReceiptKind = "HostConformanceReceipt" DefaultValidity = 30 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func Attach ¶
func Attach(inventory resolvedplan.InventoryFacts, nodeRef string, binding resolvedplan.ExternalHostBinding, receipt resolvedplan.HostConformanceReceipt) (resolvedplan.InventoryFacts, error)
Attach returns a deep-cloned Inventory with the binding and receipt attached to exactly one existing node. canonicalInventoryHash excludes both envelopes, so this operation does not create a hash cycle.
func MergeNodeInventoryFacts ¶
func MergeNodeInventoryFacts(inventory resolvedplan.InventoryFacts, nodeRef string, facts NodeInventoryFacts, observedSiteKind string) (resolvedplan.InventoryFacts, error)
MergeNodeInventoryFacts attests observed capacity onto exactly one existing or new inventory node. Bindings, receipts, and runtime daemons are kept.
Types ¶
type Candidate ¶
func CandidateFromExecutable ¶
CandidateFromExecutable binds receipt evidence to the exact StackKits executable bytes that performed the local observation. Callers may inject a path for tests or packaged launchers; an empty path resolves the running executable.
type Facts ¶
type Facts struct {
OS OSFacts
Architecture string
AMD64MicroarchitectureLevel int
KernelRelease string
Runtime RuntimeFacts
Virtualization VirtualizationFacts
InitSystem InitSystemFacts
}
type InitSystemFacts ¶
type InitSystemFacts struct {
Name string `json:"name"`
PID1 string `json:"pid1"`
ManagerState string `json:"managerState"`
}
InitSystemFacts is the bounded, read-only observation needed by consumers that may later offer a native systemd timer. Name is systemd only when the observed PID 1 is systemd and its manager reports an active state. Other init systems and an unavailable manager remain explicit non-capabilities.
func ObserveInitSystem ¶
func ObserveInitSystem(ctx context.Context, source LocalSource) InitSystemFacts
ObserveInitSystem is the shared local observation boundary for host-conformance and host-preflight. It reads PID 1 and, only for systemd, asks the local manager for its bounded active state. It never installs, enables, starts, or otherwise mutates an init system.
func (InitSystemFacts) Observed ¶
func (f InitSystemFacts) Observed() bool
Observed reports whether the fact was populated. Empty values are retained as a compatibility path for older injected host observations; a new local probe always returns a populated fact, including an unknown result.
func (InitSystemFacts) SystemdActive ¶
func (f InitSystemFacts) SystemdActive() bool
SystemdActive is the only state that a future systemd scheduler may accept. Callers must still bind any resulting mutation to their plan and owner custody; this fact alone never authorizes a timer.
type LocalProbe ¶
type LocalProbe struct {
Source LocalSource
Architecture string
StorageSourceRef string
StoragePath string
}
func (LocalProbe) Observe ¶
func (p LocalProbe) Observe(ctx context.Context) (Observation, error)
type LocalSource ¶
type NodeInventoryFacts ¶
type NodeInventoryFacts struct {
SiteAddress string
Architecture string
AMD64MicroarchitectureLevel int
CPUCores int
RamGB int
StorageGB int
Virtualization string
StorageCapacity *StorageCapacityFacts
}
NodeInventoryFacts are the attested host facts written onto one Inventory node. They are compiler input, not a HostConformanceReceipt.
func ObserveNodeInventory ¶
func ObserveNodeInventory(ctx context.Context, probe LocalProbe) (NodeInventoryFacts, error)
ObserveNodeInventory reads CPU, RAM, disk, architecture, and virtualization from the local host. Missing or sub-1GiB measurements fail closed; they are never defaulted into an empty inventory node.
type OSPolicy ¶
OSPolicy is the only component allowed to turn an observed OS tuple into a compatibility statement. Host diagnostics cannot promote OS support.
type Observation ¶
type ProbeError ¶
type ProbeError struct {
// contains filtered or unexported fields
}
ProbeError retains the private cause while exposing only a fixed probe stage and an error category. Command output and host file contents stay private.
func (*ProbeError) Diagnostic ¶
func (e *ProbeError) Diagnostic() string
func (*ProbeError) Error ¶
func (e *ProbeError) Error() string
func (*ProbeError) Unwrap ¶
func (e *ProbeError) Unwrap() error
type Producer ¶
func (Producer) Produce ¶
func (p Producer) Produce(ctx context.Context, binding resolvedplan.ExternalHostBinding, candidate Candidate) (resolvedplan.HostConformanceReceipt, error)
type RuntimeFacts ¶
type StorageCapacityFacts ¶
type StorageCapacityFacts struct {
SourceRef string
Path string
FreeGiB float64
FilesystemType string
FilesystemClass StorageFilesystemClass
SupportsOwnership bool
}
StorageCapacityFacts is an observation of free space on the exact storage target used by the resolved plan. It is intentionally separate from the legacy total storage fact, which may describe the host root filesystem.
type StorageFilesystemClass ¶
type StorageFilesystemClass string
StorageFilesystemClass is the bounded classification of the filesystem mounted at a resolved storage target. Only local-posix is sufficient for a persistent application data root; all other known classes are deliberately reported so admission can distinguish a known mismatch from an observation that is missing or too unfamiliar to assess.
const ( StorageFilesystemLocalPOSIX StorageFilesystemClass = "local-posix" StorageFilesystemNetwork StorageFilesystemClass = "network" StorageFilesystemNonPOSIX StorageFilesystemClass = "non-posix" StorageFilesystemEphemeral StorageFilesystemClass = "ephemeral" StorageFilesystemUnknown StorageFilesystemClass = "unknown" )
type StorageFilesystemFacts ¶
type StorageFilesystemFacts struct {
FilesystemType string
FilesystemClass StorageFilesystemClass
MountPoint string
MountSource string
SupportsOwnership bool
}
StorageFilesystemFacts describes the mount selected for one exact storage path. MountPoint is diagnostic evidence; callers keep the original contract path as the storage identity. A local-posix observation is restricted to filesystems with known ownership and persistence semantics.
func ObserveStorageFilesystem ¶
func ObserveStorageFilesystem(ctx context.Context, source LocalSource, storagePath string) (StorageFilesystemFacts, error)
ObserveStorageFilesystem reads the Linux mount table through the existing LocalSource boundary. It does not mount, create, or otherwise mutate a filesystem. The longest mountpoint containing the resolved target is used so a nested data root cannot accidentally inherit a parent filesystem fact.
type UnverifiedOSPolicy ¶
type UnverifiedOSPolicy struct{}
func (UnverifiedOSPolicy) EvaluateOS ¶
func (UnverifiedOSPolicy) EvaluateOS(OSFacts, Candidate) Check