Skip to content

v1.2.0 — high availability

Choose a tag to compare

@cwolsen7905 cwolsen7905 released this 24 Sep 21:16
· 186 commits to main since this release

uBix Vault 1.2.0 — high availability: run several replicas over MySQL/MariaDB, one active and the rest forwarding to it, so draining a node or upgrading is a sub-second handoff instead of an outage. Additive and backward-compatible with the 1.x API.

Image: ghcr.io/ubixsys/ubixvault:1.2.0 (multi-arch amd64/arm64, cosign-signed + SBOM). Helm chart: deploy/charts/ubixvault (0.1.16, appVersion 1.2.0).

Upgrade notes

  • MySQL schema goes to version 2 (a new lock table), applied automatically on first start. Schema migrations are forward-only and a binary now refuses a database migrated by a newer one, so take a snapshot before upgrading: rolling back across this release means restoring it.
  • Enabling HA on an existing install: upgrade to 1.2.0 at one replica first, then set ha.enabled, then scale. A pre-1.2 replica takes no lock and must never run against the database alongside HA replicas. See docs/DEPLOYMENT.md § Upgrades.
  • Audit token_hmac values change once: the HMAC key now lives in the barrier, so HMACs from before the upgrade will not match those after it.

Added

  • Active/standby HA (-ha, requires -storage mysql). The active replica holds a lease-based lock row in the database; expiry is judged by the database's clock. Every write is fenced to the lock generation the replica acquired, inside its own transaction, so a replica that lost the lock without noticing (a pause, a partition) cannot write. A replica that is shut down — every drain and rolling restart — hands the lock over and a standby is active within -ha-retry-interval (500ms); a replica that dies is replaced within -ha-lock-ttl (15s). Two replicas cannot initialize the same database.
  • Standby forwarding, so clients can use any replica (e.g. one Kubernetes Service). Replicas talk over a dedicated cluster listener (-ha-cluster-listen, port 8201; -ha-cluster-addr) with mutual TLS from a CA the vault keeps in its own barrier — no operator certificates, and only replicas that unsealed the same vault can connect. The active replica audits and rate-limits forwarded requests under the original client's address. During a handoff standbys hold requests (up to 5s) rather than failing them, and re-send a request without a body if the leader they reached had just gone; a request with a body is never sent twice.
  • sys/leader (unauthenticated) and sys/step-down (authenticated), Vault-compatible. A replica that steps down stays out of the election for 10s so another takes over — unless none does, in which case it takes the lock back rather than leave the vault with no active replica.
  • sys/health query parameters as in Vault: standbyok, activecode, standbycode (default 429), sealedcode, uninitcode; perfstandbyok is accepted and ignored. The body gains standby. Without parameters a single replica answers exactly as before.
  • -shutdown-delay: on SIGTERM an HA replica hands the active role over at once, then keeps serving (as a forwarding standby) for this long before closing its listeners, while Kubernetes stops routing to the terminating pod.
  • Helm chart ha.enabled (chart 0.1.16): replicaCount replicas (3 recommended) with -ha, the pod IP from the downward API, the cluster port, a standbyok readiness probe, a PodDisruptionBudget (maxUnavailable: 1), pod anti-affinity (ha.antiAffinity: soft/hard/none) and ha.shutdownDelay (5s). replicaCount > 1 without HA, and HA without MySQL, are still refused. New terminationGracePeriodSeconds (30, Kubernetes' default). Single-replica renders are otherwise unchanged.
  • HA failover test in CI (.github/workflows/ha-e2e.yml, test/e2e/ha/): three replicas on kind with a client reading through the Service throughout. Deleting the active pod, draining its node, a rolling restart, sys/step-down and a force-delete must fail zero requests (first run: 0 of 1,512); freezing the active pod's node must fail over within the lock TTL (17s) and the thawed former active must step down.
  • docs/DEPLOYMENT.md: an HA guide, the rolling-upgrade procedure, and the order for enabling HA on an existing install.

Changed

  • The MySQL schema is versioned and checked at startup. The backend used to record a schema version it never read. It now reads it first: a current schema needs no lock and no DDL (so replicas restarting together don't queue); a behind one is migrated in order under a MySQL named lock, with its own generous time limit; a newer one is refused, naming both versions.
  • Audit token HMACs are stable across restarts and replicas: the key is kept in the barrier (sys/audit/hmac-key) instead of being random per process. Entries written while sealed omit token_hmac.
  • make lint installs and runs golangci-lint v2.12.2, the version CI uses, and CI runs on pushes to every branch mirrored from GitLab.

Fixed

  • Auto-unseal retries instead of giving up. A KMS, transit vault, external seal command or database briefly unreachable at startup used to leave the server sealed until restarted; it now retries with backoff (1s to 1m) while the API is already up (livez 200, health 503 until unsealed).
  • Sealing drops cached state: loaded quotas, the database engine's connection pool, the Kubernetes auth TokenReview client and cached JWKS keys no longer survive a seal/unseal; reconfiguring the database engine no longer leaks the previous connection pool.

Security

  • Response-wrapping tokens are single-use under concurrency. Simultaneous sys/wrapping/unwrap calls with the same token could each return the payload; unwrap is now serialized, so exactly one does. Affected single-node deployments of every earlier version.
  • The security review brief covers HA's new surface (the cluster listener and its CA, the forwarded client address, fencing, and forwarding/replay).

Security assurance (read this)

uBix Vault has not yet undergone an independent third-party security audit. Its cryptography and trust path are standard-library Go, written in-house, fuzzed, and property-tested — but that is not a substitute for outside review, which is an active, open milestone, deliberately not a version gate (docs/VERSIONING.md). Weigh that before placing high-blast-radius secrets here.

Full history: CHANGELOG.md.