feat(cloudflare): native provider for DNS records and Tunnels#120
Merged
Conversation
Adds plugins/cloudflare, a native pluginproto (v2) external provider that manages cloudflare.openctl.io/v1 DNSRecord and Tunnel via the Cloudflare REST API v4. Stdlib-only (hand-rolled client, no cloudflare-go SDK) and in the root module, so all existing CI jobs cover it with no new wiring. Stateful via CapabilityState: Cloudflare-assigned record/tunnel IDs round-trip through openctl's provider_state store, so the controller owns create -> update -> delete by ID. Out-of-band deletes self-heal (apply recreates a record/tunnel whose stored ID is gone). - DNSRecord: full CRUD (A/AAAA/CNAME/TXT/MX/...), zone from spec or the provider's defaults.zoneId. - Tunnel: create + ingress config (auto catch-all rule), named after metadata.name. The run token is a `get-token` ACTION returning a downloadable payload — never written to status/the git-synced mirror (mirrors the k3s kubeconfig-as-action precedent). - CUE schemas shipped in the handshake and validated through openctl's real external-schema path in tests. - Config: API token via a credential's tokenSecretFile -> Configure bag; account/zone defaults via provider defaults. Chose a native plugin over wrapping the Terraform Cloudflare provider through tfhost: tfhost is architecturally proven but still needs msgpack state decode, nested-block/typed config encoding, protocol-v5, and a real-binary e2e before it can host a real framework provider. The native plugin ships working Cloudflare today. Tests: fake-CF-API unit lifecycle for both kinds (create/state/update/ list/delete/NotFound + get-token + no-token-leak), schema validation, and a subprocess handshake e2e through the external adapter. Makefile build-plugin-cloudflare + install wiring; plugin README with setup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
plugins/cloudflare— a native openctl provider (pluginproto v2) for deploying Cloudflare infrastructure declaratively:cloudflare.openctl.io/v1DNSRecordcloudflare.openctl.io/v1TunnelDesign decisions
tfhostis architecturally proven but not ready for a real framework provider — it'd need msgpack state decoding, nested-block/typed config encoding, protocol-v5, and a real-binary e2e (it's only ever run against a JSON fake). The native plugin ships working Cloudflare today and validates the "wide, infra-only" thesis. tfhost remains the long-game breadth multiplier.cloudflare-goSDK), so every existing CI job covers it with zero new module wiring.CapabilityState. Cloudflare-assigned record/tunnel IDs round-trip through theprovider_statestore; the controller owns create→update→delete by ID. Out-of-band deletes self-heal (apply recreates a resource whose stored ID is gone).get-tokenaction, not status. It's a secret, so it's returned as a downloadable payload and never written to the git-synced state mirror — mirroring the k3s kubeconfig-as-action precedent.Auth / config
API token via a credential's
tokenSecretFile→ theConfigurebag; account/zone defaults via providerdefaults. Full setup inplugins/cloudflare/README.md.Tests
NotFound, idempotent delete,get-token, and an assertion that the token never leaks into status.Actionerover the wire.Local CI
gofmt / go vet / staticcheck / golangci-lint / modernize (generated-filtered) /
go test ./.../go test -race(plugin + external) all green.Follow-ups
Validate against a real Cloudflare account; round-trip tunnel ingress into observed state for precise drift; consider
Zone(observed) and WAF/ruleset kinds.