models

package
v0.34.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ConsensusDefaultNamespace is the default namespace / Orbit name for a
	// consensus deployment (sourced from pkg/deps alongside the other install-plan
	// defaults). Deploy multiple networks by using a distinct namespace per orbit.
	ConsensusDefaultNamespace = deps.CONSENSUS_NODE_NAMESPACE

	ConsensusDefaultContainerName = "consensus-node"
	ConsensusDefaultJavaHeapMin   = "512m"
	ConsensusDefaultJavaHeapMax   = "2g"
	ConsensusDefaultJavaOpts      = "" /* 179-byte string literal not displayed */
	ConsensusDefaultCPULimit      = "2"
	ConsensusDefaultCPURequest    = "250m"
	ConsensusDefaultMemoryLimit   = "4Gi"
	ConsensusDefaultMemoryRequest = "2Gi"

	// UC (Update Coordinator) sidecar image. The operator provides NO built-in
	// default for it, so the capsule must declare it explicitly or the operator
	// rejects the capsule with ImageRequired. It is the
	// operator's own image, so the tag tracks the operator/chart version. Sourced
	// from pkg/deps alongside the block-node install-plan defaults.
	ConsensusDefaultUCImageRepo = deps.CONSENSUS_NODE_UC_IMAGE
	ConsensusDefaultUCImageTag  = deps.CONSENSUS_NODE_UC_VERSION

	// ConsensusDefaultImagePullSecret is the name of the image-pull secret the
	// operator threads onto the consensus-node and UC containers so they can pull
	// the private consensus/UC images (e.g. from ghcr.io). It must name a
	// docker-registry secret that exists in the node's namespace; create it with
	// `task uat:secrets`. Empty disables it (public images only).
	ConsensusDefaultImagePullSecret = deps.CONSENSUS_NODE_IMAGE_PULL_SECRET
)

Consensus-node container defaults. Used as flag defaults and as the fallback when an input field is left empty. The Java heap must be set explicitly; without it the JVM defaults MaxHeapSize to 25% of the memory limit, which stalls the node on startup. The memory limit must cover heap + direct memory PLUS the JVM's native footprint (metaspace, thread stacks, GC/JIT code cache, netty buffers), which a consensus node consumes heavily — a 1g-heap/512m-direct node still exceeds a 2Gi limit once warmed up and gets OOMKilled. These defaults are a single/local-node baseline (2g heap + 512m direct + native fit under 4Gi); production networks should raise them via flags.

View Source
const (
	ConfigKeyLog4j2              = "log4j2"
	ConfigKeySettings            = "settings"
	ConfigKeyAppProperties       = "application-properties"
	ConfigKeyAppOverride         = "application-override-properties"
	ConfigKeyApiPermission       = "api-permission-properties"
	ConfigKeyBootstrap           = "bootstrap-properties"
	ConfigKeyNodeProperties      = "node-properties"
	ConfigKeyFeeSchedules        = "fee-schedules"
	ConfigKeySimpleFeesSchedules = "simple-fees-schedules"
	ConfigKeyThrottles           = "throttles"
	ConfigKeyBlockNodes          = "block-nodes"
)

Config keys identify each consensus config file across resolution, hashing, and CR application. They double as the ConfigSources / ConfigHashes map keys.

View Source
const (
	ConfigSourcePackage  = "deployment-package"
	ConfigSourceEmbedded = "embedded"
)

Config content sources, stored in ConfigSources and ConfigHashEntry.Source.

View Source
const (
	ConsensusVolumeUpgrade = "upgrade"
	ConsensusVolumeLogs    = "logs"
	ConsensusVolumeStats   = "stats"
	ConsensusVolumeSaved   = "saved"
	ConsensusVolumeState   = "state"
	ConsensusVolumeBlocks  = "blocks"
	ConsensusVolumeRecords = "records"
	ConsensusVolumeEvents  = "events"
)

Consensus data-volume names. These MUST match the solo-operator's VolumeType* identifiers (its internal/resources/consensus/common.go) — a PodProperties volume override or PVC entry only binds to a built-in volume when the name matches exactly. Duplicated here because the operator's constants live in an internal/ package weaver cannot import.

View Source
const (
	VolumeBackingEmptyDir = "emptydir"
	VolumeBackingHostPath = "hostpath"
	VolumeBackingPVC      = "pvc"
)

Backing types a consensus data volume can use.

View Source
const (
	AccessModeReadWriteOnce    = "ReadWriteOnce"
	AccessModeReadWriteOncePod = "ReadWriteOncePod"
)

PVC access modes valid for a consensus node. A CN pod is a single writer, so only the single-writer modes are sound:

  • ReadWriteOnce: universal; supported by every provisioner.
  • ReadWriteOncePod: strictly stronger (single pod, not just single node), but requires k8s >=1.29 and a CSI driver that advertises it.

ReadWriteMany (many writers) is pointless for a single pod, and ReadOnlyMany makes the node crash on its first write to state/saved/streams — both are rejected up front so a mistyped or unsound access mode fails at the CLI rather than leaving a Pending PVC or a crash-looping pod. Whether the chosen mode is actually satisfiable against the target StorageClass is cluster-specific and surfaces at bind time; weaver cannot pre-validate that.

View Source
const (
	// ConsensusDefaultVolumeBacking is the fallback backing when neither a per-volume
	// setting nor --default-volume-type is given. emptyDir mirrors the operator's own
	// default (ephemeral); persistence is opt-in.
	ConsensusDefaultVolumeBacking = VolumeBackingEmptyDir

	// ConsensusDefaultPVCAccessMode is the fallback PVC access mode.
	ConsensusDefaultPVCAccessMode = AccessModeReadWriteOnce
)

Consensus volume defaults.

View Source
const (
	DefaultHistoricRetention = "0"
	DefaultRecentRetention   = "96000"
)

