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 ¶
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 (*Runner) Run ¶
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.
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.