PodWarden
API Reference

Backup Operator CRD Reference

Complete field reference for BackupPolicy, BackupRun, and RestoreRun custom resource definitions

The PodWarden Backup Operator manages backup and restore lifecycles for workloads running on PodWarden-managed clusters. It uses Restic for incremental, encrypted, deduplicated snapshots stored on S3 or NFS.

API Group: backup.podwarden.com Version: v1alpha1

Installation

The backup operator is a preinstalled system app — it's deployed automatically when PodWarden bootstraps a cluster. No manual installation is needed.

For manual installation or upgrades:

# Via Helm (recommended)
helm install backup-operator ./charts/backup-operator/ \
  -n podwarden-backup-operator-system --create-namespace

# Via kubectl (from rendered manifest)
kubectl apply -f https://www.podwarden.com/operators/backup-operator/install.yaml

Upgrade:

helm upgrade backup-operator ./charts/backup-operator/ \
  -n podwarden-backup-operator-system --set image.tag=<version>

BackupPolicy

Defines what to back up, where to store it, on what schedule, and with what retention.

Spec

FieldTypeRequiredDefaultDescription
schedulestringYesCron expression for backup schedule, e.g. "0 3 * * *"
modestringYes"hot" (no downtime) or "cold" (scale to zero during backup)
suspendboolNofalseWhen true, skip scheduling new backups
target.deploymentNamestringYesName of the Kubernetes Deployment to back up
target.volumeNames[]stringNoallFilter to specific PVC names. Empty means all PVCs attached to the Deployment
storage.typestringYes"s3" or "nfs"
storage.s3.endpointstringNoS3-compatible endpoint URL
storage.s3.bucketstringNoS3 bucket name
storage.s3.credentialsSecretRefstringNoSecret name containing keys access-key and secret-key
storage.nfs.serverstringNoNFS server hostname
storage.nfs.basePathstringNoNFS base path
storage.repoPathstringYesPath within storage for the Restic repository
storage.passwordSecretRefstringYesSecret name containing key restic-password
retention.keepLastintNo7Number of latest snapshots to keep
retention.keepDailyintNo7Number of daily snapshots to keep
retention.keepWeeklyintNo4Number of weekly snapshots to keep
hooks.pre.containerstringNoContainer name to exec into before backup
hooks.pre.command[]stringNoCommand to run before backup
hooks.pre.timeoutSecondsintNo300Timeout for the pre-backup hook
hooks.post.containerstringNoContainer name to exec into after backup
hooks.post.command[]stringNoCommand to run after backup
hooks.post.timeoutSecondsintNo300Timeout for the post-backup hook

Status

FieldTypeDescription
lastBackupTimetimestampWhen the last backup completed
lastBackupStatusstring"Success", "Failed", or "Running"
lastErrorstringError message from the last failed backup
currentJobstringName of the currently running BackupRun
conditions[][]ConditionStandard Kubernetes conditions

Print Columns

ColumnField
Schedule.spec.schedule
Mode.spec.mode
Last Backup.status.lastBackupTime
Status.status.lastBackupStatus

Example

apiVersion: backup.podwarden.com/v1alpha1
kind: BackupPolicy
metadata:
  name: my-app-backup
  namespace: my-app
spec:
  schedule: "0 3 * * *"
  mode: hot
  target:
    deploymentName: my-app
    volumeNames:
      - data
  storage:
    type: s3
    s3:
      endpoint: https://s3.example.com
      bucket: backups
      credentialsSecretRef: s3-credentials
    repoPath: /my-app/restic-repo
    passwordSecretRef: restic-password
  retention:
    keepLast: 7
    keepDaily: 7
    keepWeekly: 4
  hooks:
    pre:
      container: my-app
      command: ["sh", "-c", "pg_dump -U app appdb > /data/dump.sql"]
      timeoutSeconds: 120
    post:
      container: my-app
      command: ["sh", "-c", "rm /data/dump.sql"]

BackupRun

Represents a single backup execution. Created automatically by the operator on schedule, or manually by the user.

Spec

FieldTypeRequiredDescription
policyRefstringYesName of the parent BackupPolicy
triggerstringYes"scheduled" or "manual"

Status

