startup

package
v0.60.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package startup implements the `rad startup` command, which restores durable Radius state (PostgreSQL control-plane databases and Terraform state Secrets) previously saved by `rad shutdown` into the current workspace's running control plane.

The command assumes Radius is already installed and running on the target cluster; it does not create clusters or install Radius. This keeps it usable in any context and independent of any particular workspace kind.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(factory framework.Factory) (*cobra.Command, framework.Runner)

NewCommand creates an instance of the `rad startup` command and runner.

Types

type ControlPlaneScaler

type ControlPlaneScaler interface {
	// ScaleDown scales the control-plane deployments to zero and returns their previous replica
	// counts so they can be restored by ScaleUp.
	ScaleDown(ctx context.Context) (map[string]int32, error)

	// ScaleUp restores the deployments to the replica counts captured by ScaleDown and waits until
	// they are available again.
	ScaleUp(ctx context.Context, saved map[string]int32) error
}

ControlPlaneScaler scales the database-backed control-plane deployments to zero and back, so state can be restored while no resource provider holds a live PostgreSQL connection.

type Runner

type Runner struct {
	ConfigHolder *framework.ConfigHolder
	Output       output.Interface
	Workspace    *workspaces.Workspace
	StateClient  StateRestoreClient

	// Archive is the durable state archive that state is restored from. Tests inject a mock.
	Archive statearchive.Archive
	// contains filtered or unexported fields
}

Runner is the runner implementation for the `rad startup` command.

func NewRunner

func NewRunner(factory framework.Factory) *Runner

NewRunner creates a new Runner for the `rad startup` command.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

Run restores the control-plane and Terraform state from the state archive.

The database-backed control-plane deployments are scaled to zero before the restore and back up afterward. Restoring a pg_dump underneath live resource-provider connections would invalidate their cached prepared statements and race their writes; quiescing them makes the restore atomic with respect to its consumers without a separate restart step.

func (*Runner) Validate

func (r *Runner) Validate(cmd *cobra.Command, args []string) error

Validate resolves the workspace and ensures it targets a Kubernetes cluster.

type StateRestoreClient

type StateRestoreClient interface {
	// WaitForDatabaseReady blocks until the control-plane PostgreSQL instance is ready.
	WaitForDatabaseReady(ctx context.Context, kubeContext, namespace string) error

	// RestoreDatabases loads the control-plane PostgreSQL dumps from stateDir.
	RestoreDatabases(ctx context.Context, kubeContext, namespace, stateDir string) error

	// RestoreTerraform re-creates the Terraform state Secrets from stateDir.
	RestoreTerraform(ctx context.Context, kubeContext, namespace, stateDir string) error
}

StateRestoreClient restores the durable Radius state for a Kubernetes context. It wraps the pgbackup and tfstate packages so the command can be unit tested without a cluster.

func NewStateRestoreClient

func NewStateRestoreClient() StateRestoreClient

NewStateRestoreClient returns the production StateRestoreClient.

Jump to

Keyboard shortcuts

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