Files
dns/operator/config/samples/pagesproject_hanzo_bot.yaml
zeekay 04e5aac8c4 feat(operator): Cloudflare connector + Pages CR
Implement the stubbed CloudflareReconciler with real CF DNS sync (create/
adopt/update/delete via a finalizer) so DnsRecords with syncToCloudflare=true
land at the edge, and add a PagesProject CR + reconciler that deploys a CF
Pages site, attaches its custom domain, and wires DNS by composing the DNS
layer (emits an owned CNAME DnsRecord rather than a second CF-DNS code path).

- internal/cloudflare: minimal CF API v4 client (DNS CRUD + Pages), one do()
  HTTP path, scoped Bearer auth, idempotent delete/add. httptest-covered.
- CloudflareReconciler: real upsert + finalizer cleanup; nil client => no-op.
- PagesProject{,Spec,Status} CR + reconciler (Owns child DnsRecord for GC).
- main.go: one shared cloudflare.Client injected into both reconcilers.
- CRDs, RBAC, DeepCopy regenerated; deployable manager manifest (CF_API_TOKEN
  from KMS-synced secret, optional); hanzo.bot sample.

Tests: go test ./... green (CF client + both reconcilers, fake client + mock CF).
2026-06-16 12:11:20 -07:00

37 lines
1011 B
YAML

# Deploy hanzo.bot as a Cloudflare Pages site with its domain wired end-to-end.
# The operator (1) ensures the CF Pages project, (2) attaches the custom domain,
# (3) emits a CNAME DnsRecord (hanzo.bot -> <project>.pages.dev) which the
# Cloudflare DNS reconciler syncs to the edge. One declarative object per site.
apiVersion: dns.hanzo.ai/v1alpha1
kind: DnsZone
metadata:
name: hanzo-bot
namespace: dns-system
spec:
zone: hanzo.bot
cloudflareZoneId: "REPLACE_WITH_HANZO_BOT_ZONE_ID"
---
apiVersion: dns.hanzo.ai/v1alpha1
kind: PagesProject
metadata:
name: hanzo-bot
namespace: dns-system
spec:
accountId: "REPLACE_WITH_CF_ACCOUNT_ID"
customDomain: hanzo.bot
zoneRef: hanzo-bot
---
# Manage any DNS record declaratively (synced to Cloudflare when syncToCloudflare=true).
apiVersion: dns.hanzo.ai/v1alpha1
kind: DnsRecord
metadata:
name: api-hanzo-bot
namespace: dns-system
spec:
zoneRef: hanzo-bot
name: api
type: A
content: 129.212.164.5
proxied: true
syncToCloudflare: true