models

package
v0.16.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

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 = 0755 // for directories and executable files
	DefaultFilePerm      = 0644 // 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 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 = errorx.RegisterProperty("resolution")

ErrPropertyResolution is the errorx property key used to attach remediation hints to precondition errors — mirrors doctor.ErrPropertyResolution without creating a circular import.

Functions

func AllExecutionModes

func AllExecutionModes() []automa.TypeMode

func AllNodeTypes

func AllNodeTypes() []string

func IsEqualMap

func IsEqualMap(a, b StringMap) bool

IsEqualMap compares two automa.StateBag values using Items()

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.

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"
)

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"`
	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
	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)
}

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"`
	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"`
}

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.

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"`
}

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 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 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

	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