miroir/k8s
jedarden 77ff0b7528 Phase 6 — Horizontal Scaling + HPA (§14): Complete
Implements the full horizontal scaling architecture with HPA integration
and three coordination modes for background work partitioning.

## §14.1-§14.3 — Per-pod envelope
- Resource limits: 2000m CPU / 3584MiB RAM (2 vCPU / 3.75 GB)
- Memory budget validated for all §13 features
- CPU budget: ~3 kQPS/pod (small), ~1 kQPS/pod (large) at 70%

## §14.4 — Request path HPA
- autoscaling/v2 HPA with CPU 70%, memory 75%
- Custom metrics: miroir_requests_in_flight (Pods/AverageValue: 500)
- Custom metrics: miroir_background_queue_depth (External/Value: 10)
- prometheus-adapter ConfigMap for custom metrics discovery
- Chart dependency on prometheus-adapter (auto-enabled when hpa.enabled=true)
- values.schema.json Rule 2: HPA requires replicas >= 2 AND Redis backend

## §14.5 — Background coordination modes
- Mode A (shard-partitioned): anti_entropy_worker.rs, drift_reconciler.rs
- Mode B (leader-only): mode_b_coordinator.rs + leader_election/
- Mode C (work-queued): mode_c_coordinator.rs + mode_c_worker/
- Peer discovery via headless Service SRV records (15s refresh)

## §14.6 — Per-feature scaling mode wiring
- docs/horizontal-scaling/per-feature.md maps all 21 features to modes
- Forced-mode constraints in values.schema.json (Rules 0-5)

## §14.7 — Deployment sizing matrix
- docs/horizontal-scaling/sizing.md with workload tiers
- Task-store memory accounting for Redis-backed deployments

## §14.8 — Resource-aware configuration defaults
- charts/miroir/values.yaml with envelope-sized defaults
- tests/fixtures/section-14.8-defaults.yaml as reference

## §14.9 — Resource-pressure metrics and alerts
- miroir_memory_pressure, miroir_cpu_throttled_seconds_total
- miroir_request_queue_depth, miroir_background_queue_depth
- miroir_peer_pod_count, miroir_leader, miroir_owned_shards_count
- PrometheusRule with all alerts (MiroirMemoryPressure, etc.)

## §14.10 — Vertical-scaling escape valve
- docs/horizontal-scaling/single-pod.md documents single-pod mode
- tests/fixtures/section-14.10-single-pod-oversized.yaml with 2.13× multiplier

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 00:23:57 -04:00
..
argo-workflows Phase 6 — Horizontal Scaling + HPA (§14): Complete 2026-05-24 00:23:57 -04:00
argocd P8: Finalize CI/CD templates, prod ArgoCD app, and CHANGELOG for v0.1.0 2026-04-19 15:09:14 -04:00
openbao-policy.hcl P12: close Phase 12 epic — all 6 open problems triaged and documented 2026-04-24 19:14:23 -04:00