storageplan

package
v0.31.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStoragePlansAlike added in v0.30.0

func CheckStoragePlansAlike(storagePlans []*StoragePlan) error

By alikeness, I mean, the disks across which the ZFS pool will be running, must be of the same count and type (SSD / HDD / NVMe) across all the nodes in the node-group.

All the nodes in a node-group share a single KubeadmControlPlane / KubeadmConfig resource, whose preKubeadm section runs the same `kubeaid-storagectl plan execute --os-size ... --zfs-pool-size ...` command on every node. Each node recomputes its own storage plan locally, so device names (sdc vs sdd) are free to differ between nodes — the kernel assigns them from port enumeration order, which isn't stable across otherwise identical machines. What must match is the resulting pool's shape: a mirror across 2 SSDs on one node and across 2 HDDs on another would give the node-group wildly different storage performance while being labelled identically.

Types

type Disk

type Disk struct {
	Name,
	WWN,
	Type,
	PartitionTableType string

	Size int // GB.

	// Whether the server to which this disk is attached, has a NIC (Network Interface Card)
	// with speed >= 5 GBPS.
	// If yes, and this disk is an SSD / NVMe, then the priority score for CEPH installation
	// increases : since the CEPH OSDs can leverage the increased network bandwidth for higher
	// disk IOPS.
	WithHighSpeedNIC bool

	PriorityScores PriorityScores

	Allocations struct {
		OS,
		ZFS,
		CEPH int // GB.
	}
}

func NewDisk

func NewDisk(name, wwn, diskType, partitionTableType string, size int, withHighSpeedNIC bool) *Disk

NewDisk constructs a Disk with all identification + sizing fields set and allocations / priority scores zero-initialised.

func (*Disk) Allocated

func (d *Disk) Allocated() int

Returns the total amount of storage space allocated until now.

func (*Disk) AssignPriorityScores

func (d *Disk) AssignPriorityScores()

Assigns priority scores to the disk, for OS and ZFS installations.

func (*Disk) Unallocated

func (d *Disk) Unallocated() int

Returns the amount of unallocated storage.

type NodeGroupName

type NodeGroupName = string

type PriorityScores

type PriorityScores struct {
	OS,
	ZFS int
}

type StoragePlan

type StoragePlan struct {
	ServerID string

	Disks,

	OS,

	ZFS,

	CEPH []*Disk
}

func (*StoragePlan) Execute

func (s *StoragePlan) Execute(ctx context.Context, commandExecutor commandexecutor.CommandExecutor)

Executes the storage plan, by running necessary shell commands.

func (*StoragePlan) PrettyPrint

func (s *StoragePlan) PrettyPrint()

type StoragePlanExecutorTemplateValues

type StoragePlanExecutorTemplateValues struct {
	StoragePlan *StoragePlan
}

type StoragePlans

type StoragePlans map[NodeGroupName][]*StoragePlan

func (*StoragePlans) GetApproval

func (s *StoragePlans) GetApproval(ctx context.Context)

func (StoragePlans) PrettyPrint

func (s StoragePlans) PrettyPrint()

PrettyPrint renders the storage layout the operator is about to approve as a single bordered box — one section per node group, each with an underlined uppercase header and a right-aligned size column — followed by a destructive-change warning.

AreStoragePlansAlike enforces an identical layout across every server in a group, so the first plan is canonical and the box shows per-group facts, not per-server ones. Groups render in a stable order (control-plane first, then alphabetical) so re-running the command produces the same screen.

Jump to

Keyboard shortcuts

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