Skip to content

Commit 44c6fa5

Browse files
committed
Address remaining PR #1042 review findings
- Qualify the copy-on-write claim in the Branch concept doc: restores depend on the CSI driver supporting copy-on-write, not guaranteed universally. - Align the concept doc's example storageClassName with its volumeSnapshotClassName (topolvm-provisioner-thin instead of gp3). - Describe status.resources as references, moving teardown behavior into the policy-specific text (only Delete removes everything; Orphan keeps authSecret/clonedPVCs). Add the missing configSecret entry to the overview page's resource list. - Also mask full_name in the post-action anonymization example, so the "anonymized" claim and its verification output do not leave an unredacted personal-data column in view. - Add kubectl wait --for=condition=Ready steps after each branch/database apply in the refresh, cross-namespace, HA, and VolumeSnapshotClass examples, before commands that depend on readiness. - Scope the customization guide's cleanup to the branches it actually created, instead of `branch --all`, so it cannot sweep up an unrelated branch left in the same demo namespace by another walkthrough. - Drop the "byte-for-byte" wording from the same-cluster walkthrough's verification step: the source stays writable during the snapshot, so only row presence is actually being proven. Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 765712e commit 44c6fa5

5 files changed

Lines changed: 36 additions & 15 deletions

File tree

‎docs/guides/postgres/branch/customization/examples/dev-branch-masked.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ spec:
3838
- -c
3939
- |
4040
UPDATE customers
41-
SET email = 'user' || id || '@example.invalid',
41+
SET full_name = 'Masked Customer',
42+
email = 'user' || id || '@example.invalid',
4243
phone = '+1-555-0000';
4344
resources:
4445
requests:

‎docs/guides/postgres/branch/customization/index.md‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ spec:
8383
- -c
8484
- |
8585
UPDATE customers
86-
SET email = 'user' || id || '@example.invalid',
86+
SET full_name = 'Masked Customer',
87+
email = 'user' || id || '@example.invalid',
8788
phone = '+1-555-0000';
8889
resources:
8990
requests:
@@ -146,11 +147,11 @@ The branch's data is anonymized:
146147
```bash
147148
$ kubectl exec -it -n demo dev-postgres-masked-0 -c postgres -- psql -U postgres \
148149
-c "SELECT id, full_name, email, phone FROM customers ORDER BY id LIMIT 3;"
149-
id | full_name | email | phone
150-
----+------------+-----------------------+-------------
151-
1 | Customer 1 | user1@example.invalid | +1-555-0000
152-
2 | Customer 2 | user2@example.invalid | +1-555-0000
153-
3 | Customer 3 | user3@example.invalid | +1-555-0000
150+
id | full_name | email | phone
151+
----+-----------------+-----------------------+-------------
152+
1 | Masked Customer | user1@example.invalid | +1-555-0000
153+
2 | Masked Customer | user2@example.invalid | +1-555-0000
154+
3 | Masked Customer | user3@example.invalid | +1-555-0000
154155
(3 rows)
155156
```
156157

