STAC-23603: Restoring Settings #6
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds Settings (Configuration of SUSE Observability instance stored in Stackgraph) backup/restore functionality to the StackState Backup CLI.
New Commands
settings listLists available backups from Minio S3 storage.
Example:
settings restoreRestores a backup from Minio S3 storage with automatic deployment scaling and Kubernetes job
orchestration.
Restore Workflow
When you run stackgraph restore, the CLI performs the following steps:
- If --latest flag is specified: Automatically fetches the most recent backup from Minio
- If --archive flag is specified: Uses the explicitly provided archive name
- Warns that restore will PURGE all existing Stackgraph data
- Displays backup file and namespace
- Prompts for confirmation: Do you want to continue? (yes/no):
- Use --yes or -y flag to skip confirmation (useful for automation)
- Identifies and scales down affected deployments to zero replicas
- Waits for all pods to terminate gracefully
- Stores original replica counts for restoration
- ConfigMap: Contains the restore script and configuration
- Secret: Mounts Minio credentials for S3 access
- If --background flag is NOT set:
- If --background flag IS set:
- Restores deployments to their original replica counts
- Automatically triggered after job completion (or immediately if --background is used)
- Kubernetes Job is automatically cleaned up via TTL (10 minutes after completion)
- PVC remains for troubleshooting and is cleaned up in the next restore
Usage
Usage:
sts-backup settings restore [flags]
Flags:
--archive string Specific archive name to restore (e.g., sts-backup-20251117-1404.sty)
--background Run restore job in background without waiting for completion
-h, --help help for restore
--latest Restore from the most recent backup
-y, --yes Skip confirmation prompt
Example 1: Restore with Background Execution (Interactive).
Example 2: Restore Latest Backup with automatic approval
settings check-and-finalizeCheck the status of a background restore job and clean up resources.
Usage
sts-backup settings check-and-finalize --job [--wait] -n
Flags:
Note: This command automatically scales up deployments that were scaled down during restore.
Example: Checking if the job is still running
Example: Waiting for the job to finish