# TP24 partie 1 : cluster PostgreSQL haute disponibilité géré par l'opérateur CloudNativePG.
apiVersion: v1
kind: Namespace
metadata:
  name: tp24
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: pg
  namespace: tp24
spec:
  instances: 3 # 1 primaire + 2 réplicas en streaming
  imageName: ghcr.io/cloudnative-pg/postgresql:17
  storage:
    size: 1Gi
    storageClass: local-path
  bootstrap:
    initdb:
      database: app
      owner: app # le mot de passe est généré dans le Secret pg-app
  resources:
    requests: { cpu: 100m, memory: 256Mi }
    limits: { memory: 512Mi }
  # TODO (partie 3) : archivage continu vers S3 (Floci) via le plugin Barman Cloud
  # plugins:
  #   - name: barman-cloud.cloudnative-pg.io
  #     isWALArchiver: true
  #     parameters:
  #       barmanObjectName: floci-store
