api/CRD types (e.g.,v1alpha1), generated code via controller-tools.controllers/reconcilers and test suite (suite_test.go). Files follow<resource>_controller.go.pkg/shared libraries and utilities.config/Kustomize manifests, CRDs inconfig/crd/bases.charts/Helm chart; sync CRDs withmake copy-crds.tests/integration/E2E (Ginkgo/Gomega) against a cluster.scripts/lint/format helpers;bin/tool cache.
make helplist targets.make buildcompile manager tobin/manager.make runrun controller locally.make testrun unit/integration tests with envtest; writescover.out.make manifestsandmake generateregenerate CRDs and deepcopy code.make install/make uninstallapply/remove CRDs from current kubeconfig.make deploy IMG=...deploy to cluster;make undeployremove.make docker-build IMG=...andmake docker-pushbuild/push images.make copy-crdssync CRDs into the Helm chart.
- Go 1.24+. Format with
make fmt; imports viagoimports. - Lint with
./scripts/lint.sh ./...(golangci-lint). Fix license headers withmake license-fix. - Use canonical aliases:
corev1,metav1,apierrors,ctrl(see.golangci.yml importas). - Package and file names are lowercase; tests end with
_test.go.
- Frameworks: Ginkgo v2 + Gomega; controller-runtime envtest.
- Run all tests with
make test. Integration tests live undertests/operator/and expect a reachable Pulsar cluster; setNAMESPACE,BROKER_NAME,PROXY_URLas needed. - Keep tests deterministic and fast; prefer envtest for controller logic.
- Conventional Commits for titles/messages (e.g.,
feat(controller): add topic policy,fix(api): correct validation). - Install hooks with
make husky; pre-commit runs license, lint, gofmt, and govet. - PRs should: describe motivation, link issues, include test updates, and update
docs/orcharts/when user-visible.
- Never commit secrets. Pass tokens via env (e.g.,
ACCESS_TOKENfor image builds). - After API changes, run
make manifests generateand thenmake copy-crds.
- Keep changes scoped; do not modify generated files manually. Regenerate with the Make targets above.