steps

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoadedByThisStep  = automa.Key("loadedByThisStep")
	ConfigurationFile = "configurationFile"

	AlreadyInstalled      = "alreadyInstalled"
	AlreadyConfigured     = "alreadyConfigured"
	ServiceAlreadyEnabled = "serviceAlreadyEnabled"
	ServiceAlreadyRunning = "serviceAlreadyRunning"

	ServiceEnabledByThisStep = "serviceEnabled"
	ServiceStartedByThisStep = "serviceStarted"

	DownloadedByThisStep = "downloaded"
	ExtractedByThisStep  = "extracted"
	InstalledByThisStep  = "installed"
	CleanedUpByThisStep  = "cleanedUp"
	ConfiguredByThisStep = "configured"

	IsReady   = "isReady"
	IsPending = "isPending"
)
View Source
const (
	SetupAlloyStepId                = "setup-alloy"
	PreCheckAlloyStepId             = "precheck-alloy"
	InstallAlloyStepId              = "install-alloy"
	InstallNodeExporterStepId       = "install-node-exporter"
	DeployAlloyConfigStepId         = "deploy-alloy-config"
	DeployBlockNodeMonitoringStepId = "deploy-block-node-monitoring"
	CreateAlloyNamespaceStepId      = "create-alloy-namespace"
	IsAlloyReadyStepId              = "is-alloy-ready"
	IsNodeExporterReadyStepId       = "is-node-exporter-ready"
)
View Source
const (
	KeyModifiedByThisStep = "modifiedByThisStep"
	KeyBindTarget         = "bindTarget"
	KeyBindMount          = "bindMount"
	KeyAlreadyMounted     = "alreadyMounted"
	KeyAlreadyInFstab     = "alreadyInFstab"
)
View Source
const (
	SetupBlockNodeStepId             = "setup-block-node"
	SetupBlockNodeStorageStepId      = "setup-block-node-storage"
	CreateBlockNodeNamespaceStepId   = "create-block-node-namespace"
	CreateBlockNodePVsStepId         = "create-block-node-pvs"
	DeleteBlockNodePVsStepId         = "delete-block-node-pvs"
	RecreateBlockNodeStorageStepId   = "recreate-block-node-storage"
	InstallBlockNodeStepId           = "install-block-node"
	UninstallBlockNodeStepId         = "uninstall-block-node"
	UpgradeBlockNodeStepId           = "upgrade-block-node"
	WaitForBlockNodeStepId           = "wait-for-block-node"
	ResetBlockNodeStepId             = "reset-block-node"
	PurgeBlockNodeStorageStepId      = "purge-block-node-storage"
	ScaleDownBlockNodeStepId         = "scale-down-block-node"
	ClearBlockNodeStorageStepId      = "clear-block-node-storage"
	ScaleUpBlockNodeStepId           = "scale-up-block-node"
	WaitForBlockNodeTerminatedStepId = "wait-for-block-node-terminated"
	RolloutRestartBlockNodeStepId    = "rollout-restart-block-node"
	VerifyBlockNodeReachableStepId   = "verify-block-node-reachable"
)
View Source
const (
	SetupExternalSecretsStepId   = "setup-external-secrets"
	InstallExternalSecretsStepId = "install-external-secrets"
	IsExternalSecretsReadyStepId = "is-external-secrets-ready"
)
View Source
const (
	CheckClusterNodesStepId      = "check_cluster_nodes"
	CheckClusterNamespacesStepId = "check_cluster_namespaces"
	CheckClusterConfigMapsStepId = "check_cluster_configmaps"
	CheckClusterPodsStepId       = "check_cluster_pods"
	CheckClusterServicesStepId   = "check_cluster_services"
	CheckClusterCRDsStepId       = "check_cluster_crds"
)
View Source
const (
	SetupMetalLBStepId           = "setup-metallb"
	InstallMetalLBStepId         = "install-metallb"
	MetalLBTemplatePath          = "files/metallb/metallb.yaml"
	ConfigureMetalLbConfigStepId = "configure-metallb-config"
	PrepareMetalLbConfigStepId   = "prepare-metallb-config"
	DeployMetalLbConfigStepId    = "deploy-metallb-config"
	IsMetalLBReadyStepId         = "is-metallb-ready"
)
View Source
const (
	SetupPrometheusCRDsStepId   = "setup-prometheus-crds"
	InstallPrometheusCRDsStepId = "install-prometheus-crds"
	IsPrometheusCRDsReadyStepId = "is-prometheus-crds-ready"
)
View Source
const (
	ConfigureSysctlForKubernetesStepId = "configure-sysctl-for-kubernetes"
	SysCtlBackupFilename               = "sysctl.conf"
	KeyBackupFile                      = "backup_file"
	KeyReloadedFiles                   = "reloaded_files"
	KeyCopiedFiles                     = "copied_files"
	KeyRemovedFiles                    = "removed_files"
	KeyWarnings                        = "warnings"
)
View Source
const (
	SetupTeleportStepId                = "setup-teleport"
	TeardownTeleportClusterAgentStepId = "teardown-teleport-cluster-agent"
	TeardownTeleportNodeAgentStepId    = "teardown-teleport-node-agent"
	InstallTeleportStepId              = "install-teleport"
	UninstallTeleportKubeAgentStepId   = "uninstall-teleport-kube-agent"
	UninstallTeleportNodeAgentStepId   = "uninstall-teleport-node-agent"
	UnconfigureTeleportNodeAgentStepId = "unconfigure-teleport-node-agent"
	CreateTeleportNamespaceStepId      = "create-teleport-namespace"
	IsTeleportReadyStepId              = "is-teleport-ready"
)
View Source
const (
	DisableSwapStepId = "disable-swap"
)
View Source
const (
	InstallSoloOperatorStepId = "install-solo-operator"
)

