跳轉到

GitOps

Tenax 所需的一切都是宣告式的,因此很適合放進 Flux 或 Argo CD 儲存庫:Chart 放在一處,儲存和策略放在另一處, 每個 BackupTarget 則放在它所保護的資料庫旁邊。

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 HelmRelease (excerpt)
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: my-charts, namespace: flux-system }
  install: { crds: CreateReplace }
  upgrade: { crds: CreateReplace }
  values:
    image: { repository: registry.example.com/tenax/tenax, tag: v1.2.3 }
    targetNamespaces: [team-a]
    examplePolicies: { enabled: true, store: main }
    metrics:
      serviceMonitor: { enabled: true }
      prometheusRule: { enabled: true }
      grafanaDashboard: { enabled: true }

提示:

  • 用 kubectl create secret … --dry-run=client -o yaml | sops --encrypt 產生 Secret,這樣永遠不會提交明文或預留位置。 絕不要提交 age 私鑰;請離線儲存一份備份金鑰。
  • 把 Tenax 放在獨立的 Flux Kustomization 中,置於應用程式所依賴的鏈之外,這樣 Tenax 出問題時永遠不會阻塞部署。
  • 還原通常從控制台或 CLI 建立,而不是從 git:它們是一次性操作。在 git 中宣告一個還原也是可以的。