Documentation
¶
Overview ¶
migration-worker runs the corpus migration as a long-lived Deployment with an internal claim/process/sleep loop.
This worker implements the pattern required by this org's hard rule: "Never write kind: Job or kind: CronJob" — migration work is done by a Deployment with an internal loop that claims incomplete partitions from migration_progress, processes them, sleeps, and repeats.
Architecture: - Single-replica Deployment with RollingUpdate (maxSurge: 0, maxUnavailable: 1) - Internal loop: claim next pending partition → process → sleep → repeat - Progress tracking via migration_progress table in Postgres - Graceful shutdown on SIGTERM - Health checks via /healthz and /ready endpoints
Migration phases: 1. Preflight: Validate encryption credentials can decrypt all epochs 2. Migration: Stream partitions, process repos, write Postgres + ARMOR 3. Completion: Enter idle state with health checks passing
The worker never exits on success — it stays running to allow: - Live monitoring of migration status via pod logs - Manual re-run for debugging/validation - Future incremental migrations
Usage:
migration-worker [flags]
Environment variables (for K8s Deployment):
PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD, PGSSLMODE MIGRATION_SLEEP_INTERVAL, MIGRATION_CLAIM_TIMEOUT, MIGRATION_LOG_LEVEL