Variables

View Source
var PrintWorkflowReport = func(report *automa.Report, fileName string) {
	b, err := yaml.Marshal(report)
	if err != nil {
		fmt.Printf("Failed to marshal report: %v\n", err)
		return
	}

	if fileName != "" {
		err := os.WriteFile(fileName, b, models.DefaultFilePerm)
		if err != nil {
			fmt.Printf("Failed to write report to file: %v\n", err)
			return
		}
	} else {
		fmt.Printf("Workflow Execution Report:%s\n", b)
	}
}

PrintWorkflowReport prints the workflow execution report in YAML format If fileName is provided, it writes the report to the specified file Otherwise, it prints the report to standard output

Functions

func AutoRemoveOrphanedPackages

func AutoRemoveOrphanedPackages() *automa.StepBuilder

AutoRemoveOrphanedPackages removes orphaned dependencies and frees disk space. Essentially this is equivalent to running `apt autoremove -y` on Debian-based systems

func CheckClusterCRDs

func CheckClusterCRDs(id string, crds []string, timeout time.Duration, provider kube.ClientProviderFromContext) *automa.StepBuilder

CheckClusterCRDs checks if the specified CRDs are installed in the cluster crds is a list of CRD names

func CheckClusterConfigMaps

func CheckClusterConfigMaps(id string, configMaps []string, timeout time.Duration, provider kube.ClientProviderFromContext) *automa.StepBuilder

CheckClusterConfigMaps checks if the specified config maps exist in the cluster

func CheckClusterHealth

func CheckClusterHealth() *automa.WorkflowBuilder

CheckClusterHealth performs a series of checks to ensure the cluster is healthy and operational

func CheckClusterNamespaces

func CheckClusterNamespaces(id string, namespaces []string, timeout time.Duration, provider kube.ClientProviderFromContext) *automa.StepBuilder

CheckClusterNamespaces checks if the specified namespaces exist in the cluster namespaces is a list of namespace names

func CheckClusterNodesReady

func CheckClusterNodesReady(id string, provider kube.ClientProviderFromContext) *automa.StepBuilder

CheckClusterNodesReady checks if all nodes in the cluster are ready

func CheckClusterPodsReady

func CheckClusterPodsReady(id string, podNames []string, timeout time.Duration, provider kube.ClientProviderFromContext) *automa.StepBuilder

CheckClusterPodsReady checks if the specified pods are running in the cluster podNames is a list of strings in the format 'namespace/pod-name-prefix'

func CheckClusterServices

func CheckClusterServices(id string, services []string, timeout time.Duration, provider kube.ClientProviderFromContext) *automa.StepBuilder

CheckClusterServices checks if the specified services are running in the cluster services is a list of strings in the format 'namespace/service-name'

func CheckWeaverInstallation

func CheckWeaverInstallation(binDir string) *automa.StepBuilder

CheckWeaverInstallation checks if solo-provisioner is installed at the given binDir.

func CleanupWeaverFiles added in v0.7.0

func CleanupWeaverFiles() *automa.StepBuilder

CleanupWeaverFiles removes weaver installation files while preserving downloads, bin, and logs folders

func ConfigureSysctlForKubernetes

func ConfigureSysctlForKubernetes() *automa.WorkflowBuilder

