tidaldb/tidal-stress/k8s/t4-load-job.yaml
jx12n 8e39ee1078 fix(m12p6): T4 TLS scale-up enablement — https seed-join via ready-only Service + up-front rustls provider
The m12p5 idle-readiness work converged on an idle cluster, but the real
T4 1M/1536 scale-up over mTLS still failed to admit new pods. Three real
blockers, all invisible to the plaintext in-process tests:

- CryptoProvider crash-loop: the seed-join/reseed boot path builds a
  blocking reqwest (rustls) HTTPS client on a dedicated boot thread BEFORE
  GrpcTransport::new installs the process-wide provider, so every TLS joiner
  panicked. Install it at the top of main(); ensure_crypto_provider() is now
  pub, idempotent, harmless on the plaintext standalone path.

- Wrong seed scheme + target: peer_url honors an explicit URL scheme
  verbatim, so http:// dialed plaintext at the TLS :9500 port. Seed is now
  https:// AND points at the ready-only client Service (ClusterIP VIP), not
  the headless peers Service — so a joiner never round-robins onto a
  not-ready pod (incl. itself) and burns the 120s discovery window.

- Too-tight poll budget: a cold status poll pays a full rustls handshake on
  top of DNS+TCP; under CPU contention that alone blew the 500ms budget, so
  the joiner timed out every poll for the whole window despite the peer being
  reachable. Status-poll timeout is now 5s (env: TIDAL_SEED_STATUS_TIMEOUT_MS)
  with a separate 2s connect timeout (dead seeds still fail fast) and
  debug-level logging on every discovery failure mode.

Refactors riding along:
- on_heartbeat takes a HeartbeatContext struct (additive fields, no silent
  u64 transposition) across tidal-net, election_driver, and both test hooks.
- ShardReplica::applied_for_leader_shard centralizes per-source-shard keying
  (BUG 1) shared by the readiness drive and local_status.
- idle-readiness test now asserts convergence within ½ budget — a slow-path
  regression (periodic self-heal / status-poll dependency) the binary budget
  check would otherwise wave through.

New k8s T4 manifests: cluster-t4-kind kustomization + single-group topology
patch; tidal-stress t4 seed/load Jobs.
2026-06-14 20:29:37 -06:00

112 lines
3.7 KiB
YAML

# T4 (m12p5) — sustained load during the 3→5→3 scale (Phase B).
#
# A single generator holds a steady ack=quorum read+write mix for ~5 min, long
# enough to span a scale-down (5→3) and scale-up (3→5) under load. `--skip-seed`
# (the corpus is already registered by t4-seed-job) keeps the id space; the mix
# carries item/embed WRITES so the transition is exercised by live quorum writes,
# not just reads. `--max-error-pct 0` is the zero-acked-loss gate: a quorum write
# that cannot reach its majority during a membership change fails to ack → error
# → the Job exits non-zero. `--json-summary` captures the per-stage p99 envelope
# (before / during / after the scale) for the evidence table.
#
# NO --poll-status: this phase is UNDER LOAD (the idle-readiness isolation is the
# separate idle Phase A driven from the host), so status polling is unneeded and
# omitted to keep the offered load pure.
#
# Apply: kubectl apply -f tidal-stress/k8s/t4-load-job.yaml
# Watch: kubectl logs -f job/tidal-stress-t4-load -n tidaldb-cluster
apiVersion: batch/v1
kind: Job
metadata:
name: tidal-stress-t4-load
namespace: tidaldb-cluster
labels:
app.kubernetes.io/name: tidal-stress
app.kubernetes.io/part-of: tidaldb
spec:
backoffLimit: 0
ttlSecondsAfterFinished: 7200
template:
metadata:
labels:
app.kubernetes.io/name: tidal-stress
app.kubernetes.io/part-of: tidaldb
spec:
restartPolicy: Never
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: stress
image: tidaldb-stress:m12p4-local
imagePullPolicy: IfNotPresent
args:
- --target
- https://tidaldb-0.tidaldb-peers.tidaldb-cluster.svc.cluster.local:9500
- --target
- https://tidaldb-1.tidaldb-peers.tidaldb-cluster.svc.cluster.local:9500
- --target
- https://tidaldb-2.tidaldb-peers.tidaldb-cluster.svc.cluster.local:9500
- --ca-cert
- /etc/tidaldb/tls/ca.crt
- --ack
- quorum
- --skip-seed
- --corpus
- "10000"
- --embedding-dim
- "1536"
- --users
- "100000"
# ~5 min steady hold: three 100s stages so the per-stage JSON gives a
# before / during / after p99 read across the scale window.
- --ramp
- "400:100,400:100,400:100"
- --mix
- "feed=4,search=1,view=2,like=1,item=1,embed=1"
- --max-inflight
- "2000"
- --json-summary
- /tmp/t4-load-summary.json
- --max-error-pct
- "0"
env:
- name: TIDAL_API_KEY
valueFrom:
secretKeyRef:
name: tidaldb-credentials
key: TIDAL_API_KEY
- name: TIDAL_STRESS_LOG
value: warn
resources:
requests:
cpu: 500m
memory: 256Mi
limits:
cpu: "3"
memory: 1Gi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
volumeMounts:
- name: cluster-tls
mountPath: /etc/tidaldb/tls
readOnly: true
- name: tmp
mountPath: /tmp
volumes:
- name: cluster-tls
secret:
secretName: tidaldb-cluster-tls
items:
- key: ca.crt
path: ca.crt
- name: tmp
emptyDir: {}