blocknode

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Kubernetes resources
	ResourceNameSuffix = "-block-node-server"
	PodLabelSelector   = "app.kubernetes.io/name=block-node-server"

	// Template paths
	NamespacePath           = "files/block-node/namespace.yaml"
	StorageConfigPath       = "files/block-node/storage-config.yaml"
	VerificationStoragePath = "files/block-node/verification-storage.yaml"
	ValuesPath              = "files/block-node/full-values.yaml"
	NanoValuesPath          = "files/block-node/nano-values.yaml"

	// Template paths for v0.26.2+ (includes verification storage)
	ValuesPathV0262     = "files/block-node/full-values-v0.26.2.yaml"
	NanoValuesPathV0262 = "files/block-node/nano-values-v0.26.2.yaml"

	// Timeouts
	PodReadyTimeoutSeconds = 300
)
View Source
const ComponentBlockNode = "block-node"

ComponentBlockNode is the component name for block node migrations.

View Source
const VerificationStorageMinVersion = "0.26.2"

VerificationStorageMinVersion is the minimum Block Node version that requires verification storage.

Variables

This section is empty.

Functions

func BuildMigrationWorkflow added in v0.7.0

func BuildMigrationWorkflow(manager *Manager, profile, valuesFile string) (*automa.WorkflowBuilder, error)

BuildMigrationWorkflow returns an automa workflow for executing applicable migrations. Returns nil if no migrations are needed (installed version is empty or no applicable migrations).

func InitMigrations added in v0.7.0

func InitMigrations()

InitMigrations registers all block node migrations. Called once at startup from root.go.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles block node setup and management operations

func NewManager

func NewManager(blockConfig config.BlockNodeConfig) (*Manager, error)

NewManager creates a new block node manager

func (*Manager) AnnotateService

func (m *Manager) AnnotateService(ctx context.Context) error

AnnotateService annotates the block node service with MetalLB address pool

func (*Manager) ClearStorageDirectory added in v0.8.0

func (m *Manager) ClearStorageDirectory(dirPath string) error

ClearStorageDirectory removes all files and subdirectories from a storage directory while preserving the directory itself

func (*Manager) ComputeValuesFile

func (m *Manager) ComputeValuesFile(profile string, valuesFile string) (string, error)

ComputeValuesFile generates the values file for helm installation based on profile and version. It provides the path to the generated values file.

The method selects the appropriate values template based on the target Block Node version: - For versions >= 0.26.2: Uses values templates with verification storage configuration - For versions < 0.26.2: Uses values templates without verification storage

NOTE: This method implements defense-in-depth validation. Even though the CLI layer validates paths using sanity.ValidateInputFile(), this method also validates to ensure safety regardless of the caller. This protects against future code changes where this method might be called from other places without proper validation.

func (*Manager) CreateNamespace

func (m *Manager) CreateNamespace(ctx context.Context, tempDir string) error

CreateNamespace creates the block-node namespace if it doesn't exist

func (*Manager) CreatePersistentVolumes

func (m *Manager) CreatePersistentVolumes(ctx context.Context, tempDir string) error

CreatePersistentVolumes creates PVs and PVCs from the storage config

func (*Manager) CreateVerificationStorage added in v0.7.0

func (m *Manager) CreateVerificationStorage(ctx context.Context, tempDir string) error

CreateVerificationStorage creates only the verification PV/PVC. Used during migration when other PVs already exist.

func (*Manager) DeleteNamespace

func (m *Manager) DeleteNamespace(ctx context.Context, tempDir string) error

DeleteNamespace deletes the block-node namespace

func (*Manager) DeletePersistentVolumes

func (m *Manager) DeletePersistentVolumes(ctx context.Context, tempDir string) error

DeletePersistentVolumes deletes PVs and PVCs

func (*Manager) GetInstalledVersion added in v0.7.0

func (m *Manager) GetInstalledVersion() (string, error)

GetInstalledVersion returns the currently installed Block Node chart version. Returns empty string if not installed.

func (*Manager) GetReleaseValues added in v0.7.0

func (m *Manager) GetReleaseValues() (map[string]interface{}, error)

GetReleaseValues returns the user-supplied values from the currently installed release. Returns nil if not installed or if no user values were supplied.

func (*Manager) GetStoragePaths added in v0.6.0

func (m *Manager) GetStoragePaths() (archivePath, livePath, logPath, verificationPath string, err error)

GetStoragePaths returns the computed storage paths based on configuration. If individual paths are specified, they are used; otherwise, paths are derived from basePath. All paths are validated using sanity checks. verificationPath is only required/derived/validated when the target version requires verification storage (>= 0.26.2).

func (*Manager) InstallChart

func (m *Manager) InstallChart(ctx context.Context, valuesFile string) (bool, error)

InstallChart installs the block node helm chart

func (*Manager) ResetStorage added in v0.8.0

func (m *Manager) ResetStorage(ctx context.Context) error

ResetStorage clears all block node storage directories

func (*Manager) ScaleStatefulSet added in v0.8.0

func (m *Manager) ScaleStatefulSet(ctx context.Context, replicas int32) error

ScaleStatefulSet scales the block node statefulset to the specified number of replicas

func (*Manager) SetupStorage

func (m *Manager) SetupStorage(ctx context.Context) error

SetupStorage creates the required directories for block node storage

func (*Manager) UninstallChart

func (m *Manager) UninstallChart(ctx context.Context) error

UninstallChart uninstalls the block node helm chart

func (*Manager) UpgradeChart added in v0.5.0

func (m *Manager) UpgradeChart(ctx context.Context, valuesFile string, reuseValues bool) error

UpgradeChart upgrades the block node helm chart

func (*Manager) WaitForPodReady

func (m *Manager) WaitForPodReady(ctx context.Context) error

WaitForPodReady waits for the block node pod to be ready

func (*Manager) WaitForPodsTerminated added in v0.8.0

func (m *Manager) WaitForPodsTerminated(ctx context.Context) error

WaitForPodsTerminated waits until all pods matching the block node label selector are terminated

type VerificationStorageMigration added in v0.7.0

type VerificationStorageMigration struct {
	migration.VersionMigration
}

VerificationStorageMigration handles the breaking change introduced in Block Node v0.26.2 where a new verification storage PV/PVC was added to the StatefulSet.

func NewVerificationStorageMigration added in v0.7.0

func NewVerificationStorageMigration() *VerificationStorageMigration

NewVerificationStorageMigration creates a new verification storage migration.

func (*VerificationStorageMigration) Execute added in v0.7.0

func (*VerificationStorageMigration) Rollback added in v0.7.0

Jump to

Keyboard shortcuts

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