Skip to content

Commit 0291149

Browse files
committed
feat(backups): implement Job backup strategy
Complete the strategy.backups.cozystack.io/Job driver as the generic, app-agnostic counterpart to the Altinity driver: render the strategy PodTemplateSpec, run it as a one-shot batch/v1.Job, poll its terminal condition, and emit a Backup. Wire it into the existing BackupClass dispatch via reconcileJob/reconcileJobRestore rather than a standalone reconciler, matching the post-BackupClass backups API (the old draft read BackupJob.Spec.StrategyRef/StorageRef, which no longer exist). Template context follows the in-tree convention (.Application, .Release, .Mode, .Parameters, .Backup); the JobSpec.Template doc and regenerated CRD are updated to match. Restore re-renders the same template with .Mode=restore; cross-namespace restore is unsupported, mirroring Altinity. Signed-off-by: Timofei Larkin <[email protected]>
1 parent ee9d154 commit 0291149

4 files changed

Lines changed: 1138 additions & 18 deletions

File tree

‎api/backups/strategy/v1alpha1/job_types.go‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,18 @@ type JobList struct {
4949

5050
// JobSpec specifies the desired behavior of a backup job.
5151
type JobSpec struct {
52-
// Template holds a PodTemplateSpec with the right shape to
53-
// run a single pod to completion and create a tarball with
54-
// a given apps data. Helm-like Go templates are supported.
55-
// The values of the source application are available under
56-
// `.Values`. `.Release.Name` and `.Release.Namespace` are
57-
// also exported.
52+
// Template holds a PodTemplateSpec with the right shape to run a single
53+
// pod to completion and create (or restore) a backup of a given app's
54+
// data. Helm-like Go templates are supported in every string field and
55+
// are rendered against the following context:
56+
// - `.Application` — the live application object (e.g.
57+
// `.Application.spec.replicas`).
58+
// - `.Release.Name` and `.Release.Namespace` — the application's name
59+
// and namespace.
60+
// - `.Mode` — `"backup"` or `"restore"`, identifying the run.
61+
// - `.Parameters` — the resolved BackupClass strategy parameters.
62+
// - `.Backup` — only on restore runs: `.Backup.Name`, `.Backup.Namespace`
63+
// and `.Backup.ApplicationRef` describing the source backup.
5864
Template corev1.PodTemplateSpec `json:"template"`
5965
}
6066

0 commit comments

Comments
 (0)