storageplan

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreStoragePlansAlike

func AreStoragePlansAlike(storagePlans []*StoragePlan) bool

By alikeness, I mean, the 2 disks across which the ZFS pool will be running, must be the same across all the nodes in the node-group. This makes the command to create a ZFS pool to be the same across the nodes, for e.g. :

zpool create primary mirror /dev/nvme0n1 /dev/nvme1n1

For all the nodes in a node-group, we have a single KubeadmControlPlane / KubeadmConfig resource. And the ZFS pool creation command goes in the postKubeadm section of that resource. So, it must be same for all the nodes.

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