func CreateTeleportNamespace added in v0.7.0

func CreateTeleportNamespace() automa.Builder

func DeleteBlockNodePersistentVolumes added in v0.18.0

func DeleteBlockNodePersistentVolumes(inputs models.BlockNodeInputs) automa.Builder

DeleteBlockNodePersistentVolumes returns the step that deletes the block node's PVCs and PVs by label selector. Used by the uninstall --purge-storage workflow after the data directories have been wiped.

This is a thin public facade over the package-private deleteBlockNodePVs helper; handlers in internal/bll/blocknode/ cannot reach the helper directly. The inner step already carries its own DeleteBlockNodePVsStepId and notify hooks (StepStart/StepFailure/StepCompletion), so no wrapper workflow is added here — wrapping would either collide on the step id or duplicate the notifications.

func DeployMetricsServer added in v0.7.0

func DeployMetricsServer(valueOptions *values.Options) *automa.WorkflowBuilder

func DisableSwap

func DisableSwap() *automa.StepBuilder

DisableSwap disables swap on the system On execute, it runs the swapoff and ensures fstab is updated to prevent swap from being re-enabled on reboot On rollback, it runs the swapon and ensures fstab is updated to re-enable swap on reboot

func EnsureHederaOwnerStep added in v0.17.0

func EnsureHederaOwnerStep() *automa.StepBuilder

EnsureHederaOwnerStep idempotently creates the hedera:2000 user and group when they do not exist, then adds the weaver service account to the hedera group so it can write to block-node storage directories (which are setgid hedera:hedera 2775).

func EnsureWeaverOwnerStep added in v0.17.0

func EnsureWeaverOwnerStep() *automa.StepBuilder

EnsureWeaverOwnerStep idempotently creates the weaver:2500 user and group when they do not exist. This runs as the first step of self-install so that SetupHomeDirectoryStructure can chown the provisioner home dirs to weaver:weaver.

func InitializeCluster

func InitializeCluster() *automa.StepBuilder

InitializeCluster checks cluster status and performs initialization only if needed

func InstallKernelModule

func InstallKernelModule(name string) *automa.StepBuilder

InstallKernelModule ensures that a specific kernel module is loaded and persisted. If the module is already loaded, it skips the loading process. On rollback, it unloads the module only if it was loaded by this step.

func InstallSoloOperator added in v0.17.0

func InstallSoloOperator() automa.Builder

func InstallSudoersStep added in v0.17.0

func InstallSudoersStep() *automa.StepBuilder

InstallSudoersStep writes the weaver sudoers entry to /etc/sudoers.d/solo-provisioner.

func InstallSystemPackage

func InstallSystemPackage(name string, installer func() (software.Package, error)) *automa.StepBuilder

InstallSystemPackage installs a system package using the provided installer function. The installer function should return a software.Package instance that knows how to install the package. If the package is already installed, it will skip the installation.

func InstallTeleportKubeAgent added in v0.7.0

func InstallTeleportKubeAgent() automa.Builder

func InstallWeaver

func InstallWeaver(binDir string) *automa.StepBuilder

InstallWeaver installs the currently running executable as the `solo-provisioner` binary into the provided `binDir` and attempts to create a convenience symlink in `/usr/local/bin`.

Behavior

  • The step locates the currently running executable (source).
  • It ensures `binDir` exists and then copies the source executable into a temporary file created inside `binDir` (pattern `solo-provisioner.tmp.*`).
  • After the copy completes the temp file is closed, its mode is set to executable (`0o755`), and the temp file is atomically renamed to the final destination `binDir/solo-provisioner`.

Why a temp file + rename

  • Atomic replacement: renaming a file within the same filesystem is atomic on POSIX. This guarantees other processes see either the old binary or the fully-written new one, never a half-written file.
  • Crash/failure safety: if the copy fails (disk full, interrupt, etc.) the existing installed binary is not touched; the incomplete temp file can be removed without corrupting the installation.
  • Running processes remain valid: on Unix, processes holding the old inode continue to run unaffected after the file at the destination is replaced.
  • Correct final state: permissions and any finalization (e.g. fsync if added) can be applied to the temp file before it becomes visible at the final path.

Implementation notes

  • The temp file is created inside `binDir` to ensure the rename is a same- filesystem move (required for atomicity).
  • If creating a symlink at `/usr/local/bin/solo-provisioner` fails the step logs a warning but does not treat this as a hard error (installation can still succeed without the symlink).
  • The step returns an automa success or failure report describing the outcome.
  • Elevated permissions (e.g. `sudo`) are typically required to write to the system `binDir` or create the symlink in `/usr/local/bin`.

