Local Testing — GCP (floci-gcp)
GCP has no native deployment service — Deployment Manager is retired, and Config Connector needs a cluster running its operator. gcpApply bridges chant’s Config Connector output to a local emulator directly: it maps each resource to its underlying Google REST API and drives create, update, and delete itself against floci-gcp.
The resource
Section titled “The resource”A GCS bucket, described as data. It synthesizes to a Config Connector manifest:
export const bucket = new StorageBucket({ metadata: { name: "trio-bucket", labels: { "app.kubernetes.io/managed-by": "chant" }, }, location: "US", storageClass: "STANDARD", uniformBucketLevelAccess: true, versioning: { enabled: true },});The op
Section titled “The op”chant run gcp boots floci-gcp, builds the manifest, applies it with gcpApply, verifies the bucket over the GCS REST API, and removes the container.
export default Op({ name: "gcp", taskQueue: "trio-gcp", phases: [ phase("Emulator", [flociGcpUp()]), phase("Build", [build(".", { script: "build:gcp" })]), phase("Apply", [gcpApply("dist/gcp.yaml", { endpoint: "http://localhost:4588", project: "local-project" })]), phase("Verify", [httpCheck("http://localhost:4588/storage/v1/b/trio-bucket")]), phase("Teardown", [flociGcpDown()]), ],});How gcpApply works
Section titled “How gcpApply works”Config Connector normally reconciles a CRD on a cluster into Google API calls. gcpApply performs that reconciliation directly, no cluster involved:
- Maps each kind to its REST resource via a dispatch table — Storage buckets, PubSub topics and subscriptions, Secret Manager secrets, IAM service accounts, Cloud Run services.
- Orders resources by their references so a dependency applies before its dependent.
- Drives full CRUD, following long-running operations to completion where the API returns one.
- Prunes orphans it owns — resources carrying the
managed-by: chantlabel that are no longer in the manifest — and leaves everything else alone.
Every call is the real GCS/PubSub/IAM shape, pointed at the emulator.
Run it
Section titled “Run it”Requires Docker and curl on PATH.
cd examples/local-cloud-trionpm installchant run gcpFrom local to real cloud
Section titled “From local to real cloud”Drop the endpoint override and gcpApply targets the real Google APIs for the same project. The manifest and the reconciliation logic are unchanged — this is the same code path a live apply takes.