configurer

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterOSModule added in v0.32.0

func RegisterOSModule(matcher func(*rigos.Release) bool, builder func() any)

RegisterOSModule registers a configurer factory for hosts whose detected OS release matches the given predicate. Modules are evaluated in registration order and the first matching one wins, so register more specific matchers before more general ones.

func ResolveOSModule added in v0.32.0

func ResolveOSModule(release *rigos.Release) (func() any, bool)

ResolveOSModule returns the factory for the first registered module whose matcher accepts the given release. The boolean is false when no module matches.

Types

type BaseWindows added in v0.29.0

type BaseWindows struct {
	// contains filtered or unexported fields
}

BaseWindows provides helpers and defaults for Windows hosts

func (*BaseWindows) DataDirDefaultPath added in v0.29.0

func (w *BaseWindows) DataDirDefaultPath() string

DataDirDefaultPath returns the path to the k0s data dir on the host

func (*BaseWindows) FixContainer added in v0.32.0

func (w *BaseWindows) FixContainer(h Host) error

FixContainer is a no-op on Windows

func (*BaseWindows) K0sBinaryPath added in v0.29.0

func (w *BaseWindows) K0sBinaryPath() string

K0sBinaryPath returns the path to the k0s binary on the host

func (*BaseWindows) K0sCmdf added in v0.29.0

func (w *BaseWindows) K0sCmdf(template string, args ...interface{}) string

K0sCmdf can be used to construct k0s commands in sprintf style.

func (*BaseWindows) K0sConfigPath added in v0.29.0

func (w *BaseWindows) K0sConfigPath() string

K0sConfigPath returns the path to the k0s config file on the host

func (*BaseWindows) K0sJoinTokenPath added in v0.29.0

func (w *BaseWindows) K0sJoinTokenPath() string

K0sJoinTokenPath returns the path to the k0s join token file on the host

func (*BaseWindows) K0sctlLockFilePath added in v0.29.0

func (w *BaseWindows) K0sctlLockFilePath(h Host) string

K0sctlLockFilePath returns a path to a lock file

func (*BaseWindows) Kind added in v0.32.0

func (w *BaseWindows) Kind() string

Kind returns the OS kind identifier for Windows hosts

func (*BaseWindows) KubeconfigPath added in v0.29.0

func (w *BaseWindows) KubeconfigPath(h Host, dataDir string) string

KubeconfigPath returns the path to a kubeconfig on the host

func (*BaseWindows) KubectlCmdf added in v0.29.0

func (w *BaseWindows) KubectlCmdf(h Host, dataDir, s string, args ...interface{}) string

KubectlCmdf returns a command line in sprintf manner for running kubectl on the host using the kubeconfig from KubeconfigPath

func (*BaseWindows) OSKind added in v0.29.0

func (w *BaseWindows) OSKind() string

OSKind returns the identifier for Windows hosts

func (*BaseWindows) PrivateAddress added in v0.29.0

func (w *BaseWindows) PrivateAddress(h Host, iface, publicip string) (string, error)

PrivateAddress resolves internal ip from private interface

func (*BaseWindows) PrivateInterface added in v0.29.0

func (w *BaseWindows) PrivateInterface(h Host) (string, error)

PrivateInterface tries to find a private network interface

func (*BaseWindows) SetPath added in v0.29.0

func (w *BaseWindows) SetPath(key, value string)

SetPath sets a path for a key

func (*BaseWindows) UpdateEnvironment added in v0.32.0

func (w *BaseWindows) UpdateEnvironment(h Host, env map[string]string) error

UpdateEnvironment sets machine-level environment variables on the host

type Configurer added in v0.29.0

type Configurer interface {
	Kind() string
	OSKind() string
	K0sCmdf(string, ...interface{}) string
	K0sBinaryPath() string
	K0sConfigPath() string
	DataDirDefaultPath() string
	K0sJoinTokenPath() string
	UpdateEnvironment(Host, map[string]string) error
	KubectlCmdf(Host, string, string, ...interface{}) string
	KubeconfigPath(Host, string) string
	FixContainer(Host) error
	PrivateInterface(Host) (string, error)
	PrivateAddress(Host, string, string) (string, error)
	K0sctlLockFilePath(Host) string
	SetPath(string, string)
}

Configurer defines the per-host operations required for managing a host.

type Host added in v0.32.0

type Host interface {
	cmd.SimpleRunner
	Sudo() *rig.Client
	FS() remotefs.FS
}

Host is the interface that configurer methods use to interact with a remote host. It is satisfied by *rig.Client (and therefore by *cluster.Host, which embeds rig.CompositeConfig and *rig.Client).

type HostValidator added in v0.29.0

type HostValidator interface {
	ValidateHost(Host) error
}

HostValidator allows a Configurer to implement host-specific validation logic.

type Linux

type Linux struct {
	// contains filtered or unexported fields
}

Linux is a base module for various linux OS support packages

func (*Linux) DataDirDefaultPath added in v0.15.1

func (l *Linux) DataDirDefaultPath() string

DataDirDefaultPath returns the path to the k0s data dir on the host

func (*Linux) FixContainer added in v0.32.0

func (l *Linux) FixContainer(h Host) error

FixContainer applies container-specific fixes

func (*Linux) K0sBinaryPath

func (l *Linux) K0sBinaryPath() string

K0sBinaryPath returns the path to the k0s binary on the host

func (*Linux) K0sCmdf

func (l *Linux) K0sCmdf(template string, args ...any) string

K0sCmdf can be used to construct k0s commands in sprintf style.

func (*Linux) K0sConfigPath

func (l *Linux) K0sConfigPath() string

K0sConfigPath returns the path to the k0s config file on the host

func (*Linux) K0sJoinTokenPath

func (l *Linux) K0sJoinTokenPath() string

K0sJoinTokenPath returns the path to the k0s join token file on the host

func (*Linux) K0sctlLockFilePath added in v0.13.0

func (l *Linux) K0sctlLockFilePath(h Host) string

K0sctlLockFilePath returns a path to a lock file

func (*Linux) Kind added in v0.32.0

func (l *Linux) Kind() string

Kind returns the OS kind identifier for Linux hosts

func (*Linux) KubeconfigPath

func (l *Linux) KubeconfigPath(h Host, dataDir string) string

KubeconfigPath returns the path to a kubeconfig on the host

func (*Linux) KubectlCmdf

func (l *Linux) KubectlCmdf(h Host, dataDir, s string, args ...any) string

KubectlCmdf returns a command line in sprintf manner for running kubectl on the host using the kubeconfig from KubeconfigPath

func (*Linux) OSKind added in v0.29.0

func (l *Linux) OSKind() string

OSKind returns the identifier for Linux hosts

func (*Linux) PrivateAddress

func (l *Linux) PrivateAddress(h Host, iface, publicip string) (string, error)

PrivateAddress resolves internal ip from private interface

func (*Linux) PrivateInterface

func (l *Linux) PrivateInterface(h Host) (string, error)

PrivateInterface tries to find a private network interface

func (*Linux) SetPath added in v0.17.0

func (l *Linux) SetPath(key, value string)

SetPath sets a path for a key

func (*Linux) UpdateEnvironment added in v0.32.0

func (l *Linux) UpdateEnvironment(h Host, env map[string]string) error

UpdateEnvironment upserts the given key-value pairs into /etc/environment (replacing any existing line for the same key) and exports them into the current shell environment.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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