All GCP scenarios

GCP Scenario

Kubernetes Test Runner on GKE with Results in Cloud SQL

GKE Autopilot runs Playwright/k6 Jobs scaled by KEDA from Pub/Sub; raw artifacts go to GCS, structured results stream into Cloud SQL (PostgreSQL) for BigQuery-backed dashboards.

Architecture

Cloud Scheduler / Cloud Build ─► Pub/Sub topic: test-jobs
                                              │
                              KEDA on GKE Autopilot (Pub/Sub scaler)
                                              │
                              K8s Job per message (Playwright / k6 pod)
                              ├─ Workload Identity → Secret Manager (DB creds)
                              ├─ runs suite → /artifacts
                              └─ sidecar reporter
                                     ├─► GCS (junit, trace, video)
                                     └─► Cloud SQL PostgreSQL
                                            ├─ test_runs / test_cases / artifacts
                              Datastream / scheduled query
                                     └─► BigQuery (long-term analytics)
                              Cloud Monitoring: pod restarts, OOM, Job duration SLO

Services used

Steps

  1. 1. Build runner images

    Cloud Build produces Playwright/k6 images, pushes to Artifact Registry with vulnerability scan enabled.

  2. 2. DB schema

    Cloud SQL PostgreSQL instance with private IP; migration creates `test_runs`, `test_cases`, `artifacts` tables. Unique index on `(run_id, case_name)` enforces idempotency.

  3. 3. Dispatch

    Cloud Scheduler (or Cloud Build post-deploy step) publishes one Pub/Sub message per shard: `{ runId, suite, shard, commit, targetUrl }`.

  4. 4. Scale

    KEDA `ScaledJob` reads Pub/Sub subscription backlog; GKE Autopilot schedules one pod per message and bills only for pod runtime. Workload Identity binds the pod's KSA to a Google SA with `secretmanager.secretAccessor` and `cloudsql.client`.

  5. 5. Execute + report

    Pod runs the suite via Cloud SQL Auth Proxy sidecar; reporter sidecar uploads artifacts to a GCS bucket (`gs://qa-artifacts/{runId}/`) and inserts case-level rows into Cloud SQL.

  6. 6. Analytics

    Federated query or scheduled `EXPORT DATA` pushes nightly snapshots from Cloud SQL into BigQuery for long-term trend dashboards (Looker Studio).

  7. 7. Monitor

    Cloud Monitoring tracks Job duration, pod OOMKills and Pub/Sub oldest-unacked-message; alerting policy pages on backlog growth or failure-rate SLO burn.

Takeaways

  • GKE Autopilot + KEDA = serverless feel for test execution with full Kubernetes semantics.
  • Workload Identity removes static DB passwords from pods.
  • Cloud SQL holds the hot operational data; BigQuery holds the long history — same schema, two query patterns.