provider

package
v0.66.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package provider abstracts how a cluster node's K3s runtime is provisioned and managed, so the same orchestration works for a Lima VM on macOS and a native Linux host. The K3s install/join recipe is shared; providers differ in host preparation (VM vs. bare host) and command delivery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JoinOpts

type JoinOpts struct {
	NodeIP           string
	ServerURL        string
	Token            string
	Pool             string
	K3sVersion       string
	TLSSANs          []string
	DisableServiceLB bool
	UseTailscale     bool
	UseDocker        bool
	UseCilium        bool
}

JoinOpts carries the K3s join recipe inputs shared by all providers.

type LimaProvider

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

LimaProvider provisions a node as a Lima VM on a (macOS) host — the original behavior, now behind the NodeProvider interface. It is a thin wrapper over the existing lima.Manager and k3s.Manager.

func NewLimaProvider

func NewLimaProvider(node config.NodeConfig, cfg *config.Config) *LimaProvider

NewLimaProvider builds a LimaProvider for the node.

func (*LimaProvider) DeleteNode

func (p *LimaProvider) DeleteNode(ctx context.Context, n string) error

func (*LimaProvider) Destroy

func (p *LimaProvider) Destroy(ctx context.Context) error

func (*LimaProvider) Drain

func (p *LimaProvider) Drain(ctx context.Context, n string) error

func (*LimaProvider) EnsureRuntime

func (p *LimaProvider) EnsureRuntime(ctx context.Context) (string, error)

func (*LimaProvider) GetToken

func (p *LimaProvider) GetToken(ctx context.Context) (string, error)

func (*LimaProvider) InstallAgent

func (p *LimaProvider) InstallAgent(ctx context.Context, o JoinOpts) error

func (*LimaProvider) InstallServer

func (p *LimaProvider) InstallServer(ctx context.Context, o JoinOpts) error

func (*LimaProvider) IsInstalled

func (p *LimaProvider) IsInstalled(ctx context.Context) (bool, error)

func (*LimaProvider) Kubeconfig

func (p *LimaProvider) Kubeconfig(ctx context.Context, ip string) (string, error)

func (*LimaProvider) NodeStatus

func (p *LimaProvider) NodeStatus(ctx context.Context) (string, error)

func (*LimaProvider) Reconcile

func (p *LimaProvider) Reconcile(ctx context.Context) error

func (*LimaProvider) Uninstall

func (p *LimaProvider) Uninstall(ctx context.Context, role string) error

func (*LimaProvider) WaitForReady

func (p *LimaProvider) WaitForReady(ctx context.Context, d time.Duration) error

type NativeProvider

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

NativeProvider runs K3s directly on a native Linux host (no Lima VM) over SSH. Handles immutable-OS deps (rpm-ostree), firewalld, Permissive SELinux, and tailnet networking. Supports both agent and server roles.

func NewNativeProvider

func NewNativeProvider(node config.NodeConfig, cfg *config.Config) *NativeProvider

NewNativeProvider builds a NativeProvider for the node.

func (*NativeProvider) DeleteNode

func (p *NativeProvider) DeleteNode(ctx context.Context, n string) error

func (*NativeProvider) Destroy

func (p *NativeProvider) Destroy(ctx context.Context) error

Destroy uninstalls K3s; there is no VM to remove on a native host.

func (*NativeProvider) Drain

func (p *NativeProvider) Drain(ctx context.Context, n string) error

func (*NativeProvider) EnsureRuntime

func (p *NativeProvider) EnsureRuntime(ctx context.Context) (string, error)

func (*NativeProvider) GetToken

func (p *NativeProvider) GetToken(ctx context.Context) (string, error)

The remaining lifecycle ops are identical to Lima — delegate to the exec-backed k3s.Manager, which runs the same commands directly on the host.

func (*NativeProvider) InstallAgent

func (p *NativeProvider) InstallAgent(ctx context.Context, o JoinOpts) error

func (*NativeProvider) InstallServer

func (p *NativeProvider) InstallServer(ctx context.Context, o JoinOpts) error

func (*NativeProvider) IsInstalled

func (p *NativeProvider) IsInstalled(ctx context.Context) (bool, error)

func (*NativeProvider) Kubeconfig

func (p *NativeProvider) Kubeconfig(ctx context.Context, ip string) (string, error)

func (*NativeProvider) NodeStatus

func (p *NativeProvider) NodeStatus(ctx context.Context) (string, error)

func (*NativeProvider) Reconcile

func (p *NativeProvider) Reconcile(ctx context.Context) error

func (*NativeProvider) Uninstall

func (p *NativeProvider) Uninstall(ctx context.Context, role string) error

func (*NativeProvider) WaitForReady

func (p *NativeProvider) WaitForReady(ctx context.Context, d time.Duration) error

type NodeProvider

type NodeProvider interface {
	// EnsureRuntime makes the node ready to run K3s and returns its cluster IP
	// (Lima: provision the VM; native: ensure deps/firewall and return the host IP).
	EnsureRuntime(ctx context.Context) (nodeIP string, err error)
	InstallServer(ctx context.Context, o JoinOpts) error
	InstallAgent(ctx context.Context, o JoinOpts) error
	GetToken(ctx context.Context) (string, error)
	IsInstalled(ctx context.Context) (bool, error)
	WaitForReady(ctx context.Context, timeout time.Duration) error
	NodeStatus(ctx context.Context) (string, error)
	Kubeconfig(ctx context.Context, serverIP string) (string, error)
	Drain(ctx context.Context, nodeName string) error
	DeleteNode(ctx context.Context, nodeName string) error
	Uninstall(ctx context.Context, role string) error
	Destroy(ctx context.Context) error
	Reconcile(ctx context.Context) error
}

NodeProvider provisions and manages one node's K3s runtime.

func For

func For(node config.NodeConfig, cfg *config.Config) NodeProvider

For returns the provider for a node, selected by its kind ("native" → direct K3s on a Linux host; anything else → Lima VM).

type ProviderSpec added in v0.66.0

type ProviderSpec struct {
	Host      string
	Role      string
	Pool      string
	Kind      string
	NodeIP    string
	VMName    string
	Tailscale config.TailscaleConfig
	Docker    config.DockerConfig
	Mounts    []config.MountConfig
}

ProviderSpec is the resolved, provider-facing view of a node + cluster config. Providers depend on this stable contract instead of reaching into config.NodeConfig / config.Config directly, so adding a config field ripples only to specFor (and the providers that actually need the new field) — not to every provider method.

Jump to

Keyboard shortcuts

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