|
| 1 | +apiVersion: postgresql.cnpg.io/v1 |
| 2 | +kind: Cluster |
| 3 | +metadata: |
| 4 | + name: gitea-database |
| 5 | + namespace: cloudnative-pg |
| 6 | + labels: |
| 7 | + app: gitea |
| 8 | +spec: |
| 9 | + instances: 1 |
| 10 | + imageName: ghcr.io/cloudnative-pg/postgresql:16.2 |
| 11 | + resources: |
| 12 | + requests: |
| 13 | + memory: 512Mi |
| 14 | + cpu: 250m |
| 15 | + limits: |
| 16 | + memory: 1Gi |
| 17 | + postgresql: |
| 18 | + parameters: |
| 19 | + shared_buffers: "128MB" |
| 20 | + max_wal_size: "512MB" |
| 21 | + wal_compression: "on" |
| 22 | + pg_hba: |
| 23 | + - host all all 0.0.0.0/0 md5 |
| 24 | + # === NORMAL OPERATION: initdb (comment out for DR recovery) === |
| 25 | + bootstrap: |
| 26 | + initdb: |
| 27 | + database: gitea |
| 28 | + owner: gitea |
| 29 | + secret: |
| 30 | + name: gitea-app-secret |
| 31 | + # === DISASTER RECOVERY === |
| 32 | + # 1. Comment out the initdb bootstrap above |
| 33 | + # 2. Uncomment the recovery bootstrap + externalClusters below |
| 34 | + # 3. Update serverName in externalClusters to match CURRENT backup.serverName (gitea-database) |
| 35 | + # 4. Bump backup.serverName to next version (e.g. gitea-database-v2) |
| 36 | + # 5. Apply directly with: kubectl kustomize ... | kubectl create -f - |
| 37 | + # (ArgoCD SSA + CNPG webhook = initdb always wins, must bypass ArgoCD) |
| 38 | + # 6. After recovery completes, revert to initdb and push |
| 39 | + # |
| 40 | + # bootstrap: |
| 41 | + # recovery: |
| 42 | + # source: gitea-backup |
| 43 | + # externalClusters: |
| 44 | + # - name: gitea-backup |
| 45 | + # barmanObjectStore: |
| 46 | + # serverName: gitea-database |
| 47 | + # destinationPath: s3://postgres-backups/cnpg/gitea |
| 48 | + # endpointURL: http://192.168.10.133:30293 |
| 49 | + # s3Credentials: |
| 50 | + # accessKeyId: |
| 51 | + # name: cnpg-s3-credentials |
| 52 | + # key: AWS_ACCESS_KEY_ID |
| 53 | + # secretAccessKey: |
| 54 | + # name: cnpg-s3-credentials |
| 55 | + # key: AWS_SECRET_ACCESS_KEY |
| 56 | + # wal: |
| 57 | + # compression: gzip |
| 58 | + storage: |
| 59 | + size: 5Gi |
| 60 | + storageClass: longhorn |
| 61 | + walStorage: |
| 62 | + size: 2Gi |
| 63 | + storageClass: longhorn |
| 64 | + enableSuperuserAccess: true |
| 65 | + monitoring: |
| 66 | + enablePodMonitor: true |
| 67 | + backup: |
| 68 | + barmanObjectStore: |
| 69 | + serverName: gitea-database |
| 70 | + destinationPath: s3://postgres-backups/cnpg/gitea |
| 71 | + endpointURL: http://192.168.10.133:30293 |
| 72 | + s3Credentials: |
| 73 | + accessKeyId: |
| 74 | + name: cnpg-s3-credentials |
| 75 | + key: AWS_ACCESS_KEY_ID |
| 76 | + secretAccessKey: |
| 77 | + name: cnpg-s3-credentials |
| 78 | + key: AWS_SECRET_ACCESS_KEY |
| 79 | + wal: |
| 80 | + compression: gzip |
| 81 | + data: |
| 82 | + compression: gzip |
| 83 | + retentionPolicy: "14d" |
0 commit comments