Documentation
¶
Overview ¶
Package capacityfit is the shared numerical authority for selected module demand and capacity assessment. Callers bind profile facts and policy to the owning CUE catalog; this package neither selects profiles nor attests hosts.
Index ¶
Constants ¶
const SchemaVersion = "stackkit.capacity-assessment/v1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assessment ¶
type Assessment struct {
SchemaVersion string `json:"schemaVersion"`
Nodes []NodeAssessment `json:"nodes"`
Overall Verdict `json:"overall"`
PolicyRef string `json:"policyRef,omitempty"`
}
func Assess ¶
func Assess(input Input) (Assessment, error)
func WithDataStorageChecks ¶
func WithDataStorageChecks(assessment Assessment, checks map[string]Check) (Assessment, error)
WithDataStorageChecks composes the same compiler checks into advisory fit. It accepts already bound checks; it neither calculates new budgets nor authorizes Apply. Known data-space failure outranks a passing module floor.
type Check ¶
type Demand ¶
type Demand struct {
NodeRef string `json:"nodeRef"`
ModuleRefs []string `json:"moduleRefs"`
UnverifiedModuleRefs []string `json:"unverifiedModuleRefs"`
UnverifiedAxes []Axis `json:"unverifiedAxes"`
HostFloor Vector `json:"hostFloor"`
Reservation Vector `json:"reservation"`
Recommended Vector `json:"recommended"`
Headroom Vector `json:"headroom"`
}
type Input ¶
type Input struct {
Modules []Module `json:"modules"`
Capacities []NodeCapacity `json:"capacities"`
Policy *Policy `json:"policy,omitempty"`
}
type Module ¶
type Module struct {
ID string `json:"id"`
// Existing projections may explicitly label a profile undeclared even
// while carrying partial numerical facts. Known failures still take precedence.
CapacityDeclaration string `json:"capacityDeclaration,omitempty"`
NodeRefs []string `json:"nodeRefs"`
Compute Profile `json:"compute"`
OrthogonalReservations []Vector `json:"orthogonalReservations,omitempty"`
Load *Load `json:"load,omitempty"`
}
type NodeAssessment ¶
type NodeCapacity ¶
type NodeCapacity struct {
NodeRef string `json:"nodeRef"`
Origin Origin `json:"origin"`
Values Vector `json:"values"`
}
Inventory identifies the supplied inventory boundary, not cryptographic or current host attestation. The compiler and Apply retain those separate gates.
type Policy ¶
type Policy struct {
Ref string `json:"ref"`
HeadroomFactor *float64 `json:"headroomFactor,omitempty"`
MaxAlwaysOnPerCPU *float64 `json:"maxAlwaysOnPerCPU,omitempty"`
}
Policy has no defaults: every supplied threshold must come from the caller's bound CUE policy. Ref preserves that source; it does not authenticate it.
type Vector ¶
type Vector struct {
CPUCores *float64 `json:"cpuCores,omitempty"`
RAMGB *float64 `json:"ramGB,omitempty"`
StorageGB *float64 `json:"storageGB,omitempty"`
}
Vector retains unknown axes as nil. Missing facts never become zero.
func InventoryMinimum ¶
InventoryMinimum is the exact whole-unit threshold used by current compiler inventory admission. It never changes the underlying persisted budgets.
type Verdict ¶
type Verdict string
func AdmitMinimum ¶
func AdmitMinimum(minimum Vector, capacity NodeCapacity) (Verdict, error)
AdmitMinimum is the compiler's existing hard numeric gate. It evaluates only declared requirements; recommendations and incomplete profile declarations stay outside this narrow call, as in the original admission composition.