Documentation
¶
Index ¶
- Constants
- func IsValidNodeType(nodeType string) bool
- func IsValidProfile(profile string) bool
- func Providers() map[string]RequirementsProvider
- func SupportedNodeTypes() []string
- type BaselineRequirements
- type Contribution
- type DefaultHostProfile
- func (d *DefaultHostProfile) GetAvailableMemoryGB() uint64
- func (d *DefaultHostProfile) GetCPUCores() uint
- func (d *DefaultHostProfile) GetHDDStorageGB() uint64
- func (d *DefaultHostProfile) GetOSVendor() string
- func (d *DefaultHostProfile) GetOSVersion() string
- func (d *DefaultHostProfile) GetSSDStorageGB() uint64
- func (d *DefaultHostProfile) GetTotalMemoryGB() uint64
- func (d *DefaultHostProfile) GetTotalStorageGB() uint64
- func (d *DefaultHostProfile) IsNodeAlreadyRunning() bool
- func (d *DefaultHostProfile) String() string
- type DeploymentSpec
- type HostProfile
- type RequirementsProvider
- type Rule
- type Spec
Constants ¶
const ( OSUbuntu18 = "Ubuntu 18" OSDebian10 = "Debian 10" )
Supported OS constants
const NodeTypeSubstrate = "k8s-substrate"
NodeTypeSubstrate is the provider key for the Kubernetes substrate floor — the hardware Kubernetes itself needs to run, independent of any workload. It is intentionally not part of SupportedNodeTypes(): it is never a user-facing --node-type, only an internal provider key used by the cluster-install preflight.
const ( // SystemBufferGB defines the memory buffer reserved for system operations (in GB) SystemBufferGB = 0.5 // 512MB buffer for system operations )
Variables ¶
This section is empty.
Functions ¶
func IsValidNodeType ¶
IsValidNodeType checks if the given node type is supported
func IsValidProfile ¶
IsValidProfile checks if the given profile is supported
func Providers ¶ added in v0.22.1
func Providers() map[string]RequirementsProvider
Providers returns a snapshot of the global provider registry keyed by node type. Keys: "block", "consensus", "k8s-substrate".
func SupportedNodeTypes ¶
func SupportedNodeTypes() []string
SupportedNodeTypes returns all supported node types
Types ¶
type BaselineRequirements ¶
type BaselineRequirements struct {
MinCpuCores int
MinMemoryGB int
MinStorageGB int // Total storage (used when SSD/HDD split not required)
MinSSDStorageGB int // Minimum SSD/NVMe storage (0 means not required)
MinHDDStorageGB int // Minimum HDD storage (0 means not required)
MinSupportedOS []string
}
func Reduce ¶ added in v0.22.1
func Reduce(rules []Rule, spec DeploymentSpec) (BaselineRequirements, map[string]string, error)
Reduce applies all firing rules and returns BaselineRequirements plus a per-resource Why string map. Why keys: "cpu", "memory", "storage".
func (BaselineRequirements) String ¶
func (r BaselineRequirements) String() string
type Contribution ¶ added in v0.22.1
type Contribution struct {
CpuCores int
MemoryGB int
StorageGB int
SSDStorageGB int
HDDStorageGB int
Why string // human-readable attribution surfaced in doctor error output
}
Contribution describes a rule's resource contribution. Reducer semantics are hardcoded by resource type:
CpuCores, MemoryGB → Max (take the highest single rule's value) StorageGB, SSDStorageGB, HDDStorageGB → Sum (accumulate across all firing rules)
type DefaultHostProfile ¶
type DefaultHostProfile struct {
// contains filtered or unexported fields
}
DefaultHostProfile implements HostProfile using both sysinfo and ghw libraries
func (*DefaultHostProfile) GetAvailableMemoryGB ¶
func (d *DefaultHostProfile) GetAvailableMemoryGB() uint64
GetAvailableMemoryGB returns available system memory in GB
func (*DefaultHostProfile) GetCPUCores ¶
func (d *DefaultHostProfile) GetCPUCores() uint
GetCPUCores returns the number of CPU cores
func (*DefaultHostProfile) GetHDDStorageGB ¶ added in v0.9.0
func (d *DefaultHostProfile) GetHDDStorageGB() uint64
GetHDDStorageGB returns total HDD (spinning disk) storage in GB
func (*DefaultHostProfile) GetOSVendor ¶
func (d *DefaultHostProfile) GetOSVendor() string
GetOSVendor returns the OS vendor/distribution name
func (*DefaultHostProfile) GetOSVersion ¶
func (d *DefaultHostProfile) GetOSVersion() string
GetOSVersion returns the OS version
func (*DefaultHostProfile) GetSSDStorageGB ¶ added in v0.9.0
func (d *DefaultHostProfile) GetSSDStorageGB() uint64
GetSSDStorageGB returns total SSD/NVMe storage in GB
func (*DefaultHostProfile) GetTotalMemoryGB ¶
func (d *DefaultHostProfile) GetTotalMemoryGB() uint64
GetTotalMemoryGB returns total system memory in GB
func (*DefaultHostProfile) GetTotalStorageGB ¶
func (d *DefaultHostProfile) GetTotalStorageGB() uint64
GetTotalStorageGB returns total storage space in GB
func (*DefaultHostProfile) IsNodeAlreadyRunning ¶
func (d *DefaultHostProfile) IsNodeAlreadyRunning() bool
IsNodeAlreadyRunning checks if the node is already running by looking for a lock file
func (*DefaultHostProfile) String ¶
func (d *DefaultHostProfile) String() string
type DeploymentSpec ¶ added in v0.22.1
type DeploymentSpec struct {
NodeType string
Profile string
Options map[string]any // "preset", "plugins", future keys
}
DeploymentSpec carries all sizing inputs for a node deployment.
type HostProfile ¶
type HostProfile interface {
// OS information
GetOSVendor() string
GetOSVersion() string
// CPU information
GetCPUCores() uint
// Memory information (in GB)
GetTotalMemoryGB() uint64
GetAvailableMemoryGB() uint64
// Storage information (in GB)
GetTotalStorageGB() uint64
GetSSDStorageGB() uint64 // NVMe/SSD storage
GetHDDStorageGB() uint64 // Traditional spinning disk storage
// Application status
IsNodeAlreadyRunning() bool
String() string
}
HostProfile provides an abstraction over system information gathering This interface allows for easier testing and separation of concerns
func GetHostProfile ¶
func GetHostProfile() HostProfile
GetHostProfile creates a new DefaultHostProfile by gathering system information
type RequirementsProvider ¶ added in v0.22.1
type RequirementsProvider interface {
Compute(spec DeploymentSpec) (BaselineRequirements, error)
ComputeWithWhy(spec DeploymentSpec) (BaselineRequirements, map[string]string, error)
}
RequirementsProvider computes hardware floors from a structured deployment spec.
type Rule ¶ added in v0.22.1
type Rule struct {
When func(DeploymentSpec) bool
Then Contribution
}
Rule pairs a predicate with its hardware contribution.
type Spec ¶
type Spec interface {
ValidateOS() error
ValidateCPU() error
ValidateMemory() error
ValidateStorage() error
GetBaselineRequirements() BaselineRequirements
GetNodeType() string
}
func CreateNodeSpec ¶
func CreateNodeSpec(spec DeploymentSpec, hostProfile HostProfile) (Spec, error)
CreateNodeSpec creates the appropriate node spec based on a DeploymentSpec and host profile. This function uses the RequirementsProvider registry to look up requirements based on the node type, separating the concerns of node type (what kind of node) and profile (deployment environment).
func CreateSubstrateSpec ¶ added in v0.22.1
func CreateSubstrateSpec(hostProfile HostProfile) (Spec, error)
CreateSubstrateSpec creates a spec for the Kubernetes substrate floor.
Unlike CreateNodeSpec, it deliberately bypasses the IsValidNodeType / IsValidProfile gates: the substrate is not a user-facing node type and carries no profile. It resolves requirements straight from the "k8s-substrate" provider via NewNodeSpec, which only consults the provider registry. The substrate provider ignores profile and options.
func NewNodeSpec ¶ added in v0.9.0
func NewNodeSpec(spec DeploymentSpec, hostProfile HostProfile) (Spec, error)
NewNodeSpec creates a node specification for the given DeploymentSpec and host profile. Requirements are computed by the registered RequirementsProvider for the node type.