Default retention thresholds for block node plugins. These match the Hiero Block Node defaults:

  • Historic: 0 means no/unlimited retention (keep all historic blocks)
  • Recent: 96000 blocks preserved on disk before deleting older files
View Source
const (
	// Node types
	NodeTypeLocal     = "local"
	NodeTypeBlock     = "block"
	NodeTypeConsensus = "consensus"
	NodeTypeMirror    = "mirror"
	NodeTypeRelay     = "relay"
)
View Source
const (
	// File and directory permissions
	DefaultDirOrExecPerm = 0o755 // for directories and executable files
	// DefaultStorageDirPerm is 2775 with setgid. Must use fs.ModeSetgid (1<<23), not the
	// Unix octal 02000, because Go's os.Chmod checks fs.ModeSetgid — passing 0o2775 directly
	// silently drops the setgid bit (0o2775 & (1<<23) == 0).
	DefaultStorageDirPerm = fs.ModeSetgid | 0o775
	DefaultFilePerm       = 0o644 // for regular data/config files

	// Weaver paths
	DefaultWeaverHome       = "/opt/solo/weaver"
	DefaultUnpackFolderName = "unpack"
	SystemBinDir            = "/usr/local/bin"
	SystemdUnitFilesDir     = "/usr/lib/systemd/system"
)
View Source
const (
	// Deployment profiles
	ProfileLocal      = "local"
	ProfilePerfnet    = "perfnet"
	ProfileTestnet    = "testnet"
	ProfilePreviewnet = "previewnet"
	ProfileMainnet    = "mainnet"
)
View Source
const DefaultClusterPodCIDR = "10.4.0.0/14"

DefaultClusterPodCIDR is the cluster-wide pod subnet. It is the single source of truth shared by the kubeadm init config (networking.podSubnet, rendered via templates.KubeadmInitData.PodSubnet) and the host firewall's default --pod-cidr (the in-cluster host-service ports rule). Keeping both off one constant guarantees the firewall opens exactly the range kubeadm assigns pods.

View Source
const DefaultNoProxy = "localhost,127.0.0.1,::1,.local,.svc,.cluster.local,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"

DefaultNoProxy is the default value for NO_PROXY, covering localhost and private/cluster-local networks commonly used in Kubernetes environments.

Variables

View Source
var (
	// ErrPropertyResolution holds remediation hints. Must alias errx's property —
	// errorx compares properties by pointer, so a re-registration is invisible to errx.Hints.
	ErrPropertyResolution = errx.PropertyResolution

	// ErrPropertyReason holds the machine-readable reason code. Prefer errx.WithReason
	// or errx.Decorate over setting it directly. Printable: it renders in err.Error().
	ErrPropertyReason = errx.PropertyReason

	// ErrPropertyWhyFloor is the errorx property key used to attach the rule
	// attribution string ("Why:") that produced the binding hardware floor for a
	// failed hardware check. Set by hardware check workflow steps; consumed by
	// doctor.checkErrCompact to display "Set by: <reason>" in the error panel.
	ErrPropertyWhyFloor = errorx.RegisterProperty("whyFloor")
)

Functions

func AllExecutionModes

func AllExecutionModes() []automa.TypeMode

func AllNodeTypes

func AllNodeTypes() []string

func ConsensusCapsuleName added in v0.31.0

func ConsensusCapsuleName(orbitName string, nodeId int64) string

ConsensusCapsuleName returns the CR name for a ConsensusCapsule (e.g. "myorbit-consensus-0").

func ConsensusConfigCRName added in v0.31.0

func ConsensusConfigCRName(scope, configKey string) string

ConsensusConfigCRName returns the config CR / managed ConfigMap / capsule ref name for a config key on a node, e.g. ConsensusConfigCRName("node0", ConfigKeyAppProperties) == "node0-application-properties".

func ConsensusNodeScope added in v0.31.0

func ConsensusNodeScope(nodeId int64) string

ConsensusNodeScope returns the node-local scope for a consensus node (e.g. "node0"). Use this for names of resources that live inside the node's namespace (secrets, config CR refs, secret key filenames) — the namespace already disambiguates them across orbits, so they stay node-local.

func ConsensusNodeStateKey added in v0.31.0

func ConsensusNodeStateKey(namespace string, nodeId int64) string

ConsensusNodeStateKey returns the orbit-qualified key for solo-weaver's local state and reality maps (e.g. "hiero-network-1/node0"). Because the same nodeId can be deployed into multiple orbits in one cluster, the local state key must include the namespace/orbit — a bare "node0" would collide across orbits and overwrite entries in state.yaml. This is NOT a cluster resource name; it never appears on any Kubernetes object.

func ConsensusVolumeNames added in v0.34.0

func ConsensusVolumeNames() []string

ConsensusVolumeNames returns the data-volume names in a stable order.

func IsEqualMap

func IsEqualMap(a, b StringMap) bool

IsEqualMap compares two automa.StateBag values using Items()

func IsValidCNAccessMode added in v0.34.0

func IsValidCNAccessMode(mode string) bool

IsValidCNAccessMode reports whether mode is a PVC access mode a consensus node may use (the single-writer subset).

func IsValidVolumeBacking added in v0.34.0

func IsValidVolumeBacking(t string) bool

IsValidVolumeBacking reports whether t is a supported backing type.

func IsValidVolumeName added in v0.34.0

func IsValidVolumeName(name string) bool

IsValidVolumeName reports whether name is one of the consensus data volumes.

func SetPaths added in v0.27.0

func SetPaths(home string) func()

SetPaths re-roots the process-wide Weaver paths at the given home directory and returns a function that restores the previous paths. It exists so tests can redirect path lookups that are hard-wired to Paths() (e.g. the state-file readers in internal/state) at a temporary directory. Not for production use.

restore := models.SetPaths(t.TempDir())
defer restore()