FieldTypeDescription
phasestringPending, Running, Completed, or Failed
startedAttimestampWhen the backup started
completedAttimestampWhen the backup finished
jobNamestringName of the Kubernetes Job executing the backup
errorstringError message if the backup failed
snapshots[][]SnapshotPer-volume results (see below)
totalSizeBytesint64Total size of all snapshots
sourceSnapshotobjectDeployment state captured at backup time (see below)

Snapshot Fields

FieldTypeDescription
volumeNamestringPVC name
resticSnapshotIdstringRestic snapshot identifier
sizeBytesint64Size of new data added
filesNewintNumber of new files
filesChangedintNumber of changed files
filesUnmodifiedintNumber of unchanged files

Source Snapshot Fields

FieldTypeDescription
deploymentNamestringDeployment name at backup time
images[][]stringContainer images in use
volumes[][]stringVolume names attached
annotations{}map[string]stringDeployment annotations

Print Columns

ColumnField
Policy.spec.policyRef
Trigger.spec.trigger
Phase.status.phase
Started.status.startedAt
Size.status.totalSizeBytes

Example

apiVersion: backup.podwarden.com/v1alpha1
kind: BackupRun
metadata:
  name: my-app-backup-20260322-030000
  namespace: my-app
spec:
  policyRef: my-app-backup
  trigger: manual

RestoreRun

Restores data from a BackupRun to a target deployment. The operator performs a compatibility check, scales down the deployment, runs the restore Job, and scales back up.

Spec

FieldTypeRequiredDefaultDescription
backupRunRefstringYesName of the BackupRun to restore from
backupRunNamespacestringNosame namespaceNamespace of the BackupRun (for cross-namespace restore)
targetDeploymentstringYesDeployment to restore data to
requireCompatibleboolNofalseWhen true, fail if any compatibility issues are detected

Status

FieldTypeDescription
phasestringPending, Running, Completed, or Failed
startedAttimestampWhen the restore started
completedAttimestampWhen the restore finished
errorstringError message if the restore failed
jobNamestringName of the Kubernetes Job executing the restore
compatibilityobjectCompatibility check results (see below)

Compatibility Fields

FieldTypeDescription
compatibleboolWhether the restore is fully compatible
warnings[][]stringNon-blocking compatibility warnings
errors[][]stringBlocking compatibility errors
templateChangedboolWhether the Deployment template differs from the backup source

Print Columns

ColumnField
BackupRun.spec.backupRunRef
Target.spec.targetDeployment
Phase.status.phase
Compatible.status.compatibility.compatible

Example

apiVersion: backup.podwarden.com/v1alpha1
kind: RestoreRun
metadata:
  name: my-app-restore-20260322
  namespace: my-app
spec:
  backupRunRef: my-app-backup-20260322-030000
  targetDeployment: my-app
  requireCompatible: true

System App Integration

The Backup Operator registers itself as a PodWarden System App via a ConfigMap with the label podwarden.com/system-app: "true".

apiVersion: v1
kind: ConfigMap
metadata:
  name: backup-operator-system-app
  namespace: podwarden-backup-operator-system
  labels:
    podwarden.com/system-app: "true"
data:
  name: Backup Operator
  description: Kubernetes-native backup and restore for PodWarden workloads
  version: "0.1.0"
  capabilities: "backup:manage,backup:restore,backup:schedule"

Capabilities

CapabilityDescription
backup:manageCreate, update, and delete BackupPolicy resources
backup:restoreCreate RestoreRun resources to restore from backups
backup:scheduleModify backup schedules and retention settings

Auto-Provisioned Namespace Resources

When a BackupPolicy is created in a namespace, the operator automatically provisions the following resources. All managed resources carry the label backup.podwarden.com/managed-by: operator.

ResourceNamePurpose
ConfigMapbackup-scriptsContains backup.sh and restore.sh Restic wrapper scripts
ServiceAccountbackup-operatorIdentity for backup/restore Jobs
Rolebackup-operatorPermissions for Jobs to read PVCs, Secrets, and Pods
RoleBindingbackup-operatorBinds the Role to the ServiceAccount

These resources are garbage-collected when the last BackupPolicy in a namespace is deleted.