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
Copy file name to clipboardExpand all lines: docs/operator_configuration.md
+79Lines changed: 79 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -222,6 +222,85 @@ spec:
222
222
223
223
See [Keeper Reference](keeper_reference.md) for details on how CHI references CHK resources.
224
224
225
+
### Replicated Host Sync Gate
226
+
227
+
The operator can optionally block a rolling host reconcile until a recreated replicated
228
+
ClickHouse host catches up to a bounded replication baseline. This is an operator
229
+
rolling gate, not a readiness probe. It is disabled by default.
230
+
231
+
This is especially useful for local or direct-attached storage deployments, including
232
+
NVMe-backed Local PVs, where a recreated pod may start with an empty or replaced disk
233
+
and must rebuild replicated data from peer replicas before the operator rolls the next
234
+
host.
235
+
236
+
The existing caught-up marker path remains unchanged when this gate is disabled. That
237
+
path only polls the local host's `MAX(absolute_delay)` from `system.replicas` before
238
+
writing `status.hostsWithReplicaCaughtUp`, which is weak for recreated-host recovery
239
+
because the metric is limited to replicated objects already loaded and visible on that
240
+
local server. During recreated-host recovery, asynchronous database/table loading may
241
+
not have exposed all replicated objects on the local host yet, and a local delay metric
242
+
cannot discover replicated objects that exist on peers or issue a ClickHouse sync
243
+
barrier for their known parts. The sync gate adds those checks before the operator
244
+
advances to the next host.
245
+
246
+
```yaml
247
+
spec:
248
+
reconcile:
249
+
host:
250
+
wait:
251
+
replicas:
252
+
sync:
253
+
enabled: "false"
254
+
mode: "lightweight"
255
+
timeout: 0
256
+
onTimeout: "abort"
257
+
health:
258
+
pollInterval: 10
259
+
successThreshold: 6
260
+
```
261
+
262
+
| Setting | Default | Description |
263
+
|---|---|---|
264
+
| `enabled` | `"false"` | Enables the replicated-host sync gate. Existing replica-delay behavior is unchanged when disabled. |
265
+
| `mode` | `"lightweight"` | Uses `SYSTEM SYNC REPLICA ... LIGHTWEIGHT`. No fallback to legacy `SYSTEM SYNC REPLICA` is performed. |
266
+
| `timeout` | `0` | Whole-gate timeout in seconds. `0` means unbounded. |
267
+
| `onTimeout` | `"abort"` | `abort` stops reconcile on the gate deadline. `proceed` advances without writing the caught-up marker, so a later reconcile can try again. |
268
+
| `health.pollInterval` | `10` | Seconds between post-sync health checks. |
269
+
| `health.successThreshold` | `6` | Consecutive healthy checks required after sync before the caught-up marker is written. |
270
+
271
+
When enabled, the gate waits for asynchronous database loading when ClickHouse exposes
272
+
`system.asynchronous_loader`, discovers replicated objects from peer replicas, syncs
273
+
`Replicated`databases with `SYSTEM SYNC DATABASE REPLICA`, syncs replicated tables
274
+
with `SYSTEM SYNC REPLICA ... LIGHTWEIGHT`, and then requires a stable health window.
275
+
Health is based on `system.replicas`: `is_readonly = 0`, `is_session_expired = 0`, and
replicas, and expired Keeper sessions. The caught-up marker is written only after real
288
+
success or when peer discovery confirms that there are no replicated objects to sync.
289
+
290
+
Manual local-PV/data-loss validation:
291
+
292
+
1. Create a CHI with a replicated shard and `sync.enabled: "true"`.
293
+
2. Wait for the current hosts to become caught up and confirm
294
+
`status.hostsWithReplicaCaughtUp` contains the host FQDNs.
295
+
3. Simulate storage loss for one host, for example by removing the local PV/PVC data
296
+
in a test environment.
297
+
4. Reconcile the CHI and confirm the operator removes the stale caught-up marker for
298
+
the recreated host.
299
+
5. Confirm the recreated host runs the sync gate and the next host in the shard does
300
+
not advance while the recreated host is still behind.
301
+
6. Allow replication to catch up and confirm the recreated host receives the
302
+
caught-up marker again, then the next host proceeds.
303
+
225
304
## Security
226
305
227
306
The `security:` block at the chopconf top level (sibling of `clickhouse:`) holds operator-wide hardening defaults across three orthogonal axes: transport hardening (`security.policy`), FIPS cryptographic-module enforcement (`security.fips.enforced`), and workload supply-chain gating (`security.images.policy`). Per-component sub-blocks under it cover ClickHouse-client TLS, ZooKeeper-client TLS, Kubernetes-client TLS, and the operator↔metrics-exporter IPC channel.
0 commit comments