func SupportedProfiles added in v0.16.0

func SupportedProfiles() []string

SupportedProfiles returns all supported deployment profiles ordered by environment criticality (production → development). This ordering is also used by TUI select prompts, so changing it affects how options are displayed to the user.

func ValidatePluginList added in v0.17.0

func ValidatePluginList(s string) error

ValidatePluginList returns an error when s is not a valid comma-separated plugin list (non-empty, no surrounding whitespace per entry, no empty tokens).

Types

type ActionType

type ActionType string
const (
	// ActionSetup sets up the base system required for further actions.
	// This includes installing dependencies, configuring system settings, etc.
	// It should be safe to run multiple times without adverse effects.
	ActionSetup ActionType = "setup"

	// ActionInstall installs the application or component on the system.
	// It should check if the application is already installed and skip installation if so.
	// Running this action multiple times should not result in multiple installations.
	ActionInstall ActionType = "install"

	// ActionUninstall removes the application or component from the system.
	// It should ensure that all related files and configurations are cleaned up.
	// Running this action multiple times should not cause errors if the application is already uninstalled.
	ActionUninstall ActionType = "uninstall"

	// ActionReset resets the system or application to a clean state as if it were newly installed.
	// It should remove any user data, configurations, or changes made after installation.
	// Running this action multiple times should consistently return the system to the clean state.
	ActionReset ActionType = "reset"

	// ActionDeploy deploys the application or component to the target cluster
	ActionDeploy ActionType = "deploy"

	// ActionDestroy removes the application or component from the target cluster
	ActionDestroy ActionType = "destroy"

	// ActionUpgrade upgrades the application or component to a newer version
	ActionUpgrade ActionType = "upgrade"

	// ActionMigrate migrates the application or component to a different environment or configuration
	ActionMigrate ActionType = "migrate"

	// ActionReconfigure re-applies configuration to an already-deployed component without changing its version.
	ActionReconfigure ActionType = "reconfigure"
)

All actions must be idempotent meaning it only applies if system is not at the desired end state of the action.

type AlloyConfig

type AlloyConfig struct {
	MonitorBlockNode       bool                `yaml:"monitorBlockNode" json:"monitorBlockNode"`
	ClusterName            string              `yaml:"clusterName" json:"clusterName"`
	Environment            string              `yaml:"environment" json:"environment"`                       // "environment" label override; empty falls back to the deployment profile
	ClusterSecretStoreName string              `yaml:"clusterSecretStoreName" json:"clusterSecretStoreName"` // Name of the ClusterSecretStore for ESO
	PrometheusRemotes      []AlloyRemoteConfig `yaml:"prometheusRemotes" json:"prometheusRemotes"`
	LokiRemotes            []AlloyRemoteConfig `yaml:"lokiRemotes" json:"lokiRemotes"`
	// Deprecated: Use PrometheusRemotes instead. Kept for backward compatibility.
	PrometheusURL      string `yaml:"prometheusUrl" json:"prometheusUrl"`
	PrometheusUsername string `yaml:"prometheusUsername" json:"prometheusUsername"`
	// Deprecated: Use LokiRemotes instead. Kept for backward compatibility.
	LokiURL      string `yaml:"lokiUrl" json:"lokiUrl"`
	LokiUsername string `yaml:"lokiUsername" json:"lokiUsername"`
}

AlloyConfig represents the `alloy` configuration block for observability. Note: Passwords are managed via Vault and External Secrets Operator, not in config files.

func (*AlloyConfig) Validate

func (c *AlloyConfig) Validate() error

Validate validates all Alloy configuration fields.

type AlloyRemoteConfig

type AlloyRemoteConfig struct {
	Name         string `yaml:"name" json:"name"`                 // Unique identifier for this remote
	URL          string `yaml:"url" json:"url"`                   // Remote write URL
	Username     string `yaml:"username" json:"username"`         // Basic auth username
	LabelProfile string `yaml:"labelProfile" json:"labelProfile"` // Label profile name (e.g. ops) for auto-derived labels
}

AlloyRemoteConfig represents a single remote endpoint for metrics or logs. Passwords are expected in K8s Secret "grafana-alloy-secrets" under conventional keys:

  • Prometheus: PROMETHEUS_PASSWORD_<NAME>
  • Loki: LOKI_PASSWORD_<NAME>

type BlockNodeConfig

type BlockNodeConfig struct {
	Namespace         string           `yaml:"namespace" json:"namespace"`
	Release           string           `yaml:"release" json:"release"`
	Chart             string           `yaml:"chart" json:"chart"`
	ChartVersion      string           `yaml:"version" json:"version" mapstructure:"version"`
	ChartName         string           `yaml:"chartName" json:"chartName"`
	Storage           BlockNodeStorage `yaml:"storage" json:"storage"`
	HistoricRetention string           `yaml:"historicRetention,omitempty" json:"historicRetention,omitempty"`
	RecentRetention   string           `yaml:"recentRetention,omitempty" json:"recentRetention,omitempty"`
}

BlockNodeConfig represents the `blockNode` configuration block.

func (*BlockNodeConfig) Validate

func (c *BlockNodeConfig) Validate() error

Validate validates all block node configuration fields to ensure they are safe and secure. This performs early validation of user-provided configuration to catch security issues before workflow execution begins.

type BlockNodeInputs