@@ -231,6 +232,9 @@ Create it and wait for the first copy:
231232
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/postgres/branch/customization/examples/dev-branch-refresh.yaml
232233
branch.courier.kubedb.com/dev-branch-refresh created
233234
235+
$ kubectl wait --for=condition=Ready branch/dev-branch-refresh -n demo --timeout=10m
236+
branch.courier.kubedb.com/dev-branch-refresh condition met
237+
234238
$ kubectl exec -n demo dev-postgres-refresh-0 -c postgres -- psql -U postgres -tAc "SELECT count(*) FROM customers;"
235239
1001
236240
```
@@ -346,6 +350,9 @@ namespace/dev created
346350
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/postgres/branch/customization/examples/dev-branch-xns.yaml
347351
branch.courier.kubedb.com/dev-branch-xns created
348352
353+
$ kubectl wait --for=condition=Ready branch/dev-branch-xns -n demo --timeout=10m
354+
branch.courier.kubedb.com/dev-branch-xns condition met
355+
349356
$ kubectl get branch -n demo dev-branch-xns
350357
NAME PHASE MODE TARGET FRESHNESS AGE
351358
dev-branch-xns Ready Local dev-postgres-xns 1s 61s
@@ -381,9 +388,15 @@ Deploy a 3-replica source and branch it exactly as before:
381388
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/postgres/branch/customization/examples/sample-postgres-ha.yaml
382389
postgres.kubedb.com/sample-postgres-ha created
383390
391+
$ kubectl wait --for=condition=Ready pg/sample-postgres-ha -n demo --timeout=10m
392+
postgres.kubedb.com/sample-postgres-ha condition met
393+
384394
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/postgres/branch/customization/examples/dev-branch-ha.yaml
385395
branch.courier.kubedb.com/dev-branch-ha created
386396
397+
$ kubectl wait --for=condition=Ready branch/dev-branch-ha -n demo --timeout=10m
398+
branch.courier.kubedb.com/dev-branch-ha condition met
399+
387400
$ kubectl get branch -n demo dev-branch-ha
388401
NAME PHASE MODE TARGET FRESHNESS AGE
389402
dev-branch-ha Ready Local dev-postgres-ha 1s 81s
@@ -489,6 +502,9 @@ spec:
489502
```bash
490503
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/postgres/branch/customization/examples/dev-branch-vsc.yaml
491504
branch.courier.kubedb.com/dev-branch-vsc created
505+
506+
$ kubectl wait --for=condition=Ready branch/dev-branch-vsc -n demo --timeout=10m
507+
branch.courier.kubedb.com/dev-branch-vsc condition met
492508
```
493509

494510
Only the pinned branch uses that class; every other branch created in this guide left the field unset and took the driver's default, `topolvm-provisioner-thin`:
@@ -521,8 +537,10 @@ For problems with the core branch flow — snapshotting, cloning, provisioning
521537

522538
## Cleaning up
523539

540+
This page created five branches alongside the source in `demo`, plus one extra database and one extra namespace. Delete each branch by name rather than `--all`, so an unrelated branch left over from another walkthrough in the same `demo` namespace is not swept up. `kubectl delete` on a `Branch` blocks until Courier's cleanup finalizer clears, so there is nothing further to wait for:
541+
524542
```bash
525-
$ kubectl delete branch -n demo --all
543+
$ kubectl delete branch -n demo dev-branch-masked dev-branch-refresh dev-branch-xns dev-branch-ha dev-branch-vsc
526544
$ kubectl delete pg -n demo sample-postgres-ha
527545
$ kubectl delete ns dev
528546
```

‎docs/guides/postgres/branch/overview/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Alongside the phase, `status.conditions` records each milestone:
120120

121121
`SnapshotReady` → `TargetCreated` → `TargetReady` → [`RootPasswordReset`] → [`PostActionsCompleted`] → `Ready`
122122

123-
`status.resources` lists everything the branch owns (its auth Secret, cloned PVCs, and current post-action Job), and `status.snapshot` records the snapshot set backing the current copy — the strategy used, and one entry per source volume with its size and readiness.
123+
`status.resources` lists everything the branch owns (its auth Secret, optional config Secret, cloned PVCs, and current post-action Job), and `status.snapshot` records the snapshot set backing the current copy — the strategy used, and one entry per source volume with its size and readiness.
124124

125125
## Keeping a Branch Fresh
126126

‎docs/guides/postgres/branch/same-cluster/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ $ kubectl exec -it -n demo dev-postgres-0 -c postgres -- psql -U postgres -c "SE
407407
(3 rows)
408408
```
409409

410-
All 1000 rows are there, byte-for-byte as they were on the source when the snapshot was taken.
410+
All 1000 rows captured in the snapshot are present on the branch.
411411

412412
## Verify the Branch Is Isolated
413413

‎docs/guides/postgres/concepts/branch.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ section_menu_id: guides
1919
`Branch` is a Kubernetes `Custom Resource Definition` (CRD). It provides a declarative way to create an
2020
instant, writable copy of a running KubeDB-managed database — the way you would branch a Git
2121
repository. You describe the source database and the target you want, and the kubedb-courier operator
22-
snapshots the source's volumes, clones them copy-on-write, and provisions a second database on top of
23-
the clone.
22+
snapshots the source's volumes, restores the branch volumes from those snapshots, and provisions a
23+
second database on top of the restore. How fast that restore is, and whether it costs extra storage,
24+
depends on the CSI driver: drivers that support copy-on-write restores make this near-instant and cheap.
2425

2526
One `Branch` object is one branch. It owns the database it creates: the branch's lifecycle, its optional
2627
refresh schedule, and its teardown are all driven from this single object. The branched database itself
@@ -52,7 +53,7 @@ spec:
5253
# clusterName omitted — same-cluster branch
5354
namespace: demo
5455
name: dev-postgres
55-
storageClassName: gp3
56+
storageClassName: topolvm-provisioner-thin
5657
resources:
5758
requests:
5859
cpu: 500m
@@ -207,8 +208,9 @@ to `Delete`.
207208
`RootPasswordReset` (when `spec.resetRootPassword` is set), `PostActionsCompleted` (when
208209
`spec.postActions` is set), and `Ready`. A `Failed` condition carries the reason —
209210
`PostActionFailed` for a post-action failure, which is terminal until the spec changes.
210-
- `resources` — the objects the branch owns, which is exactly what teardown removes:
211-
`authSecret`, `clonedPVCs`, `configSecret`, and the current generation's `postActionJob`.
211+
- `resources` — references to the objects the branch owns: `authSecret`, `clonedPVCs`, `configSecret`,
212+
and the current generation's `postActionJob`. Which of these teardown actually removes depends on
213+
`spec.deletionPolicy` — see [spec.deletionPolicy](#specdeletionpolicy) above.
212214
- `snapshot` — the snapshot set backing the current copy.
213215
- `strategy` — `VolumeGroupSnapshot` when the CSI driver offers a `VolumeGroupSnapshotClass`
214216
(group-consistent across all volumes), otherwise `VolumeSnapshot` (per-volume fallback).

0 commit comments

Comments
 (0)