cluster

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package cluster orchestrates the full lifecycle of a multi-node K8s cluster. It coordinates Lima VM provisioning, K3s installation, and cluster operations across multiple remote macOS hosts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, cfg *config.Config, nonInteractive, dryRun bool) error

Apply iterates over all nodes, rolling VM config changes (CPUs, Memory, Disk, and host mounts) one node at a time for zero downtime. A node is only restarted when its live lima.yaml differs from the desired config, and the destructive cycle is gated behind a confirmation unless nonInteractive is set.

func Backup

func Backup(ctx context.Context, cfg *config.Config, outputDir string) error

Backup creates an etcd snapshot on the init node and downloads it locally.

func Destroy

func Destroy(ctx context.Context, cfg *config.Config, force, dryRun bool) error

Destroy tears down the entire cluster.

func Init

func Init(ctx context.Context, cfg *config.Config, opts InitOptions) error

Init bootstraps a new cluster from scratch. It is idempotent.

func Join

func Join(ctx context.Context, cfg *config.Config, dryRun bool) error

Join adds nodes that are in the config but not yet in the cluster.

func Reconcile added in v0.53.0

func Reconcile(ctx context.Context, cfg *config.Config, dryRun bool) error

Reconcile converges already-provisioned nodes to the current desired baseline without rebuilding them. Today that means ensuring the standard node package set (lima.NodePackages — notably socat, which kubectl port-forward and devx bridge need to carry traffic on Docker-runtime k3s nodes) is installed inside every node's Lima VM.

Unlike Init/Join it does not touch K3s or VM lifecycle — it only installs packages on nodes that already exist, so a cluster that predates a new node-level requirement can adopt it without a destroy/recreate. It is safe to run repeatedly: apt-get install is idempotent and already-satisfied nodes are fast no-ops. Nodes are reconciled in parallel.

func Remove

func Remove(ctx context.Context, cfg *config.Config, hostName string, dryRun bool) error

Remove drains and removes a specific node from the cluster.

func Restore

func Restore(ctx context.Context, cfg *config.Config, snapshotPath string) error

Restore restores etcd from a snapshot file.

func Status

func Status(ctx context.Context, cfg *config.Config) error

Status displays the current state of all configured nodes.

func Upgrade

func Upgrade(ctx context.Context, cfg *config.Config, dryRun bool) error

Upgrade performs a rolling upgrade of K3s across all nodes. Agents are upgraded first, then servers one at a time to maintain quorum.

Types

type InitOptions

type InitOptions struct {
	DryRun      bool
	AutoInstall bool
}

InitOptions configures the Init operation.

Jump to

Keyboard shortcuts

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