type BlockNodeInputs struct {
	Profile      string
	Namespace    string
	Release      string // Helm release name
	Chart        string // Helm chart reference: OCI, URL, or repo/chart
	ChartName    string
	ChartVersion string
	Storage      BlockNodeStorage
	ValuesFile   string
	ReuseValues  bool
	ResetStorage bool
	PurgeStorage bool // When true, also delete PVCs/PVs (implies ResetStorage)
	NoRestart    bool // When true, skip the rollout-restart step after reconfigure
	// LeaveScaledDown ends the operation with the StatefulSet at 0 replicas
	// instead of scaling it back up (from --no-scale-up). Negative polarity so
	// the zero value is the long-standing behaviour — a caller that never sets it
	// gets a running node. Only reset keeps the pod down throughout: reconfigure
	// and upgrade run `helm upgrade` with Wait=true, so the pod starts and becomes
	// ready before the trailing scale-down lands.
	LeaveScaledDown     bool
	SkipHardwareChecks  bool
	LoadBalancerEnabled bool   // true = inject metallb.io/address-pool annotation via Helm values
	HistoricRetention   string // FILES_HISTORIC_BLOCK_RETENTION_THRESHOLD (0 = unlimited)
	RecentRetention     string // FILES_RECENT_BLOCK_RETENTION_THRESHOLD (~96000 default)
	PluginPreset        string // preset ID (e.g. "tier1-lfh"), "custom", or "none" (no override); empty/"none" = use --values or chart default
	PluginList          string // resolved comma-separated plugin list injected into plugins.names
	// TrafficShapingEnabled gates the BN workload network-policy plane (inet
	// weaver classification) and tc HTB traffic shaping (from
	// --traffic-shaping-enabled). When false, the network-setup workflow skips
	// creating the policy plane and tc config entirely, and the caller skips
	// offering the traffic-shaper daemon — there is nothing left for it to
	// reconcile without the policy plane's classification.
	TrafficShapingEnabled bool
	EgressInterface       string // physical NIC for the $EGRESS HTB hierarchy; auto-detected from the default route when empty
	LinkRate              string // tc-style NIC line rate override (e.g. "1gbit"); empty = auto-detect from sysfs at boot
	// ShapeOverrides carries per-class HTB bandwidth overrides from --shape,
	// keyed by class name. Empty = use the profile defaults for every class.
	// Held as a neutral type so pkg/models stays decoupled from the shape
	// package; the install workflow converts it at the call site.
	ShapeOverrides map[string]ShapeOverride
	// Timeout caps the block-node Helm install/upgrade (the `--atomic` wait
	// budget), set from `--timeout`. Zero means "unset" — the install/upgrade
	// call site falls back to helm.DefaultTimeout (5m).
	Timeout time.Duration
	// StatuszBaseURL and StatuszPollInterval are operator-supplied overrides for
	// the daemon's block-node statusz monitor, from `--statusz-base-url` and
	// `--statusz-poll-interval` on `block node install` / `reconfigure`. They are
	// merged into daemon.yaml's components.block_node.statusz block at write time,
	// per-field: a set value overrides that field, an empty one preserves the
	// existing on-disk value. Empty for both means "leave the operator's daemon.yaml
	// statusz block untouched". Validated via daemon.StatuszConfig.Validate at the
	// CLI layer; see internal/workflows/steps.WriteBlockNodeDaemonConfigStep.
	StatuszBaseURL      string
	StatuszPollInterval string
}

func (*BlockNodeInputs) Validate

func (c *BlockNodeInputs) Validate() error

Validate validates all block node inputs fields to ensure they are safe and secure.

type BlockNodeStorage

type BlockNodeStorage struct {
	BasePath             string `yaml:"basePath" json:"basePath"`
	ArchivePath          string `yaml:"archivePath" json:"archivePath"`
	LivePath             string `yaml:"livePath" json:"livePath"`
	LogPath              string `yaml:"logPath" json:"logPath"`
	VerificationPath     string `yaml:"verificationPath" json:"verificationPath"`
	PluginsPath          string `yaml:"pluginsPath" json:"pluginsPath"`
	ApplicationStatePath string `yaml:"applicationStatePath" json:"applicationStatePath"`
	LiveSize             string `yaml:"liveSize" json:"liveSize"`
	ArchiveSize          string `yaml:"archiveSize" json:"archiveSize"`
	LogSize              string `yaml:"logSize" json:"logSize"`
	VerificationSize     string `yaml:"verificationSize" json:"verificationSize"`
	PluginsSize          string `yaml:"pluginsSize" json:"pluginsSize"`
	ApplicationStateSize string `yaml:"applicationStateSize" json:"applicationStateSize"`
}

BlockNodeStorage represents the `storage` section under `blockNode`.

func (*BlockNodeStorage) IsEmpty

func (b *BlockNodeStorage) IsEmpty() bool

IsEmpty returns true when all BlockNodeStorage fields are empty (after trimming).

func (*BlockNodeStorage) MergeFrom added in v0.15.0

func (b *BlockNodeStorage) MergeFrom(other BlockNodeStorage)

MergeFrom copies non-empty fields from other into b, filling gaps without overwriting fields already set in b.

Individual path fields (ArchivePath, LivePath, LogPath, VerificationPath, PluginsPath, ApplicationStatePath) are only merged when b has no BasePath at call time. When b already carries a BasePath, those fields are intentionally empty — they will be derived from BasePath at resolution time — so lower-priority individual paths must not fill them in. BasePath itself and all size fields are always merged regardless.

func (*BlockNodeStorage) Validate

func (b *BlockNodeStorage) Validate() error

Validate validates all storage paths to ensure they are safe and secure. This performs early validation of user-provided paths to catch security issues before workflow execution begins.

type ClusterInfo

type ClusterInfo struct {
	KubeconfigEnv  string                  `yaml:"kubeconfigEnv" json:"kubeconfigEnv"`
	KubeconfigPath string                  `yaml:"kubeconfigPath" json:"kubeconfigPath"`
	ServerVersion  k8sversion.Info         `yaml:"serverVersion" json:"serverVersion"`
	Host           string                  `yaml:"host" json:"host"`
	Proxy          string                  `yaml:"proxy" json:"proxy"`
	Clusters       map[string]*api.Cluster `yaml:"clusters" json:"clusters"`
	Contexts       map[string]*api.Context `yaml:"contexts" json:"contexts"`
	CurrentContext string                  `yaml:"currentContext" json:"currentContext"`
	Namespace      string                  `yaml:"namespace" json:"namespace"`
}