Usage

  • Intended to be executed as part of an installation workflow; callers should ensure the process has the required permissions when calling this step.

func InstallWeaverServiceStep added in v0.17.0

func InstallWeaverServiceStep() *automa.StepBuilder

InstallWeaverServiceStep installs the solo-provisioner systemd service unit file, runs daemon-reload, and enables the service.

func IsTeleportPodsReady added in v0.7.0

func IsTeleportPodsReady() automa.Builder

func PurgeBlockNodeStorage added in v0.8.0

func PurgeBlockNodeStorage(inputs models.BlockNodeInputs) *automa.WorkflowBuilder

PurgeBlockNodeStorage scales down the block node and clears all storage. This does NOT scale back up - use ResetBlockNode if you need to restart the pod after clearing.

func RecreateBlockNodeStorage added in v0.17.0

func RecreateBlockNodeStorage(inputs models.BlockNodeInputs) *automa.WorkflowBuilder

RecreateBlockNodeStorage deletes existing PVs/PVCs, creates storage directories at the new paths, then creates fresh PVs/PVCs bound to those directories. It is used in the reconfigure --with-reset workflow to apply storage path changes.

func RefreshSystemPackageIndex

func RefreshSystemPackageIndex() *automa.StepBuilder

RefreshSystemPackageIndex refreshes the system package index. Essentially this is equivalent to running `apt-get update` on Debian-based systems

func RemoveConfigDirectories added in v0.7.0

func RemoveConfigDirectories() *automa.StepBuilder

RemoveConfigDirectories removes configuration directories created during cluster setup

func RemoveSudoersStep added in v0.17.0

func RemoveSudoersStep() *automa.StepBuilder

RemoveSudoersStep removes the weaver sudoers entry from /etc/sudoers.d/solo-provisioner.

func RemoveSystemPackage

func RemoveSystemPackage(name string, installer func() (software.Package, error)) *automa.StepBuilder

RemoveSystemPackage removes a system package using the provided installer function. The installer function should return a software.Package instance that knows how to uninstall the package. If the package is not installed, it will skip the removal.

func RemoveSystemdServiceFiles added in v0.7.0

func RemoveSystemdServiceFiles() *automa.StepBuilder

RemoveSystemdServiceFiles removes systemd service files created during cluster setup

func RemoveWeaverServiceStep added in v0.17.0

func RemoveWeaverServiceStep() *automa.StepBuilder

RemoveWeaverServiceStep disables and removes the solo-provisioner systemd service unit file.

func ResetBlockNode added in v0.8.0

func ResetBlockNode(inputs models.BlockNodeInputs) *automa.WorkflowBuilder

ResetBlockNode resets the block node by clearing all storage and restarting the pod

func ResetCluster added in v0.7.0

func ResetCluster() *automa.StepBuilder

ResetCluster runs kubeadm reset to tear down the Kubernetes cluster

func RolloutRestartBlockNode added in v0.17.0

func RolloutRestartBlockNode(inputs models.BlockNodeInputs) *automa.WorkflowBuilder

RolloutRestartBlockNode restarts the block node pod by scaling the StatefulSet down to 0, waiting for termination, scaling back up to 1, and waiting for readiness. This reuses the existing ScaleStatefulSet infrastructure and guarantees the pod picks up any configuration changes (including ConfigMap-only updates) that Helm did not propagate via a pod-spec diff.

func SetupAlloy added in v0.7.0

func SetupAlloy() *automa.WorkflowBuilder

SetupAlloy returns a workflow builder that sets up Grafana Alloy for observability.

func SetupAlloyStack added in v0.7.0

func SetupAlloyStack() *automa.WorkflowBuilder

SetupAlloyStack returns a workflow builder that sets up the complete Alloy observability stack. This includes Prometheus Operator CRDs and Grafana Alloy. K8s secrets containing passwords for remote endpoints must be pre-created before running this. Secrets can be created manually, via ESO/Vault, Terraform, or any other mechanism.

func SetupBindMounts

func SetupBindMounts() *automa.WorkflowBuilder

func SetupBlockNode

func SetupBlockNode(inputs models.BlockNodeInputs) *automa.WorkflowBuilder

SetupBlockNode sets up the block node on the cluster

func SetupExternalSecrets added in v0.7.0

func SetupExternalSecrets() *automa.WorkflowBuilder

SetupExternalSecrets returns a workflow builder that sets up External Secrets Operator.

