detect

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package detect identifies the host system's architecture, libc variant, init system, and environment type. All detection is performed by reading the filesystem and /proc directly — no external commands are invoked, keeping the installer binary dependency-free.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment string

Environment represents the type of runtime environment detected on the host.

const (
	EnvContainer Environment = "container"
	EnvEmbedded  Environment = "embedded"
	EnvARM       Environment = "arm"
	EnvStandard  Environment = "standard"
)

type InitSystem

type InitSystem string

InitSystem represents the process supervision system running on the host.

const (
	InitSystemd InitSystem = "systemd"
	InitOpenRC  InitSystem = "openrc"
	InitS6      InitSystem = "s6"
	InitRunit   InitSystem = "runit"
	InitSysV    InitSystem = "sysvinit"
	InitUpstart InitSystem = "upstart"
	InitUnknown InitSystem = "unknown"
)

type LibC

type LibC string

LibC represents the C library variant in use on the host.

const (
	LibCGlibc LibC = "glibc"
	LibCMusl  LibC = "musl"
)

type SystemInfo

type SystemInfo struct {
	OS          string
	Arch        string
	LibC        LibC
	InitSystem  InitSystem
	Environment Environment

	// ArchiveSuffix is the arch component of the release tarball name,
	// e.g. "amd64", "arm64", "arm", "riscv64"
	ArchiveSuffix string

	// LibCSuffix is either "" (glibc) or "-musl" (musl), appended after the
	// arch in the release tarball name
	LibCSuffix string
}

SystemInfo contains all detected properties of the host system needed by the installer to select the correct binary variant and service backend.

func Detect

func Detect() (*SystemInfo, error)

Detect collects all relevant system information and returns a populated SystemInfo. It returns an error only for unsupported (untargetable) hosts, e.g. a musl system on riscv64 where no musl binary exists.

func ForTarget

func ForTarget(arch string) (*SystemInfo, error)

ForTarget constructs a SystemInfo for a specific target architecture without probing the current host. Use this when preparing an offline bundle for a machine with a different architecture than the one running the installer.

arch must be one of: amd64, arm64, arm, riscv64, amd64-musl, arm64-musl. The -musl suffix selects the musl libc variant for the KubeSolo archive (only published for amd64 and arm64); it does not affect the installer binary asset name, which has no libc split (see InstallerName). InitSystem and Environment are set to Unknown/Standard — they are not relevant for bundle downloads.

func (*SystemInfo) ArchiveName

func (s *SystemInfo) ArchiveName(version string) string

ArchiveName returns the fully-qualified tarball name for the given version, e.g. "kubesolo-v1.1.8-linux-amd64.tar.gz"

func (*SystemInfo) InstallerName

func (s *SystemInfo) InstallerName() string

InstallerName returns the release asset name of the kubesoloctl binary for this host, e.g. "kubesoloctl-linux-amd64". Unlike ArchiveName, the kubesoloctl binary is published as a single asset per arch with no libc split — the binary is a pure-Go CGO_ENABLED=0 binary that runs on both glibc and musl systems.

Jump to

Keyboard shortcuts

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