func (ClusterInfo) Equal

func (c ClusterInfo) Equal(other ClusterInfo) bool

Equal returns true if two ClusterInfo values are equal, treating nil and empty maps as equivalent.

type ClusterInputs

type ClusterInputs struct {
	Profile            string
	SkipHardwareChecks bool
}

func (*ClusterInputs) Validate

func (c *ClusterInputs) Validate() error

type CommonInputs

type CommonInputs struct {
	Force            bool
	NodeType         string
	ExecutionOptions WorkflowExecutionOptions
}

func (*CommonInputs) Validate

func (c *CommonInputs) Validate() error

Validate validates all common inputs fields to ensure they are safe and secure.

type Config

type Config struct {
	Profile      string             `yaml:"profile" json:"profile"` // Deployment profile (local, perfnet, testnet, mainnet)
	Log          logx.LoggingConfig `yaml:"log" json:"log"`
	BlockNode    BlockNodeConfig    `yaml:"blockNode" json:"blockNode"`
	Alloy        AlloyConfig        `yaml:"alloy" json:"alloy"`
	Teleport     TeleportConfig     `yaml:"teleport" json:"teleport"`
	Proxy        ProxyConfig        `yaml:"proxy" json:"proxy"`
	SoloOperator SoloOperatorConfig `yaml:"soloOperator" json:"soloOperator"`
	Host         HostConfig         `yaml:"host" json:"host"`
}

Config holds the global configuration for the application.

func (Config) IsLocalProfile

func (c Config) IsLocalProfile() bool

IsLocalProfile returns true if the current profile is the local development profile.

func (Config) Validate

func (c Config) Validate() error

Validate validates all configuration fields to ensure they are safe and secure.

type ConsensusNodeInputs added in v0.31.0

type ConsensusNodeInputs struct {
	Namespace string `json:"namespace"`
	OrbitName string `json:"orbitName"`
	NodeId    int64  `json:"nodeId"`
	AccountId string `json:"accountId"`
	Weight    int    `json:"weight"`

	// ProvisionerDaemonEnabled deploys the Orbit in mainnet mode: the UC sidecar
	// runs UC_MODE=mainnet and defers the execute phase to a host-level
	// solo-provisioner-daemon. Default false = cluster-only (the in-pod UC runs
	// execute). Sets Orbit.spec.consensus.provisionerDaemonEnabled.
	ProvisionerDaemonEnabled bool `json:"provisionerDaemonEnabled,omitempty"`

	LedgerId string `json:"ledgerId"`
	ChainId  string `json:"chainId,omitempty"`

	ConsensusImageRepo string `json:"consensusImageRepo"`
	ConsensusImageTag  string `json:"consensusImageTag"`

	// UC sidecar image (repository is the full "registry/path/name"). Empty falls
	// back to ConsensusDefaultUCImageRepo/Tag. The operator has no default UC image.
	UCImageRepo string `json:"ucImageRepo,omitempty"`
	UCImageTag  string `json:"ucImageTag,omitempty"`

	// ImagePullSecret names a docker-registry secret in the node's namespace that
	// the operator threads onto the consensus-node and UC containers for pulling
	// private images. Defaults to ConsensusDefaultImagePullSecret; empty disables it.
	ImagePullSecret string `json:"imagePullSecret,omitempty"`

	DeploymentPackageDir string `json:"deploymentPackageDir,omitempty"`

	GrpcTlsSecret string `json:"grpcTlsSecret,omitempty"`
	SigningSecret string `json:"signingSecret,omitempty"`

	// Consensus-node container sizing + JVM tuning. Empty values fall back to the
	// ConsensusDefault* constants (mirroring the solo-operator reference example).
	// The explicit Java heap is essential — without -Xmx the 0.74 node stalls on
	// startup with a GC death-spiral (solo-operator#1223).
	ContainerName string `json:"containerName,omitempty"`
	JavaHeapMin   string `json:"javaHeapMin,omitempty"`
	JavaHeapMax   string `json:"javaHeapMax,omitempty"`
	JavaOpts      string `json:"javaOpts,omitempty"`
	CPULimit      string `json:"cpuLimit,omitempty"`
	CPURequest    string `json:"cpuRequest,omitempty"`
	MemoryLimit   string `json:"memoryLimit,omitempty"`
	MemoryRequest string `json:"memoryRequest,omitempty"`

	// Volumes is the fully-merged per-volume backing configuration (emptyDir /
	// hostPath / PVC) with global defaults. Built by the CLI from --volumes-file plus
	// the --default-* and --volume flags. Empty = every volume emptyDir (operator
	// default). Resolve a volume's effective backing with Volumes.EffectiveSpec.
	Volumes ConsensusVolumeConfig `json:"volumes,omitempty"`

	// HostPathUID/HostPathGID own the hostPath directories created for hostpath-backed
	// volumes. Non-positive values fall back to the canonical hedera user/group
	// (config.HederaUserId/GroupId, 2000:2000), resolved by the chown step.
	HostPathUID int `json:"hostPathUid,omitempty"`
	HostPathGID int `json:"hostPathGid,omitempty"`

	// Profile is the deployment profile (local/testnet/mainnet/...) used to size
	// the host hardware floor when this install bootstraps the cluster.
	Profile string `json:"profile,omitempty"`

	// SkipHardwareChecks bypasses the preflight hardware floor during cluster bootstrap.
	SkipHardwareChecks bool `json:"-"`

	// Resolved config file contents (populated by BLL, not by CLI flags)
	ConfigLog4j2                string `json:"-"`
	ConfigSettings              string `json:"-"`
	ConfigAppProperties         string `json:"-"`
	ConfigAppOverrideProperties string `json:"-"`
	ConfigApiPermission         string `json:"-"`
	ConfigBootstrap             string `json:"-"`
	ConfigNodeProperties        string `json:"-"`
	ConfigFeeSchedules          string `json:"-"`
	ConfigSimpleFeesSchedules   string `json:"-"`
	ConfigThrottles             string `json:"-"`
	ConfigBlockNodes            string `json:"-"`

	// ConfigSources records, per config key (ConfigKey*), whether the resolved
	// content came from the deployment package or the embedded default. Populated
	// by the BLL during resolution; drives the apply policy for config CRs.
	ConfigSources map[string]string `json:"-"`
}

