Skip to content

BackupQuota CRD

The BackupQuota Custom Resource Definition caps what a namespace can consume when teams create their own backups. Treat it as a guardrail against a runaway schedule or an accidental hourly cron. It is not a security boundary: anyone who can create a Backup can also read the quota that governs it.

Overview

  • API Group: retour.thebackup.company/v1
  • Kind: BackupQuota
  • Scope: Cluster
  • Enforcement: on by default. operator.quotaEnforcement: false switches the operator to log-and-allow.

Spec

Which Namespaces It Governs

Field Type Description
namespaces []string Explicit list of namespaces this quota governs.
namespaceSelector LabelSelector Governs every namespace whose labels match. An empty selector does not match everything; it makes this a default quota.

When several quotas could apply, one naming the namespace explicitly wins over one matching by selector, which wins over the default quota (one named default, or one with neither a list nor a non-empty selector). Ties inside a tier go to the alphabetically first name.

Limits

Field Type Description
limits.maxActiveBackups int Concurrent non-terminal Backups per namespace.
limits.maxBackupsPerDay int Backups created in a rolling 24 hours.
limits.maxSchedules int BackupSchedule objects per namespace. Under the limit, the oldest schedules keep their slots.
limits.minScheduleInterval duration Refuses crons that fire more often than this. The real gap between firings is computed, not guessed from the expression.
limits.maxTotalSizeBytes int64 Sum of reported backup sizes at which new backups are refused.

What Happens at the Limit

A Backup over maxActiveBackups, maxBackupsPerDay or maxTotalSizeBytes stays Pending with a QuotaExceeded condition naming the quota and the limit it hit, plus a warning event. It is re-evaluated on requeue and proceeds on its own when the pressure clears. Nothing is ever deleted to get back under a limit.

Schedules are refused at create or update time by the admission webhook when it is enabled, and marked Failed with the same condition by the reconciler otherwise.

Status

Field Type Description
namespaces array Per-namespace usage: activeBackups, backupsLast24h, schedules, totalSizeBytes.
lastUpdated string When the usage was last refreshed.

Examples

Team Quota

apiVersion: retour.thebackup.company/v1
kind: BackupQuota
metadata:
  name: team-a
spec:
  namespaces: ["team-a", "team-a-staging"]
  limits:
    maxActiveBackups: 2
    maxBackupsPerDay: 20
    maxSchedules: 5
    minScheduleInterval: 15m
    maxTotalSizeBytes: 500000000000

Default Quota for Everything Else

apiVersion: retour.thebackup.company/v1
kind: BackupQuota
metadata:
  name: default
spec:
  limits:
    maxActiveBackups: 1
    maxBackupsPerDay: 4
    minScheduleInterval: 1h

By Label

apiVersion: retour.thebackup.company/v1
kind: BackupQuota
metadata:
  name: tenants
spec:
  namespaceSelector:
    matchLabels:
      tenant: "true"
  limits:
    maxActiveBackups: 1
    maxSchedules: 2