feat(agent-relay): helm test install status, search bootstrap causes, guided configure-rds.sh (agent-relay 0.7.87, sessions-pipeline 0.8.62)

Merged
KH
7d ago
+1187-106

Follows #552 (databaseGuard, merged): it reuses files/db-guard/lib.mjs. Rebased on main.

What a customer sees

helm test agent-relay -n agent-relay --logs

Real output from the kind test. The install has real images against an RDS-shaped test DB, and the migrations were still running:

POD LOGS: agent-relay-status
Agent Relay install status (release agent-relay, namespace agent-relay)
  AREA          CHECK                                                          STATUS  DETAIL
  migrations    relay-control-migrate                                          FAIL    not complete yet (running or pending); rerun helm test when it finishes
  migrations    relaycast-migrate                                              FAIL    not complete yet (running or pending); rerun helm test when it finishes
  workloads     relay-control                                                  FAIL    0/1 ready
  database      agent-relay-secrets: database-url                              ok      login=control_api_runtime: dedicated service login
  database      agent-relay-secrets: database-owner-url                        ok      login=relaycast_owner: relaycast owner identity
  ... (10 database rows, all ok)
  ca            configMap/rds-ca                                               FAIL    sha256 7bec69... differs from the configured 9f2c4e1a...: update every caSha256/sha256 for rds-ca in values
  pod identity  serviceaccount/agent-relay-worker                              FAIL    no EKS Pod Identity association (or IRSA role) for this ServiceAccount: aws eks create-pod-identity-association --namespace agent-relay --service-account agent-relay-worker ...
  s3            example-agent-relay-sessions                                   FAIL    bucket not found in us-east-1
  search        vpc-agent-relay-example.us-east-1.es.amazonaws.com             FAIL    cannot reach vpc-agent-relay-example.us-east-1.es.amazonaws.com (ENOTFOUND): check the OpenSearch security group and VPC access
UNHEALTHY: 20 check(s) failed

NOTES now prints the command after every install and upgrade.