ConsensusNodeInputs holds user-supplied values for deploying a consensus node via the solo-operator's ConsensusCapsule CRD.

func (*ConsensusNodeInputs) Validate added in v0.31.0

func (c *ConsensusNodeInputs) Validate() error

Validate checks that required fields are present.

type ConsensusVolumeConfig added in v0.34.0

type ConsensusVolumeConfig struct {
	Defaults ConsensusVolumeDefaults        `json:"defaults,omitempty"`
	Volumes  map[string]ConsensusVolumeSpec `json:"volumes,omitempty"`
}

ConsensusVolumeConfig is the fully-merged volume configuration: global defaults plus per-volume overrides. Resolve a volume's effective backing with EffectiveSpec.

func LoadVolumeConfigYAML added in v0.34.0

func LoadVolumeConfigYAML(data []byte) (ConsensusVolumeConfig, error)

LoadVolumeConfigYAML parses a --volumes-file body into a ConsensusVolumeConfig and validates volume names and backing types.

func (ConsensusVolumeConfig) EffectiveSpec added in v0.34.0

func (c ConsensusVolumeConfig) EffectiveSpec(name string) (ConsensusVolumeSpec, error)

EffectiveSpec resolves a volume's final backing by applying precedence (per-volume > defaults > built-in) and validates that the keys present match the resolved backing type. The returned spec has Type always set, and — for pvc/hostpath — the backing-specific fields fully populated.

func (*ConsensusVolumeConfig) SetVolume added in v0.34.0

func (c *ConsensusVolumeConfig) SetVolume(name string, spec ConsensusVolumeSpec)

SetVolume records a per-volume override, merging non-empty fields onto any existing entry (so a later flag overrides one field without clearing the others).

type ConsensusVolumeDefaults added in v0.34.0

type ConsensusVolumeDefaults struct {
	Type         string `json:"type,omitempty" yaml:"type,omitempty"`
	PVCSize      string `json:"pvcSize,omitempty" yaml:"-"`
	StorageClass string `json:"storageClass,omitempty" yaml:"-"`
	AccessMode   string `json:"accessMode,omitempty" yaml:"-"`
}

