This file provides guidance to coding agents (e.g. Claude Code, claude.ai/code) when working with code in this repository.
Go module kubeops.dev/external-dns-operator — a Kubernetes operator that wraps external-dns behind a CRD (ExternalDNS) so cluster admins can declare a DNS sync as a Kubernetes object instead of a long flag list on a Deployment. The controller resolves the spec into the corresponding external-dns args, gathers the right cloud credentials from referenced Secrets, and computes a plan against the target DNS provider.
The produced binary is external-dns-operator. The README is a Kubebuilder scaffold stub; treat this file as the source of truth.
cmd/external-dns-operator/— entry point.pkg/cmds/— Cobra commands (root, run).apis/external/v1alpha1/— Kubebuilder API types. Single CRD:ExternalDNS(external-dns.appscode.com/v1alpha1).register.go,install/,fuzzer/,*_types.go, generatedzz_generated.deepcopy.go.
client/— generated typed clientset.crds/— generated CRD YAMLs.pkg/controllers/external-dns/— theExternalDNSreconciler.pkg/credentials/— per-cloud credential resolution from referenced Secrets:aws.go,azure.go,cloudflare.go,google.go— one file per provider.secret.go— generic Secret-to-config helpers.
pkg/plan/plan.go— wraps external-dns's planner so the operator can preview changes.pkg/informers/— shared informer setup.pkg/external/— embeds/integrates with the upstream external-dns library.examples/— sampleExternalDNSmanifests per provider.PROJECT— Kubebuilder metadata. Domainappscode.com, multigroup.Dockerfile.in(PROD, distroless),Dockerfile.dbg(debian),Dockerfile.ubi(Red Hat certified) — three image variants.hack/,Makefile— AppsCode build harness.vendor/— checked-in deps.
CRD API group is external-dns.appscode.com/v1alpha1.
All Make targets run inside ghcr.io/appscode/golang-dev — Docker must be running.
make ci— CI pipeline.make build/make all-build— build host or all-platform binaries.make gen— regenerate clientset + manifests. Run after any change toapis/external/v1alpha1/*_types.go.make manifests— regenerate CRDs only.make clientset— regenerateclient/only.make fmt,make lint,make unit-tests/make test— standard.make verify—verify-gen verify-modules;go mod tidy && go mod vendormust leave the tree clean.make container— build PROD, DBG, and UBI images.make push— push all three;make docker-manifestwrites multi-arch manifests;make releaseis the full publish flow.make push-to-kind/make deploy-to-kind— load into Kind and Helm-install.make install/make uninstall/make purge— Helm install lifecycle.make add-license/make check-license— manage license headers.
Run a single Go test (requires a local Go toolchain):
go test ./pkg/controllers/external-dns/... -run TestName -v
- Module path is
kubeops.dev/external-dns-operator(vanity URL). Imports must use that. - License:
LICENSE(Apache-2.0); new files need the standard AppsCode header (make add-license). - Sign off commits (
git commit -s); contributions follow the DCO (DCO). - Vendor directory is checked in —
go mod tidy && go mod vendormust leave the tree clean (enforced byverify-modules). - Adding a new DNS provider: implement credential resolution under
pkg/credentials/<provider>.goand wire it from the reconciler. Don't sprinkle provider-specific code acrosspkg/controllers/external-dns/. - Do not hand-edit
zz_generated.*.go, anything underclient/, orcrds/— changeapis/external/v1alpha1/*_types.goand re-runmake gen. - The operator owns the relationship to upstream
external-dns. Pin its dep deliberately; field reshuffles upstream propagate intopkg/plan/andpkg/external/. - Three Dockerfiles, one binary — keep
Dockerfile.in,Dockerfile.dbg, andDockerfile.ubiin sync. - This is a Kubebuilder multigroup project — use
kubebuilderto scaffold new APIs.