Design

  • One status Pod, <release>-status, is the only test hook. It runs in the relaycast image the release already pins and reuses the databaseGuard lib, so the database rows apply the same rules as install-time: verify-full TLS with each component's own CA, and relaycast's verifyIdentity. Its ServiceAccount and script ConfigMap are ordinary release objects. I tried them as test hooks first, but then Helm 4 treated each one as a suite and --logs printed the table five times.
  • Kubernetes rows need a Role. The migrations, workloads and pod identity rows read the API through a read-only Role (list jobs, deployments and pods; never secrets). That Role sits behind databaseGuard.statusTest.rbac.create and is off by default. Today's EKS render creates no RBAC objects, and the namespace-scoped operator Role in docs/selfhost-secret-access.md cannot create Roles, so turning it on by default would break those operators' installs (the same issue as the #552 review finding). With the Role off, those rows show skip with the exact kubectl command to run instead. The guided installer in part D will turn the Role on.
  • S3 and OpenSearch checks are network-only. They make unauthenticated HTTPS requests: a 404 means the bucket is missing, a 301 means it's in the wrong region, and any other HTTP answer means it's reachable. Credentials are covered by the pod identity row.

Addendum from the live rehearsal (search bootstrap)

After configure-rds.sh --reset-databases in the rehearsal, the search-indexer-bootstrap Job ran before rds-setup.sh post and failed with only timed out waiting for the condition. The search indexer then crash-looped on permission denied for schema sessions. A plain helm rerun never retried the Job, because it keeps its name, and the diagnostic reported no failures. This PR now covers that:

  • Status rows: in the status table, the HoopDb runtime, read API, ingest and search runtime logins must have USAGE on sessions once that schema exists. A login without it fails its row, and the row gives the fix: run rds-setup.sh post (configure-rds.sh does it), then delete the failed search-indexer-bootstrap Job and run helm upgrade again. A failed search-indexer-bootstrap Job row names the same fix. This check runs only in the status test, not in the install hook: before post this state is expected, so the hook mustn't block on it.
  • Bootstrap guard (sessions-pipeline 0.8.61): the guard's wait timeout now names what it was waiting for and the fix: timed out after <n>s waiting for search_consumer_runtime to become a LOGIN role ... Fix: run rds-setup.sh post ..., then delete this search-indexer-bootstrap Job ... and run helm upgrade again. A final failure that shows an unactivated search login (permission denied, NOLOGIN, or a password or role failure) logs the same fix. Two new guard tests, 8/8 passing. The umbrella's sessions-pipeline dependency and Chart.lock change only that version and the lock digest. The fix that reorders the bootstrap itself (re-running it after post) is in the guided-install PR.
  • Goldens: I updated the subdomain goldens with Helm v4.3.1. The only diffs are the bootstrap-guard ConfigMap (new content, so a new hash name) and the status ServiceAccount and ConfigMap in the two renders where relaycast runs on PostgreSQL.

Tests

  • ci/agent-relay/db-guard/kind.sh (the db-guard-kind job): 18/18 pass. The new case installs with rbac.create=true and asserts:
    • 9 login rows are ok, and the search runtime row FAILs with the fix when sessions exists without its USAGE
    • the CA sha mismatch is reported
    • each migration Job gets its own row
    • there is exactly one test Pod and a verdict line
    • no URL appears in the output
    • the default render has no Role or RoleBinding
  • scripts/ci/charts.sh static agent-relay, ci/agent-relay/render.sh, all ci/agent-relay/test_*.py, ci/agent-relay/kind/test_local_stack.py and the registry check all pass. The fast-path workflow is regenerated (no change).

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Makes helm test agent-relay -n <namespace> --logs print a single healthy/unhealthy install status table for self-hosted Agent Relay, and makes scripts/selfhost/configure-rds.sh the guided install path that runs that check (agent-relay 0.7.86, sessions-pipeline 0.8.62).

Install status

  • The status Pod runs in the pinned relaycast image and reuses the databaseGuard lib, so database rows apply the same verify-full TLS and verifyIdentity rules as install-time. Only the Pod is a test hook; its ServiceAccount, ConfigMap and optional Role are ordinary release objects, so --logs prints the table once.
  • Each row is ok, FAIL (the fix is in the detail), or skip, and any FAIL exits non-zero. A search login missing USAGE on sessions and a failed search-indexer-bootstrap Job both fail their rows with the fix, without blocking installs.
  • Migration, workload and pod-identity rows read the Kubernetes API through a read-only Role behind databaseGuard.statusTest.rbac.create, off by default; without it they skip with the exact kubectl command. S3 and OpenSearch checks are unauthenticated network probes only, and no URL, password or Secret value is printed.
  • A Deployment row is ok only when replicas equal updatedReplicas, so a stuck old-revision rollout fails; an unbuildable URL becomes a FAIL row instead of aborting the table; CA pins come only from components that actually run.

Guided install and guards

  • configure-rds.sh is now the primary EKS + RDS install path: it creates the logins, writes the five Secrets, pins the CA and image digests, edits values.yaml in place (so a later plain helm upgrade keeps the layout), runs helm, waits on Jobs, and ends with the helm test verdict. Job waits stop at Complete or Failed, and a failed search bootstrap is deleted and re-run after post. --reset-databases checks ownership before dropping anything. Hand-written Secrets are the bring-your-own option and are refused up front when they fail databaseGuard.
  • The search bootstrap guard (sessions-pipeline 0.8.62) now names what it waited for and the fix: an unactivated login points at rds-setup.sh post, an unreachable OpenSearch names the host and likely cause, missing credentials point at Pod Identity, and a 403 names the role mapping. The one-line cause is written to the Pod termination message.
  • databaseGuard now refuses a plain helm upgrade that drops rdsLayout while a dedicated HoopDb owner login is set, pointing at rdsLayout: separate-database; without it the HoopDb migrate Job failed with rds_profile_unproven.
  • The search indexer's startup hint now reads its namespace from a new POD_NAMESPACE env var, so the kubectl command it prints is correct.
  • diagnose-install.py ends with a RESULT line, and skipped workload checks report INCOMPLETE (exit 3).