Documentation
¶
Index ¶
- Constants
- Variables
- func AutoRemoveOrphanedPackages() *automa.StepBuilder
- func CheckClusterCRDs(id string, crds []string, timeout time.Duration, ...) *automa.StepBuilder
- func CheckClusterConfigMaps(id string, configMaps []string, timeout time.Duration, ...) *automa.StepBuilder
- func CheckClusterHealth() *automa.WorkflowBuilder
- func CheckClusterNamespaces(id string, namespaces []string, timeout time.Duration, ...) *automa.StepBuilder
- func CheckClusterNodesReady(id string, provider kube.ClientProviderFromContext) *automa.StepBuilder
- func CheckClusterPodsReady(id string, podNames []string, timeout time.Duration, ...) *automa.StepBuilder
- func CheckClusterServices(id string, services []string, timeout time.Duration, ...) *automa.StepBuilder
- func CheckWeaverInstallation(binDir string) *automa.StepBuilder
- func CleanupWeaverFiles() *automa.StepBuilder
- func ConfigureSysctlForKubernetes() *automa.WorkflowBuilder
- func CreateTeleportNamespace() automa.Builder
- func DeployMetricsServer(valueOptions *values.Options) *automa.WorkflowBuilder
- func DisableSwap() *automa.StepBuilder
- func InitializeCluster() *automa.StepBuilder
- func InstallKernelModule(name string) *automa.StepBuilder
- func InstallSystemPackage(name string, installer func() (software.Package, error)) *automa.StepBuilder
- func InstallTeleportKubeAgent() automa.Builder
- func InstallWeaver(binDir string) *automa.StepBuilder
- func IsTeleportPodsReady() automa.Builder
- func RefreshSystemPackageIndex() *automa.StepBuilder
- func RemoveConfigDirectories() *automa.StepBuilder
- func RemoveSystemPackage(name string, installer func() (software.Package, error)) *automa.StepBuilder
- func RemoveSystemdServiceFiles() *automa.StepBuilder
- func ResetCluster() *automa.StepBuilder
- func SetupAlloy() *automa.WorkflowBuilder
- func SetupAlloyStack() *automa.WorkflowBuilder
- func SetupBindMounts() *automa.WorkflowBuilder
- func SetupBlockNode(profile string, valuesFile string) *automa.WorkflowBuilder
- func SetupCilium() *automa.WorkflowBuilder
- func SetupCrio() *automa.WorkflowBuilder
- func SetupExternalSecrets() *automa.WorkflowBuilder
- func SetupHelm() *automa.WorkflowBuilder
- func SetupHomeDirectoryStructure(pp *core.WeaverPaths) *automa.StepBuilder
- func SetupK9s() *automa.WorkflowBuilder
- func SetupKubeadm() *automa.WorkflowBuilder
- func SetupKubectl() *automa.WorkflowBuilder
- func SetupKubelet() *automa.WorkflowBuilder
- func SetupMetalLB() *automa.WorkflowBuilder
- func SetupPrometheusOperatorCRDs() *automa.WorkflowBuilder
- func SetupSystemdService(serviceName string) *automa.StepBuilder
- func SetupTeleportClusterAgent() *automa.WorkflowBuilder
- func SetupTeleportNodeAgent() *automa.WorkflowBuilder
- func Sleep(ctx context.Context, d time.Duration) error
- func StartCilium() *automa.WorkflowBuilder
- func TeardownAlloyStack() *automa.WorkflowBuilder
- func TeardownBindMounts() *automa.WorkflowBuilder
- func TeardownPrometheusOperatorCRDs() *automa.WorkflowBuilder
- func TeardownSystemdService(serviceName string) *automa.StepBuilder
- func UninstallWeaver(binDir string) *automa.StepBuilder
- func UpgradeBlockNode(profile string, valuesFile string, reuseValues bool) *automa.WorkflowBuilder
Constants ¶
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" )
const ( AlloyNamespace = "grafana-alloy" AlloyRelease = "grafana-alloy" AlloyChart = "grafana/alloy" AlloyVersion = "1.4.0" AlloyRepo = "https://grafana.github.io/helm-charts" NodeExporterNamespace = "node-exporter" NodeExporterRelease = "node-exporter" NodeExporterChart = "oci://registry-1.docker.io/bitnamicharts/node-exporter" NodeExporterVersion = "4.5.19" SetupAlloyStepId = "setup-alloy" InstallAlloyStepId = "install-alloy" InstallNodeExporterStepId = "install-node-exporter" AlloyTemplatePath = "files/alloy/config.alloy" DeployAlloyConfigStepId = "deploy-alloy-config" CreateAlloyNamespaceStepId = "create-alloy-namespace" CreateAlloySecretsStepId = "create-alloy-secrets" IsAlloyReadyStepId = "is-alloy-ready" IsNodeExporterReadyStepId = "is-node-exporter-ready" AlloyConfigMapName = "grafana-alloy-cm" AlloySecretsName = "grafana-alloy-secrets" AlloyExternalSecretName = "grafana-alloy-external-secret" AlloyClusterSecretStoreName = "vault-secret-store" )
const ( KeyModifiedByThisStep = "modifiedByThisStep" KeyBindTarget = "bindTarget" KeyBindMount = "bindMount" KeyAlreadyMounted = "alreadyMounted" KeyAlreadyInFstab = "alreadyInFstab" )
const ( SetupBlockNodeStepId = "setup-block-node" SetupBlockNodeStorageStepId = "setup-block-node-storage" CreateBlockNodeNamespaceStepId = "create-block-node-namespace" CreateBlockNodePVsStepId = "create-block-node-pvs" InstallBlockNodeStepId = "install-block-node" UpgradeBlockNodeStepId = "upgrade-block-node" AnnotateBlockNodeServiceStepId = "annotate-block-node-service" WaitForBlockNodeStepId = "wait-for-block-node" )
const ( ExternalSecretsNamespace = "external-secrets" ExternalSecretsRelease = "external-secrets" ExternalSecretsChart = "external-secrets/external-secrets" ExternalSecretsVersion = "0.20.2" ExternalSecretsRepo = "https://charts.external-secrets.io" SetupExternalSecretsStepId = "setup-external-secrets" InstallExternalSecretsStepId = "install-external-secrets" IsExternalSecretsReadyStepId = "is-external-secrets-ready" )
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" )
const ( MetalLBNamespace = "metallb-system" MetalLBRelease = "metallb" MetalLBChart = "metallb/metallb" MetalLBVersion = "0.15.2" MetalLBRepo = "https://metallb.github.io/metallb" 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" )
const ( MetricsServerNamespace = "kube-system" MetricsServerRelease = "metrics-server" MetricsServerChart = "metrics-server/metrics-server" MetricsServerChartVersion = "3.13.0" MetricsServerRepo = "https://kubernetes-sigs.github.io/metrics-server" )
const ( PrometheusOperatorCRDsNamespace = "grafana-alloy" PrometheusOperatorCRDsRelease = "prometheus-operator-crds" PrometheusOperatorCRDsChart = "oci://ghcr.io/prometheus-community/charts/prometheus-operator-crds" PrometheusOperatorCRDsVersion = "24.0.1" SetupPrometheusCRDsStepId = "setup-prometheus-crds" InstallPrometheusCRDsStepId = "install-prometheus-crds" IsPrometheusCRDsReadyStepId = "is-prometheus-crds-ready" )
const ( ConfigureSysctlForKubernetesStepId = "configure-sysctl-for-kubernetes" SysCtlBackupFilename = "sysctl.conf" KeyBackupFile = "backup_file" KeyReloadedFiles = "reloaded_files" KeyCopiedFiles = "copied_files" KeyRemovedFiles = "removed_files" KeyWarnings = "warnings" )
const ( TeleportNamespace = "teleport-agent" TeleportRelease = "teleport-agent" TeleportChart = "teleport/teleport-kube-agent" TeleportRepo = "https://charts.releases.teleport.dev" TeleportDefaultVersion = deps.TELEPORT_VERSION SetupTeleportStepId = "setup-teleport" InstallTeleportStepId = "install-teleport" CreateTeleportNamespaceStepId = "create-teleport-namespace" IsTeleportReadyStepId = "is-teleport-ready" )
const (
DisableSwapStepId = "disable-swap"
)
Variables ¶
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, core.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 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 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 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 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 IsTeleportPodsReady ¶ added in v0.7.0
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 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 ResetCluster ¶ added in v0.7.0
func ResetCluster() *automa.StepBuilder
ResetCluster runs kubeadm reset to tear down the Kubernetes cluster
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.
func SetupBindMounts ¶
func SetupBindMounts() *automa.WorkflowBuilder
func SetupBlockNode ¶
func SetupBlockNode(profile string, valuesFile string) *automa.WorkflowBuilder
SetupBlockNode sets up the block node on the cluster
func SetupCilium ¶
func SetupCilium() *automa.WorkflowBuilder
func SetupCrio ¶
func SetupCrio() *automa.WorkflowBuilder
func SetupExternalSecrets ¶ added in v0.7.0
func SetupExternalSecrets() *automa.WorkflowBuilder
SetupExternalSecrets returns a workflow builder that sets up External Secrets Operator.
func SetupHelm ¶
func SetupHelm() *automa.WorkflowBuilder
func SetupHomeDirectoryStructure ¶
func SetupHomeDirectoryStructure(pp *core.WeaverPaths) *automa.StepBuilder
func SetupK9s ¶
func SetupK9s() *automa.WorkflowBuilder
func SetupKubeadm ¶
func SetupKubeadm() *automa.WorkflowBuilder
func SetupKubectl ¶
func SetupKubectl() *automa.WorkflowBuilder
func SetupKubelet ¶
func SetupKubelet() *automa.WorkflowBuilder
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() *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 ¶
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 UninstallWeaver ¶ added in v0.7.0
func UninstallWeaver(binDir string) *automa.StepBuilder
func UpgradeBlockNode ¶ added in v0.5.0
func UpgradeBlockNode(profile string, valuesFile string, reuseValues bool) *automa.WorkflowBuilder
UpgradeBlockNode upgrades the block node on the cluster
Types ¶
This section is empty.
Source Files
¶
- const.go
- helpers.go
- report.go
- step_alloy.go
- step_bind_mounts.go
- step_block_node.go
- step_cilium.go
- step_cluster_configmaps.go
- step_cluster_crds.go
- step_cluster_namespace.go
- step_cluster_node_ready.go
- step_cluster_pod_ready.go
- step_cluster_services.go
- step_cluster_uninstall.go
- step_crio.go
- step_disable_swap.go
- step_external_secrets.go
- step_health.go
- step_helm.go
- step_k9s.go
- step_kubeadm.go
- step_kubectl.go
- step_kubelet.go
- step_metallb.go
- step_metrics_server.go
- step_prometheus_operator_crds.go
- step_setup_directories.go
- step_sysctl.go
- step_system_module.go
- step_system_package.go
- step_systemd_service.go
- step_teleport.go
- step_weaver.go