Commit Graph

2 Commits

Author SHA1 Message Date
527b3b0246 feat(scripts): sunbeam.py — OpenBao DB engine, VSO seeding, E2E verify, error handling
Database secrets engine (_configure_db_engine):
- Creates a dedicated `vault` PostgreSQL user via CNPG peer auth (psql exec).
  CNPG enableSuperuserAccess=false blocks remote auth for the postgres
  superuser, so we create vault with CREATEROLE and grant ADMIN OPTION on
  each service role (required by PG 16+ to rotate passwords).
- Configures the OpenBao postgresql plugin (cnpg-postgres connection) and
  creates static roles for all PG_USERS with 24h rotation_period.
- All bao/psql calls now raise RuntimeError on non-zero exit — no more
  silent failures.

Credential seeding (_seed_openbao):
- Added secret/login-ui path (cookie-secret, csrf-cookie-secret) so the
  login UI no longer needs hardcoded values in its Deployment manifest.
- Removed all DB password fields from KV; passwords are now managed
  exclusively by the database secrets engine.

Lifecycle:
- pre_apply_cleanup() prunes stale VaultStaticSecrets that have been
  superseded by VaultDynamicSecrets of the same name, preventing the
  "not the owner" ownerRef conflict that blocked secret updates.
- status_check() no longer marks Completed/Succeeded pods as unhealthy.
- _vso_sync_status() added to status output: shows sync state (secretMAC
  for VSS, lastRenewalTime for VDS) across all managed namespaces.

Verification (--verify):
- New verify_vso() function writes a random sentinel to OpenBao, creates
  a VaultAuth + VaultStaticSecret in the ory namespace, waits up to 60s
  for VSO to sync, decodes the K8s Secret, and asserts the value matches.
  Cleans up all test resources unconditionally. Replaces the unreliable
  Helm test pod for integration testing.
2026-03-02 18:34:28 +00:00
6110c33b48 scripts: rename local-up.py → sunbeam.py; add Gitea bootstrap + registry mirroring
- Rename local-up.py → sunbeam.py; update docstring and argparser description
- Add setup_lima_vm_registry(): installs mkcert root CA into Lima VM system trust
  store and writes k3s registries.yaml (Gitea auth); restarts k3s if changed
- Add bootstrap_gitea(): waits for pod Running+Ready, sets admin password via
  gitea CLI, clears must_change_password via Postgres UPDATE (Gitea enforces
  this flag at API level regardless of auth method), creates studio/internal orgs
- Add mirror_amd64_images(): pulls amd64-only images, patches OCI index with an
  arm64 alias pointing at the same manifest (Rosetta runs it transparently),
  imports patched image into k3s containerd, pushes to Gitea container registry
- Add AMD64_ONLY_IMAGES list (currently: lasuite/people-{backend,frontend})
- Add --gitea partial flag: registry trust + Gitea bootstrap + mirror
- Add --status flag: pod health table across all managed namespaces
- Fix create_secret to use --field-manager=sunbeam so kustomize apply (manager
  kubectl) never wipes data fields written by the seed script
- Add people-frontend to SERVICES_TO_RESTART (was missing)
2026-03-01 21:04:39 +00:00