func SetupHomeDirectoryStructure

func SetupHomeDirectoryStructure(pp models.WeaverPaths) *automa.StepBuilder

func SetupMetalLB

func SetupMetalLB() *automa.WorkflowBuilder

func SetupPrometheusOperatorCRDs added in v0.7.0

func SetupPrometheusOperatorCRDs() *automa.WorkflowBuilder

SetupPrometheusOperatorCRDs returns a workflow builder that sets up Prometheus Operator CRDs. These CRDs are required for ServiceMonitor and PodMonitor support in Alloy.

func SetupSystemdService

func SetupSystemdService(serviceName string) *automa.StepBuilder

SetupSystemdService enables and starts a systemd service by name It also reloads the systemd daemon to apply any changes Example: SetupSystemdService("kubelet")

func SetupTeleportClusterAgent added in v0.7.0

func SetupTeleportClusterAgent() *automa.WorkflowBuilder

SetupTeleportClusterAgent returns a workflow builder that sets up the Teleport Kubernetes agent. This provides secure, identity-aware access to the Kubernetes cluster with full audit logging. All configuration including RBAC is provided via the Helm values file. Used by 'solol-provisioner teleport cluster install' command.

func SetupTeleportNodeAgent added in v0.7.0

func SetupTeleportNodeAgent(mr software.MachineRuntime) *automa.WorkflowBuilder

SetupTeleportNodeAgent returns a workflow builder that sets up the Teleport node agent. This provides SSH access to the node via Teleport with full session recording. Used by 'solo-provisioner teleport node install' command.

func Sleep

func Sleep(ctx context.Context, d time.Duration) error

Sleep sleeps for the given duration or returns early if the context is canceled or its deadline expires. Returns nil on success or ctx.Err() on cancellation.

func StartCilium

func StartCilium() *automa.WorkflowBuilder

func TeardownAlloyStack added in v0.7.0

func TeardownAlloyStack() *automa.WorkflowBuilder

TeardownAlloyStack returns a workflow builder that tears down the complete Alloy observability stack. This removes Grafana Alloy, Node Exporter, and Prometheus Operator CRDs.

func TeardownBindMounts added in v0.7.0

func TeardownBindMounts() *automa.WorkflowBuilder

TeardownBindMounts removes bind mounts and their fstab entries

func TeardownPrometheusOperatorCRDs added in v0.7.0

func TeardownPrometheusOperatorCRDs() *automa.WorkflowBuilder

TeardownPrometheusOperatorCRDs returns a workflow builder that tears down Prometheus Operator CRDs.

func TeardownSystemdService added in v0.7.0

func TeardownSystemdService(serviceName string) *automa.StepBuilder

TeardownSystemdService stops and disables a systemd service Used during cluster uninstall/teardown

func TeardownTeleportClusterAgent added in v0.16.0

func TeardownTeleportClusterAgent() *automa.WorkflowBuilder

TeardownTeleportClusterAgent creates a workflow to uninstall the Teleport Kubernetes cluster agent. It detects whether the Helm release is installed and removes it if present.

func TeardownTeleportNodeAgent added in v0.16.0

func TeardownTeleportNodeAgent(mr software.MachineRuntime) *automa.WorkflowBuilder

TeardownTeleportNodeAgent creates a workflow to uninstall the Teleport node agent. It stops the systemd service, removes configuration, and uninstalls binaries (reverse of install).

func UninstallBlockNode added in v0.12.0

func UninstallBlockNode(inputs models.BlockNodeInputs) *automa.WorkflowBuilder

func UninstallWeaver added in v0.7.0

func UninstallWeaver(binDir string) *automa.StepBuilder

func UpgradeBlockNode added in v0.5.0

func UpgradeBlockNode(inputs models.BlockNodeInputs) *automa.WorkflowBuilder

UpgradeBlockNode upgrades the block node on the cluster.

The upgradeBlockNode step deletes the helm-owned Services immediately before calling helm so that helm recreates them as fresh CREATE events. Cilium's eBPF service reconciler drops the `spec.type` transition UPDATE event (the root cause of #619) but handles CREATE cleanly, so the topology flip heals itself without any kube-system-wide Cilium DaemonSet restart. The delete is placed AFTER preflight (migration discovery, values-file rendering) so a preflight failure leaves the Services intact — the failure window between delete and helm shrinks to a function call. The post-upgrade reachability probe converts any remaining failure mode (Cilium, MetalLB, chart, firewall) into a loud workflow error. See #644.

Types

This section is empty.

Jump to

Keyboard shortcuts

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