system

package
v0.39.9 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package system provides host system detection for StackKits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToLVM

func AddToLVM(ctx context.Context, devicePath, vgName string) error

AddToLVM adds a device as a physical volume to the given volume group, then extends the root logical volume and resizes the filesystem.

func CanRunContainers

func CanRunContainers(ctx context.Context, binary string) bool

CanRunContainers tests whether a container runtime can actually create containers. This catches OpenVZ/LXC hosts where the daemon starts but containers fail.

func DetectBlockDevices

func DetectBlockDevices(ctx context.Context) ([]models.BlockDevice, error)

DetectBlockDevices discovers block devices on the host using lsblk.

func DetectCPUCores

func DetectCPUCores() int

DetectCPUCores returns the number of CPU cores on the host.

func DetectMemoryGB

func DetectMemoryGB() float64

DetectMemoryGB returns the total system memory in GB.

func FilterAvailableDevices

func FilterAvailableDevices(devices []models.BlockDevice, rootDevice string) []models.BlockDevice

FilterAvailableDevices returns devices that are unmounted, have no filesystem, are not the root disk, and are at least 1 GB.

func FormatAndMount

func FormatAndMount(ctx context.Context, devicePath, mountPoint string) error

FormatAndMount formats a device with ext4, mounts it, and adds an fstab entry.

func IsContainerBlocked

func IsContainerBlocked(virt VirtType) bool

IsContainerBlocked returns true if the virt type is known to block container creation.

func ParseLsblkOutput

func ParseLsblkOutput(data []byte) ([]models.BlockDevice, error)

ParseLsblkOutput parses the JSON output of lsblk into BlockDevice models.

Types

type Runtime

type Runtime string

Runtime represents the selected deployment runtime.

const (
	RuntimeDocker Runtime = "docker"
	RuntimeNative Runtime = "native"
)

type VirtType

type VirtType string

VirtType represents the virtualization technology of the host.

const (
	VirtNone    VirtType = "none" // bare metal
	VirtKVM     VirtType = "kvm"
	VirtVMware  VirtType = "vmware"
	VirtHyperV  VirtType = "microsoft"
	VirtXen     VirtType = "xen"
	VirtOpenVZ  VirtType = "openvz"
	VirtLXC     VirtType = "lxc"
	VirtDocker  VirtType = "docker"
	VirtWSL     VirtType = "wsl"
	VirtUnknown VirtType = "unknown"
)

func DetectVirt

func DetectVirt(ctx context.Context) VirtType

DetectVirt returns the virtualization type of the current host. Uses systemd-detect-virt when available, falls back to /proc checks.

Jump to

Keyboard shortcuts

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