state

package
v5.36.4 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package state provides cluster state persistence for distributions that cannot introspect their running configuration (Kind, K3d).

State is stored as JSON in ~/.ksail/clusters/<name>/spec.json so that the update command can compare the desired configuration against the actual configuration used at creation time, avoiding false-positive diffs.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidClusterName = errors.New(
	"invalid cluster name: must not contain path separators or '..'",
)

ErrInvalidClusterName is returned when a cluster name contains path traversal characters.

View Source
var ErrStateNotFound = errors.New("cluster state not found")

ErrStateNotFound is returned when no saved state exists for a cluster.

Functions

func DeleteClusterState

func DeleteClusterState(clusterName string) error

DeleteClusterState removes the saved state for a cluster. This should be called during cluster deletion to clean up. Returns nil if the state does not exist (idempotent).

func LoadClusterSpec

func LoadClusterSpec(clusterName string) (*v1alpha1.ClusterSpec, error)

LoadClusterSpec loads a previously saved ClusterSpec for a cluster. Returns ErrStateNotFound if no state exists for this cluster name.

func SaveClusterSpec

func SaveClusterSpec(clusterName string, spec *v1alpha1.ClusterSpec) error

SaveClusterSpec persists the ClusterSpec used during cluster creation. This allows the update command to compare against the actual creation-time configuration instead of static defaults.

Types

This section is empty.

Jump to

Keyboard shortcuts

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