ConsensusVolumeDefaults are the global fallbacks (the --default-* flags / the file's `defaults:` block).

type ConsensusVolumeSpec added in v0.34.0

type ConsensusVolumeSpec struct {
	Type         string `json:"type,omitempty" yaml:"type,omitempty"`
	Path         string `json:"path,omitempty" yaml:"path,omitempty"`                 // hostpath
	Size         string `json:"size,omitempty" yaml:"size,omitempty"`                 // pvc
	StorageClass string `json:"storageClass,omitempty" yaml:"storageClass,omitempty"` // pvc
	AccessMode   string `json:"accessMode,omitempty" yaml:"accessMode,omitempty"`     // pvc
}

ConsensusVolumeSpec is a per-volume backing override. Empty fields inherit from the config defaults, then the built-in per-volume defaults. Type "" inherits the config's default backing.

func ParseVolumeArg added in v0.34.0

func ParseVolumeArg(arg string) (string, ConsensusVolumeSpec, error)

ParseVolumeArg parses one --volume value: a comma-separated, order-independent key=value list (docker --mount style). `name=` is required; every other key is optional. Returns the volume name and its spec. Validation of keys-vs-type is deferred to EffectiveSpec so an omitted type can still inherit the default.

type ESOSecretDataEntry added in v0.28.0

type ESOSecretDataEntry struct {
	SecretKey string `yaml:"secretKey" json:"secretKey"` // key in the resulting K8s Secret
	RemoteKey string `yaml:"remoteKey" json:"remoteKey"` // path/key in the external store
	Property  string `yaml:"property" json:"property"`   // optional field within the remote entry
}

ESOSecretDataEntry maps one key of a Kubernetes Secret to a location in the external store, parsed from a single `eso secret create --set` value (KEY=store/path[#field]). It renders into one entry of an ExternalSecret's spec.data.

type HostConfig added in v0.22.0

type HostConfig struct {
	ManagementCIDRs []string `yaml:"managementCidrs" json:"managementCidrs"` // SSH/management allowlist CIDRs
	// BlockedCIDRs is the operator-curated deny list, dropped before every
	// other rule (set @blocked_addrs in the `inet weaver-host-firewall` table). It is distinct
	// from the BN workload plane's `bn-restricted` set (`inet weaver-workload-policy`), which
	// the traffic-shaper daemon reconciles automatically from block-node
	// statusz; this list is purely operator-managed and nothing else writes it.
	BlockedCIDRs   []string `yaml:"blockedCidrs" json:"blockedCidrs"`
	MgmtPorts      []int    `yaml:"mgmtPorts" json:"mgmtPorts"`           // SSH/management TCP port(s) accepted from the allowlist (empty = default 22)
	PodCIDR        string   `yaml:"podCidr" json:"podCidr"`               // Pod source range allowed to reach the in-cluster host-service ports (empty = rule omitted)
	InClusterPorts []int    `yaml:"inClusterPorts" json:"inClusterPorts"` // Host-service ports reachable from the pod CIDR
	Disabled       bool     `yaml:"disabled" json:"disabled"`             // Operator explicitly opted out via --firewall-enabled=false (negative polarity so the zero value means "enabled")
}

HostConfig represents the `host` configuration block: node-level host-firewall settings applied by the block-node workflow (`block node install` / `reconfigure` / `upgrade` — not the generic `kube cluster install`, which is used for cluster provisioning independent of any specific node type). These drive the `inet weaver-host-firewall` nftables table (see the `network firewall` command). ManagementCIDRs is the SSH/management allowlist; because the table's input chain is default-drop, an empty allowlist would lock the host out of new SSH connections, so the firewall step skips applying it when empty.

func (*HostConfig) Validate added in v0.22.0

func (c *HostConfig) Validate() error

Validate rejects host-firewall config that would be unsafe to render into the nft ruleset. CIDRs and ports are checked through pkg/sanity so a malformed token can never reach the atomic nft transaction.

type Intent

type Intent struct {
	Action ActionType `yaml:"action" json:"action"`
	Target TargetType `yaml:"target" json:"target"`
}

Intent defines the desired action to be performed given certain parameters and configuration.

func (*Intent) Clone

func (i *Intent) Clone() *Intent

Clone creates a deep copy of the Intent.

func (*Intent) IsValid

func (i *Intent) IsValid() bool

IsValid checks if the Intent is valid based on allowed actions and targets. An intent is considered valid if: - The action is recognized. - The target is recognized. - The action-target combination is allowed.

It returns true if the intent is valid, false otherwise. Even if an intent is valid, it may still be rejected during execution based on current state, configuration, or other factors.

type MachineInputs

type MachineInputs struct {
	Profile            string
	SkipHardwareChecks bool
}

func (*MachineInputs) Validate

func (c *MachineInputs) Validate() error

type ProxyConfig added in v0.16.0

type ProxyConfig struct {
	Enabled                bool   `yaml:"enabled" json:"enabled"`
	URL                    string `yaml:"url" json:"url"`                                       // Proxy address as host:port (e.g. "127.0.0.1:3128")
	NoProxy                string `yaml:"noProxy" json:"noProxy"`                               // Comma-separated bypass list; defaults to DefaultNoProxy if empty
	SSLCertFile            string `yaml:"sslCertFile" json:"sslCertFile"`                       // CA certificate bundle for TLS verification
	ContainerRegistryProxy string `yaml:"containerRegistryProxy" json:"containerRegistryProxy"` // Registry pull-through cache as host:port (e.g. "localhost:5050")
}

ProxyConfig represents the `proxy` configuration block. When enabled, weaver routes all network traffic through the configured proxy and optionally installs a CRI-O container registry proxy for image caching.

func (*ProxyConfig) Validate added in v0.16.0

func (c *ProxyConfig) Validate() error

Validate validates proxy configuration fields.

type Redactable added in v0.16.0

type Redactable[T any] interface {
	Redacted() T
}

Redactable is implemented by input types that contain sensitive fields (e.g. tokens, passwords) to provide a safe-to-log copy.

type ShapeOverride added in v0.25.0

type ShapeOverride struct {
	Rate string
	Ceil string
	Prio *int
}

ShapeOverride is one class's operator-supplied HTB bandwidth override, parsed from `block node install --shape <class>=rate=...,ceil=...,prio=...`. A zero-value field (empty Rate/Ceil, nil Prio) keeps that class's profile default. It mirrors internal/network/shape.ClassOverride without creating a dependency from pkg/models onto that package.

type SoloOperatorConfig added in v0.17.0

type SoloOperatorConfig struct {
	Enabled bool `yaml:"enabled" json:"enabled"`
}

SoloOperatorConfig represents the `soloOperator` configuration block. When enabled, weaver installs and health-checks the solo-operator on cluster setup. Disabled by default so existing production systems are not affected until opted in.

type StringMap

type StringMap map[string]string

func NewStringMap

func NewStringMap() StringMap

func (StringMap) Clone

func (s StringMap) Clone() (StringMap, error)

func (StringMap) Delete

func (s StringMap) Delete(key string)

func (StringMap) Get

func (s StringMap) Get(key string) (string, bool)

func (StringMap) IsEqual

func (s StringMap) IsEqual(other StringMap) bool

func (StringMap) Items

func (s StringMap) Items() map[string]string

func (StringMap) Keys

func (s StringMap) Keys() []string

func (StringMap) Merge

func (s StringMap) Merge(other StringMap)

func (StringMap) Set

func (s StringMap) Set(key, value string)

func (StringMap) Values

func (s StringMap) Values() []string

type TargetType

type TargetType string
const (
	// TargetMachine represents individual machines/servers
	TargetMachine TargetType = "machine"

	// TargetSystem represents the overall system configuration in a machine
	// This may include multiple applications and services running on the machine
	TargetSystem TargetType = "system"

	// TargetApplication represents a single application on the system
	TargetApplication TargetType = "application"

	// TargetCluster represents a Kubernetes cluster runnig on the machine
	TargetCluster TargetType = "cluster"

	// TargetBlockNode represents a blocknode component of the Hedera network
	TargetBlockNode TargetType = "blocknode"

	// TargetConsensusNode represents a consensus node component of the Hedera network
	TargetConsensusNode TargetType = "consensus"

	// TargetMirrorNode represents a mirror node component of the Hedera network
	TargetMirrorNode TargetType = "mirrornode"

	// TargetRelayNode represents a relay node component of the Hedera network
	TargetRelayNode TargetType = "relaynode"

	// TargetOperator represents solo-operator component
	TargetOperator TargetType = "operator"

	// TargetTeleportNode represents the Teleport node agent (SSH access)
	TargetTeleportNode TargetType = "teleport-node"

	// TargetTeleportCluster represents the Teleport Kubernetes cluster agent
	TargetTeleportCluster TargetType = "teleport-cluster"
)

type TeleportClusterInputs added in v0.16.0

type TeleportClusterInputs struct {
	Version    string
	ValuesFile string
}

func (*TeleportClusterInputs) Validate added in v0.16.0

func (c *TeleportClusterInputs) Validate() error

type TeleportConfig

type TeleportConfig struct {
	Version            string `yaml:"version" json:"version"`                       // Helm chart version for cluster agent
	ValuesFile         string `yaml:"valuesFile" json:"valuesFile"`                 // Path to Helm values file for cluster agent
	NodeAgentToken     string `yaml:"nodeAgentToken" json:"nodeAgentToken"`         // Join token for host-level SSH agent
	NodeAgentProxyAddr string `yaml:"nodeAgentProxyAddr" json:"nodeAgentProxyAddr"` // Teleport proxy address (required when NodeAgentToken is set)
}

TeleportConfig represents the `teleport` configuration block for secure access. Teleport configuration for node agent and cluster agent. Node agent: Uses NodeAgentToken and NodeAgentProxyAddr Cluster agent: Uses Version and ValuesFile (passed directly to Helm)

func (TeleportConfig) Validate

func (c TeleportConfig) Validate() error

Validate validates Teleport configuration fields that are set. This performs basic validation without context-specific requirements. Use ValidateClusterAgent() or ValidateNodeAgent() for use-case specific validation.

func (TeleportConfig) ValidateClusterAgent

func (c TeleportConfig) ValidateClusterAgent() error

ValidateClusterAgent validates configuration for the cluster agent.

func (TeleportConfig) ValidateNodeAgent

func (c TeleportConfig) ValidateNodeAgent() error

ValidateNodeAgent validates configuration for the node agent.

type TeleportNodeInputs added in v0.16.0

type TeleportNodeInputs struct {
	Token     string `json:"-" yaml:"-"`
	ProxyAddr string
}

func (TeleportNodeInputs) Redacted added in v0.16.0

Redacted returns a copy with the Token masked.

func (*TeleportNodeInputs) Validate added in v0.16.0

func (c *TeleportNodeInputs) Validate() error

type UserInputs

type UserInputs[T any] struct {
	Common CommonInputs
	Custom T
}

func (UserInputs[T]) Redacted added in v0.16.0

func (u UserInputs[T]) Redacted() UserInputs[T]

Redacted returns a copy of UserInputs with sensitive fields masked. If the Custom type implements Redactable, its Redacted() method is called. Otherwise the inputs are returned as-is.

func (*UserInputs[T]) Validate

func (u *UserInputs[T]) Validate() error

Validate validates all user inputs fields to ensure they are safe and secure.

type WeaverPaths

type WeaverPaths struct {
	HomeDir                string
	BinDir                 string
	LogsDir                string
	UtilsDir               string
	ConfigDir              string
	BackupDir              string
	TempDir                string
	DownloadsDir           string
	DiagnosticsDir         string
	StateDir               string
	DaemonDir              string
	DaemonSockPath         string
	DaemonConfigPath       string
	DaemonKubeconfigPath   string // /opt/solo/weaver/config/daemon.kubeconfig — legacy; prefer per-component paths
	DaemonCNKubeconfigPath string // /opt/solo/weaver/config/daemon-cn.kubeconfig
	DaemonBNKubeconfigPath string // /opt/solo/weaver/config/daemon-bn.kubeconfig

	// SelfUpgradeYAMLPath is the HIP-authoritative state file for the daemon's
	// binary self-upgrade protocol: /opt/solo/weaver/daemon/self-upgrade.yaml.
	// Written by the old daemon before spawning the detached upgrader; consumed
	// by `consensus node upgrade-recover`. See internal/selfupgrade.
	SelfUpgradeYAMLPath string

	// InfraVersionsPath is the optional infrastructure-versions.yaml manifest dropped
	// into the config directory by the build.zip deployment package (HIP XXXX0).
	// When present, solo-provisioner validates its declared versions against the
	// embedded catalog and uses its provisioner.daemon section to drive daemon install.
	// Path: /opt/solo/weaver/config/infrastructure-versions.yaml
	InfraVersionsPath string

	// DaemonServiceSandboxPath is the canonical unit file location inside the
	// weaver sandbox: $home/sandbox/usr/lib/systemd/system/solo-provisioner-daemon.service
	// DaemonServiceSymlinkPath is the system-wide symlink that points to it:
	// /usr/lib/systemd/system/solo-provisioner-daemon.service
	DaemonServiceSandboxPath string
	DaemonServiceSymlinkPath string

	DaemonEventsDir string // $home/daemon/events

	// Consensus event subdirectories — scoped so future components (block-node, relay) get sibling dirs.
	DaemonConsensusEventsDir        string // $home/daemon/events/consensus
	DaemonConsensusUpgradeEventsDir string // $home/daemon/events/consensus/upgrade
	DaemonConsensusMigrateEventsDir string // $home/daemon/events/consensus/migrate

	DaemonConsensusMigrateEventsPath string // $home/daemon/events/consensus/migrate/consensus-migrate-events.jsonl

	AllDirectories []string

	SandboxDir         string
	SandboxBinDir      string
	SandboxLocalBinDir string
	SandboxDirectories []string // all sandbox related directories
}

func NewWeaverPaths

func NewWeaverPaths(home string) *WeaverPaths

func Paths

func Paths() WeaverPaths

func (WeaverPaths) Clone

func (w WeaverPaths) Clone() *WeaverPaths

Clone returns a deep copy of the WeaverPaths. It is nil-safe and copies slice contents to avoid shared backing arrays.

type WorkflowExecutionOptions

type WorkflowExecutionOptions struct {
	ExecutionMode automa.TypeMode
	RollbackMode  automa.TypeMode
}

WorkflowExecutionOptions defines options for setting up various components of the cluster

Jump to

Keyboard shortcuts

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