Skip to content

chant has no native GCP apply path: add a GCP applier (direct REST → floci-gcp / real GCP) #706

Closed

Description

@lex00

Goal

Give chant a native GCP apply path — an applier that speaks GCP's REST APIs directly
and is endpoint-overridable, so the same code targets real GCP or the floci-gcp
emulator (:4588). No Terraform, no Kubernetes controller, no Config Connector in
chant's path.
This is the GCP twin of the Azure apply path (#707) and the analogue of
AWS's existing cloud-executor.ts.

Reframed 2026-07-07. This issue was originally "substitute controller vs direct
Terraform." Both framings are retired — see "Retired approaches" below. The earlier
comments (Spike 0, scope research) remain as the trail that led here.

The shape: one pattern across all three clouds

A native applier that speaks the cloud's own API, with an endpoint override so it hits
real cloud or an emulator:

Local emulation isn't a special feature — it falls out for free by pointing the applier
at :4588 instead of googleapis.com. And like #707, this also unblocks real GCP
deploys, which chant cannot do today without standing up Config Connector on a cluster.

Why this is the right shape (and floci-gcp makes it easy)

floci-gcp is a plain GCP API server — Java/GraalVM, standalone, not Terraform-
based and not Kubernetes-based (established in #705 research). You point any GCP
client at it via endpoint override. So chant can call it directly over REST, exactly
like cfn-deploy calls floci for AWS. floci-gcp was never the blocker; chant applying
through Config Connector was.

What to build

  1. A GCP applier/executor (analogue of lexicons/aws/src/components/cloud-executor.ts
    • apply.ts), in the gcp lexicon behind the capability seam:
    • Consume chant's GCP resources and the lifecycle change-set
      (packages/core/src/lifecycle/change-set.ts — create/update/delete/adopt already
      classified) in dependency order (the graph already provides it).
    • Call the GCP REST APIs per resource; poll long-running operations; resolve
      references; capture outputs.
    • Endpoint override (per-service, à la CLOUDSDK_API_ENDPOINT_OVERRIDES_* / SDK
      apiEndpoint) so it targets floci-gcp:4588 or real googleapis.com — the GCP
      analogue of AWS_ENDPOINT_URL.
  2. A GCP deploy Op composing build → apply → wait, mirroring the AWS deploy Ops.

The catch (GCP-specific, be honest about it)

AWS and Azure each have a native deployment orchestrator the applier delegates to
(CloudFormation; ARM az deployment). GCP does not — Deployment Manager is
deprecated/retired. So a GCP applier can't hand a template to one deploy API; it must do
per-resource CRUD across the ~17 service APIs itself, with LRO polling and reference
resolution. In effect: be your own Config Connector, minus Kubernetes. Real work,
bounded to the services floci-gcp emulates + demo-relevant kinds. This is why GCP is
more work than AWS or Azure here.

Retired approaches (do not pursue)

  • Terraform (chant → TF → floci-gcp). Off-thesis: a third-party engine, HCL as an
    intermediate language, and a state file — the exact things chant positions against —
    and it would make GCP the only cloud where chant doesn't emit/apply natively. floci-gcp
    is TF-independent anyway; Terraform was just the easiest off-the-shelf client, never a
    requirement.
  • A Kubernetes substitute controller (an operator on k3d watching CNRM CRDs). Re-
    introduces a running operator + cluster dependency chant avoids; chant's model is
    plan-then-apply on demand, not continuous reconcile. Only revisit if a live
    kubectl-reconcile UX becomes a goal in its own right.
  • Pointing real Config Connector at floci-gcp. Ruled out by Spike 0 (no endpoint
    override; HTTPS/TLS). See the Spike 0 comment.

Reuse / relationships

Acceptance criteria

  • A GCP applier deploys a small stack (e.g. a Storage bucket + one dependent
    resource) to floci-gcp over REST — create/update/delete in dependency order, LROs
    handled.
  • Endpoint override proven: the same applier targets real GCP (with creds) and
    floci-gcp:4588 with only an endpoint/config change.
  • A GCP deploy Op composes build → apply → wait via the local executor.
  • Scoped to floci-gcp's emulated services + demo kinds; unsupported kinds documented.

Out of scope

Activity

  1. added
    enhancement
    on Jul 7, 2026
  2. lex00 commented on Jul 7, 2026

    @lex00
    ContributorAuthor

    Scope + external-value research (2026-07-07)

    Real scoping of the two options, plus a new cheaper spike and the "who benefits outside chant" analysis.

    Foundation is validated upstream (de-risks Option B)

    • floci-gcp already ships and CI-tests IaC apply: compatibility-tests/compat-terraform/ (Terraform, Google provider) and compat-opentofu/, with main.tf/provider.tf, bats tests, a compatibility.yml workflow, just test-terraform. README: "Point your GCP SDK, gcloud CLI, Terraform, or test suite at http://localhost:4588."
    • The Terraform google provider exposes {{service}}_custom_endpoint (e.g. compute_custom_endpoint, storage_custom_endpoint), documented explicitly for "GCP-like APIs such as the Cloud Functions emulator." Best-effort, per-service.
    • ⇒ Terraform → floci-gcp is a maintained path, not a research risk. Option B builds on solid ground.

    CNRM ↔ Terraform mapping is real but partial

    • CNRM resources carry lineage labels: cnrm.cloud.google.com/tf2crd:"true" (generated from the TF google provider), dcl2crd:"true" (DCL), and newer Direct controllers (hand-written Go, no label). Google is migrating kinds TF/DCL → Direct.
    • ⇒ tf2crd kinds are ~1:1 with TF resources (mechanical translation); Direct-only kinds have no TF equivalent. A CNRM→TF path scopes cleanly to tf2crd-labeled kinds and documents the rest as unsupported-locally. The labels make the supported set detectable.

    New cheaper spike (do this first)

    Config Connector has a Terraform-backed controller mode that runs the google provider internally. Sharpened question: can CC's TF controller be given *_custom_endpoint → floci-gcp? If yes, point real CC at the emulator with config and build nothing.

    • Spike 0 — inspect whether CC's TF controller surfaces provider custom-endpoint config. Expected: no (endpoint config isn't exposed; CC is moving off the TF controller to Direct), but it's near-zero cost to rule out and would dominate the decision if it works.

    Revised scope per option

    • Option B (chant → Terraform → floci-gcp): SMALL–MEDIUM, low risk. Foundation CI-tested upstream. New work = a CNRM→Terraform emitter (mechanical for tf2crd kinds) + templating the provider block's *_custom_endpoint at :4588. Bounded to sandbox-relevant, TF-mappable kinds.
    • Option A (chant-authored substitute controller): LARGE, but the only one with real external value. A controller-runtime operator watching CNRM CRDs and reconciling to floci-gcp (delegating per-kind API calls to the TF google provider with custom endpoints). Reuses TF for the actual work but is still a real controller (reconcile loop, status, LRO, resourceRef). Bounded to floci-gcp's ~17 services + demo kinds.

    Upsides OUTSIDE chant (the point of this pass)

    1. A user-facing "local Config Connector" is an unmet gap. Google's only local-CC testing is MockGCP, internal to the k8s-config-connector test suite — not a shipped runtime. There is no way today for users to reconcile arbitrary CNRM manifests locally with no GCP project. Option A, built as a standalone project (CNRM CRDs + a TF-backed reconciler → floci-gcp), fills that gap. Useful to: platform teams testing KCC configs, CI for KCC-based repos, KCC onboarding/learning, GCP-IaC-as-KRM without a project. Genuinely novel; portfolio-grade.
    2. Strengthens floci-gcp. Driving real CNRM/Terraform-shaped traffic surfaces coverage gaps; contributions land in compat-terraform/service handlers upstream.
    3. Reference/content value. A validated "GCP IaC locally" story (gcloud/Terraform/KCC against floci-gcp) is a clean write-up, independent of chant.
    4. chant positioning. Local emulation with no account reinforces "bring your own lifecycle."

    Recommendation

    • To unblock the chant sandbox: Option B, after ruling out Spike 0. Small, low-risk, validated foundation. Scope to tf2crd kinds.
    • Option A only as a deliberate standalone contribution — a "local Config Connector runtime" — not as chant plumbing. That is where the outside-chant value lives, but it's a project in its own right, not a sandbox knob.

    Sources

    • TF google provider custom endpoints — registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference
    • CNRM lineage labels (tf2crd/dcl2crd/Direct) — github.com/GoogleCloudPlatform/k8s-config-connector (ConfigureResourceReferences; release notes)
    • floci-gcp Terraform/OpenTofu compat — github.com/floci-io/floci-gcp (compatibility-tests/compat-terraform, compat-opentofu)
    • MockGCP (internal-only local CC testing) — github.com/GoogleCloudPlatform/k8s-config-connector (mockgcp)
  3. lex00 commented on Jul 7, 2026

    @lex00
    ContributorAuthor

    Spike 0 result — can real Config Connector target floci-gcp? NO (2026-07-07)

    Checked CC's endpoint-override surface directly:

    • custom_endpoint, provider BasePath/host override, GOOGLE_CLOUD_ENDPOINT env → 0 hits in GoogleCloudPlatform/k8s-config-connector. CC exposes no provider custom-endpoint config.
    • The only way to redirect CC's calls is network-level (Private Service Connect / making *.googleapis.com resolve elsewhere). Not a config — and worse here because CC speaks HTTPS to googleapis.com, so targeting http://localhost:4588 also needs TLS interception (inject a trusted CA into the CC pod + an HTTPS front for floci-gcp). Fragile hack, not supported.

    Verdict: the "build nothing" shortcut is dead. Real CC cannot be pointed at the emulator. Option A must be a substitute controller; Option B (direct Terraform) stands. A-vs-B framing confirmed.

  4. changed the title [-]Local GCP deploys against floci-gcp: substitute controller vs direct Terraform[/-] [+]chant has no native GCP apply path: add a GCP applier (direct REST → floci-gcp / real GCP)[/+] on Jul 7, 2026
  5. lex00 commented on Jul 7, 2026

    @lex00
    ContributorAuthor

    Reframed: retired the substitute-controller and direct-Terraform framings. The native shape is a GCP applier — direct REST to floci-gcp/real GCP, endpoint-overridable — the GCP twin of the Azure apply path (#707) and analogue of AWS's cloud-executor.ts. Terraform is off-thesis (third-party engine + state file + only non-native cloud); a k8s controller re-introduces an operator chant avoids; real Config Connector was ruled out by Spike 0. Prior comments kept as the research trail.

  6. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    Scoped a starter — one StorageBucket applied to floci-gcp end-to-end, establishing the kind→mapper→REST dispatch seam: #711. Demonstrable locally now (floci-gcp is a plain GCS REST server). Later resources are additive mappers on the same seam.

  7. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Starter shipped — #711 (#712 merged). The kind → mapper → REST dispatch seam is established and verified end-to-end against floci-gcp (404 → created → 200 → idempotent re-apply).

    Landed: pure bucketInsertBody mapper + endpoint/project resolvers + idempotent applyBucket (injectable http, unit-tested) + gcpApply activity (endpoint-overridable) + demo op.

    Next slices, additive on the same seam:

    • More kind mappers (add a (cnrm) → REST entry per CNRM kind) — start with the common ones floci-gcp emulates.
    • LRO polling — needed for the first async resource (bucket insert is synchronous; e.g. GKE/CloudSQL create return operations to poll).
    • Reference/dependency resolution (resourceRef) + ordered apply.
    • Delete/prune (owned-only), mirroring the other appliers.
    • Real-GCP auth (ADC) — the endpoint override already handles real vs emulator.
  8. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Slice 2 shipped — #713 (merged). Generalized the starter's one hard-coded path into a ResourceMapper registry (kind → REST plan) and added the second kind, PubSubTopic. Verified end-to-end against floci-gcp: bucket + topic both created (labels/retention mapped), both GET 200, idempotent re-apply.

    Adding a resource type is now one MAPPERS entry. Remaining: LRO polling (first async resource — GKE/CloudSQL), references/ordering, delete/prune, real-GCP auth.

  9. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Cloud appliers relocated — #714 (merged). Op activities are no longer centralized in the temporal lexicon: floci→aws, gcpApply→gcp, azGroupEnsure/Delete→azure, each behind a ./op/activities export and loaded on demand by the config-driven loadActivities(lexicons). k3d stays in temporal (agnostic); shared safeHeartbeat/sleep moved to core so cloud lexicons don't depend on temporal. Verified end-to-end through the loader against floci-gcp. Next applier slices (LRO, references) now land in the gcp lexicon where they belong.

  10. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Slice 3 shipped — #715 (merged). First async resource: LRO polling. ResourceMapper gained an optional operation (OperationSpec); longRunningOperation(version) is a reusable poller for the standard google.longrunning pattern; applyResource polls async creates to done via waitForOperation. Added Cloud Run (RunService). Verified live against floci-gcp (async create → operation polled → error path surfaced correctly).

    Applier now covers: sync CRUD (StorageBucket, PubSubTopic) + async/LRO (RunService). Adding a kind is one MAPPERS entry (+operation if async). Remaining: more kind mappers (GKE, Cloud SQL — reuse longRunningOperation), references/ordering, delete/prune.

  11. 3 remaining items

  12. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Slice 6 shipped — #718 (merged). References + dependency ordering: referencedNames extracts CNRM *Ref names, orderByReferences topologically sorts (apply in dep order, delete in reverse, cycle-detecting). Added PubSubSubscription (resolves topicRef → topic path). Verified live against floci-gcp: a manifest listing the subscription before its topic is reordered (topic → subscription) and the ref resolves.

    Applier now: full CRUD (create/update/delete, sync + async LRO) + dependency ordering + reference resolution, on one kind→mapper→REST seam. Remaining: more kind mappers (GKE/Cloud SQL), Pub/Sub update (updateMask), owned-only prune vs live state.

  13. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Slice 7 shipped — #719 (merged). Owned-only prune: mappers stamp managed-by: chant; gcpApply({prune:true}) lists chant-owned live resources per kind and deletes those dropped from the manifest, never touching foreign resources. Verified live against floci-gcp: apply [a,b] → apply [a] --prune deletes b (404), keeps a, leaves a foreign bucket (200).

    Applier is now a complete declarative reconciler: create/update/delete (sync + async LRO), dependency ordering + reference resolution, and owned-only prune — all on one kind→mapper→REST seam, endpoint-overridable to real GCP or floci-gcp. (Note: gcp lexicon has its own tsc build gate that just build doesn't run — build the lexicon locally for gcp changes.)

  14. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Slice 8 shipped — #720 (merged). Pub/Sub topic update (updateMask): PubSubTopic reconciles in place via the {topic, updateMask} envelope, so update is now uniform across StorageBucket, RunService, and PubSubTopic. Verified live against floci-gcp (retention 86400s→3600s).

    Applier capability matrix is complete: create/update/delete (sync + async LRO), dependency ordering + reference resolution, owned-only prune — across StorageBucket, PubSubTopic, PubSubSubscription, RunService. Remaining is pure resource breadth (more MAPPERS entries: GKE/Cloud SQL/Secret Manager/etc., each reusing the seam).

  15. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Slice 9 shipped — #721 (merged). Resource breadth: added SecretManagerSecret (stamped, list+prune, label update) and IAMServiceAccount (create/idempotent by derived email; no labels → no prune). Verified live on floci-gcp.

    Applier coverage: StorageBucket, PubSubTopic, PubSubSubscription, SecretManagerSecret, IAMServiceAccount (sync) + RunService (async/LRO) — full CRUD, dependency ordering, reference resolution, owned-only prune. Each additional kind is one MAPPERS entry. Heavy async kinds (GKE ContainerCluster, Cloud SQL) remain but are Docker-backed on floci-gcp so E2E is heavier.

  16. lex00 commented on Jul 8, 2026

    @lex00
    ContributorAuthor

    ✅ Consistent cross-cloud example shipped — #723 (merged). examples/local-cloud-trio: the same object store deployed to AWS, Azure, and GCP, each on a local emulator, one op per cloud (nativeApply/Floci, azApply/floci-az, gcpApply/floci-gcp). Verified: all 3 stacks synthesize; the built gcp/azure stacks apply end-to-end (bucket + storage account GET 200).

    This is the payoff of the #706 applier work — chant deploying the same infra to all 3 clouds locally, no accounts. All three clouds now have a native local applier: AWS (Floci/CloudFormation), GCP (floci-gcp/gcpApply, full CRUD+ordering+refs+prune), Azure (floci-az/azApply, direct ARM CRUD).

  17. lex00 commented on Aug 2, 2026

    @lex00
    ContributorAuthor

    Shipped in 0.15.0 and verified today against a current floci/floci-gcp:latest. Closing.

    $ chant run gcp
    emulator ready on http://localhost:4588
    created: StorageBucket/trio-bucket (http://localhost:4588)
    httpCheck OK: http://localhost:4588/storage/v1/b/trio-bucket (200)
      ✓ flociGcpUp / chantBuild / gcpApply / httpCheck / flociGcpDown
    

    Cluster-free direct REST as this issue asked for: gcp-apply.ts maps each resource to its own GCP REST call (POST /storage/v1/b?project=… to create, PATCH to update), with no Config Connector and no kubectl anywhere in the apply path.

    Worth noting for #1209, since it is the same lexicon: the read path has not made this move. Both describe-resources.ts and deep-observe.ts still go through Config Connector over kubectl, so GCP currently applies cluster-free and observes through a cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions