refactor(deploy)!: TUI

This commit is contained in:
Lemon-miaow committed 2026-06-29 20:17:17 +08:00
1 parent 318a724f98
commit e5f1682898
37 files changed
+3622 -1303

No files matched your search

+8 -7
View File
@@ -20,8 +20,9 @@ const (
managedByValue = "felis-restore"
componentValue = "world-restore"
worldVolume = "world"
backupVolume = "backup"
worldVolume = "world"
backupVolume = "backup"
felisBinaryPath = "/usr/local/bin/felis"
)
// JobParams are the rendered inputs to a restore Job, derived from a server +
@@ -78,10 +79,10 @@ func restoreLabels(p JobParams) map[string]string {
// - activeDeadlineSeconds + backoffLimit=0 so a wedged or malicious archive
// cannot loop or run forever; ttlSecondsAfterFinished GCs the finished Job.
//
// The container runs `felis restore` (cmd/felis), which extracts the archive at
// BackupRef from the backup mount into the world mount. BackupRef is an absolute
// path, so the backup PVC MUST be mounted at BackupRoot — the same path the
// reaper wrote it under — for the ref to resolve.
// The container runs `/usr/local/bin/felis restore` (cmd/felis), which extracts
// the archive at BackupRef from the backup mount into the world mount. BackupRef
// is an absolute path, so the backup PVC MUST be mounted at BackupRoot — the
// same path the reaper wrote it under — for the ref to resolve.
func RestoreJob(p JobParams) (*batchv1.Job, error) {
if p.Image == "" {
return nil, fmt.Errorf("restore: image is empty")
@@ -105,7 +106,7 @@ func RestoreJob(p JobParams) (*batchv1.Job, error) {
container := corev1.Container{
Name: "restore",
Image: p.Image,
Command: []string{"felis", "restore"},
Command: []string{felisBinaryPath, "restore"},
Args: []string{
"--server", p.Server,
"--ref", p.BackupRef,
+5 -4
View File
@@ -197,8 +197,9 @@ func TestRestoreJobContainerIsHardened(t *testing.T) {
}
}
// The container must invoke `felis restore` with the archive parameters as
// plain flags — and crucially the world PVC name the operator/reaper agree on.
// The container must invoke the felis restore binary by absolute path with the
// archive parameters as plain flags — and crucially the world PVC name the
// operator/reaper agree on.
func TestRestoreJobInvokesFelisRestoreWithParams(t *testing.T) {
p := sampleJobParams()
job, err := RestoreJob(p)
@@ -206,8 +207,8 @@ func TestRestoreJobInvokesFelisRestoreWithParams(t *testing.T) {
t.Fatalf("RestoreJob: %v", err)
}
c := singleContainer(t, job)
if len(c.Command) < 2 || c.Command[0] != "felis" || c.Command[1] != "restore" {
t.Errorf("command = %v, want [felis restore ...]", c.Command)
if len(c.Command) < 2 || c.Command[0] != felisBinaryPath || c.Command[1] != "restore" {
t.Errorf("command = %v, want [%s restore ...]", c.Command, felisBinaryPath)
}
if !argPairPresent(c.Args, "--server", p.Server) {
t.Errorf("args must carry --server %q, got %v", p.Server, c.Args)