You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
STEP 2: You change cluster.yaml back to initdb (normal mode)
286
+
BUT change backup.serverName to v3 (new lineage)
287
+
288
+
This prevents WAL conflicts:
289
+
- Old backups stay at v2 (untouched, point-in-time recovery available)
290
+
- New writes go to v3 (fresh archive)
291
+
- Next recovery will restore from v3, then bump to v4
292
+
```
293
+
294
+
## Bootstrap Decision Tree
295
+
296
+
CNPG's bootstrap section determines what happens when a Cluster is created:
297
+
298
+
```
299
+
┌──────────────────────────────────┐
300
+
│ CNPG Cluster Created │
301
+
│ (kubectl create or apply) │
302
+
└──────────────┬───────────────────┘
303
+
│
304
+
│ Check spec.bootstrap:
305
+
│
306
+
┌──────────┴──────────┐
307
+
│ │
308
+
↓ ↓
309
+
┌───────────────┐ ┌──────────────┐
310
+
│ initdb │ │ recovery │
311
+
│ (default) │ │ (restore) │
312
+
└───────┬───────┘ └──────┬───────┘
313
+
│ │
314
+
↓ │ Look for externalClusters:
315
+
┌──────────────────────┐ │
316
+
│ Create fresh db │ ↓
317
+
│ (empty, new owner) │ ┌──────────────────────────┐
318
+
│ │ │ Find serverName=v2 in S3 │
319
+
│ Starting postgres, │ │ Download base backup │
320
+
│ then run │ │ + replay WALs │
321
+
│ postInitSQL: │ │ │
322
+
│ - CREATE EXT │ │ → Postgres starts with │
323
+
│ - GRANT PRIVS │ │ restored data! │
324
+
│ │ └──────────────────────────┘
325
+
│ RESULT: Empty DB │
326
+
│ User must sign up │ RESULT: Full data restored
327
+
│ or restore from │ Users see their data
328
+
│ PVCs │ All tables/users back
329
+
└──────────────────────┘
330
+
OR
331
+
┌──────────────────────┐
332
+
│ BUG: Both present │
333
+
│ (initdb + recovery) │
334
+
│ │
335
+
│ CNPG webhook adds │
336
+
│ defaults → merger │
337
+
│ conflict → initdb │
338
+
│ wins │
339
+
│ │
340
+
│ RESULT: Empty DB │
341
+
│ (lost data!) │
342
+
└──────────────────────┘
343
+
```
344
+
345
+
**Key takeaway:** Only ONE bootstrap section should be present. If both exist, `initdb` wins and you lose data. Always remove recovery section before pushing to Git.
0 commit comments