Skip to content

GitOps

Everything Tenax needs is declarative, so it fits a Flux or Argo CD repository: the chart in one place, stores and policies in another, and each BackupTarget next to the database it protects.

infrastructure/tenax/
  controllers/      # HelmRelease tenax (CRDs, controller, API, alerts, dashboard, policy presets)
  config/
    store.yaml      # BackupStore: bucket, region, age recipients
    secrets/        # SOPS-encrypted: S3 credentials, age identities, database users
apps/team-a/
  app-database.yaml
  app-backup.yaml   # BackupTarget, labelled org/project/env
Flux HelmRepository and HelmRelease (excerpt)
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata: { name: tenax, namespace: flux-system }
spec:
  type: oci
  interval: 1h
  url: oci://ghcr.io/republic-global/charts
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata: { name: tenax, namespace: tenax-system }
spec:
  interval: 10m
  chart:
    spec:
      chart: tenax
      version: "1.2.3"
      sourceRef: { kind: HelmRepository, name: tenax, namespace: flux-system }
  install: { crds: CreateReplace }
  upgrade: { crds: CreateReplace }
  values:
    targetNamespaces: [team-a]
    examplePolicies: { enabled: true, store: main }
    metrics:
      serviceMonitor: { enabled: true }
      prometheusRule: { enabled: true }
      grafanaDashboard: { enabled: true }

The published chart already defaults to the public image ghcr.io/republic-global/tenax with the matching tag, so the values need no image block. If you mirror Tenax into your own registry, point the HelmRepository at your mirror and set image.repository, image.tag and image.pullSecrets in the values.

Tips:

  • Generate secrets with kubectl create secret … --dry-run=client -o yaml | sops --encrypt so no plaintext or placeholder is ever committed. Never commit the age private keys; keep an offline copy of the backup key.
  • Keep Tenax in its own Flux Kustomization, outside the chain your applications depend on, so a Tenax problem never blocks a deployment.
  • Restores are usually created from the console or the CLI, not from git: they are one-off actions. Declaring one in git works too.

Removing a target

Deleting a BackupTarget from git stops its backups and its change stream, but it never deletes what is already in the store: a git mistake or a lost cluster must not cost history. The console then shows the target as store only, and its backups can still be browsed and restored.

When the history must go too, destroy the target. It needs the restorer-admin role:

tenax targets destroy team-a/app --dry-run          # what would be deleted, per store
tenax targets destroy team-a/app --reason "decommissioned"

The same is on the target's page in the console, under Destroy. You type the target's name to confirm.

  • It is refused while a BackupTarget of that name exists, while a restore of it runs, and on read-only stores.
  • The target disappears at once. The controller then deletes its backups, change stream, incidents and history within minutes, and records what it deleted in the store's gc/ folder. The request is in the audit log.
  • If a BackupTarget of that name comes back before the controller gets to it, nothing is deleted.
  • It cannot be undone.

Changing a target's store

A target's backups go to the store its policy names. Pointing the policy (or the target, at another policy) at a new store starts a new full backup there; the backups already taken stay in the old store and remain restorable:

  • The console lists them on the target's page under In store old store, apart from the policy's own store.
  • A restore of one of them, by backup ID, reads from the store that holds it. A Restore can also name the store itself with spec.source.store.
  • Pins on them are written to the store that holds them.
  • Retention and automatic import run only in the policy's store, so the old backups stay until the old store is removed. Points in time between the two stores cannot be restored: each restore uses one store.

Copies and replicas

A store's backups can be copied to another store as they are, still encrypted: the other store must list the same encryption recipients (spec.encryption.ageRecipients), and its own identity then reads them.

To copy once, for example to seed a new region or to keep a copy before a migration (restorer-admin):

tenax stores copy main dr --dry-run                      # what would be copied
tenax stores copy main dr --reason "seed the new region"  # the whole store
tenax stores copy main dr --target shop/orders --reason "keep a copy"

A Job copies what the other store lacks within minutes; copying again copies only what is new, and nothing is ever deleted from the destination.

To keep a second copy all the time, list the other store as a replica:

apiVersion: tenax.run/v1alpha1
kind: BackupStore
metadata: { name: main }
spec:
  # ...
  replicas:
    - store: dr
      interval: 1h        # how often the copy runs (default 1h)
      deleteDelay: 72h    # how long the replica keeps what retention deleted (default 72h)
      writeFallback: true # new full backups go to dr while main cannot be reached
  • tenax stores and the console's Settings page show each replica's last error-free copy, what is pending and what it still keeps after a delete. TenaxStoreReplicaBehind fires when a replica has not been copied without errors for 6 hours.
  • While a store cannot be reached, restores read its first reachable replica, and with writeFallback new full backups are written there; the next copy brings them back to the store.
  • A copy that would delete most of the replica deletes nothing and says so (delete brake): an emptied or misconfigured store never empties its replica.
  • A running change stream keeps retrying its own store; it moves to the replica only when it restarts.