Development
The operator is a standard Kubebuilder project. Standard workflow — make generate, make manifests, make test, make docker-build, make deploy.
Everything below runs from k8s-operator/.
Prerequisites
Section titled “Prerequisites”- Go 1.27+.
docker(orpodman) for image builds.kubectlpointed at a target cluster formake install/make deploy.make— the entire workflow is Makefile-driven.
make generate # regenerate deepcopy codemake manifests # regenerate CRDs, ClusterRoles, WebhookConfigurationmake build # build the manager binaryGenerated CRDs land in config/crd/bases/; RBAC in config/rbac/; webhook config in config/webhook/.
make build, make run, and make test all run manifests, generate, fmt, and vet first, so generated code and manifests stay in sync automatically.
make install, make uninstall, and make deploy deliberately do not. They apply the manifests exactly as committed, so a deploy ships what is in git rather than whatever the local tree happens to regenerate, and it leaves no modified files behind. Run make manifests yourself after changing the API types — CI fails if the committed output is stale.
make test # unit + envtest against a locally-fetched envtest binaryThe envtest binaries are downloaded to bin/ on first run (make setup-envtest).
Run locally (against a real cluster)
Section titled “Run locally (against a real cluster)”make install # install CRDs into the cluster in ~/.kube/configmake run # run the manager binary out-of-cluster, against the target clusterKill the process with Ctrl-C. make uninstall removes the CRDs.
Deploy the manager into a cluster
Section titled “Deploy the manager into a cluster”make docker-build IMG=<your-registry>/kube-agents-operator:devmake docker-push IMG=<your-registry>/kube-agents-operator:devmake deploy IMG=<your-registry>/kube-agents-operator:devmake undeploy removes it.
Fast agent iteration (dev only)
Section titled “Fast agent iteration (dev only)”For local Platform Agent development you don’t want to run the full installer every time. make dev-rebuild-agent shells out to scripts/dev/dev_rebuild_agent.sh:
make dev-rebuild-agent ARGS="platform"This builds the Platform Agent image, pushes to Artifact Registry, and restarts the Deployment. First run creates a dev Artifact Registry repo; clean it up later with scripts/dev/teardown_dev_01_gcp_artifact_registry.sh.
Building on a private worker pool
Section titled “Building on a private worker pool”Cloud Build runs on the project’s default pool (2 vCPU) unless you point it elsewhere. To use a private pool with more CPU, export its full resource name:
export CLOUD_BUILD_WORKER_POOL=projects/PROJECT/locations/REGION/workerPools/POOLdev_rebuild_agent.sh and hack/ci-deploy.sh both read this variable and pass --worker-pool (along with the pool’s region parsed from the name) to gcloud builds submit. Leave it unset to use the default pool. Note that the worker pool must allow public egress, or image builds will fail when pulling base images and downloading dependencies.
The two scripts handle the unset case differently. dev_rebuild_agent.sh takes the default pool’s default machine (2 vCPUs), while hack/ci-deploy.sh requests e2-highcpu-8 because it compiles all three container images in a single Cloud Build submission (deploy/docker/cloudbuild-ci.yaml) with the operator build running in parallel alongside the agent builds. Because private worker pools define their own fixed machine types and reject --machine-type, hack/ci-deploy.sh only passes --machine-type when CLOUD_BUILD_WORKER_POOL is unset.
Integrations (Kustomize)
Section titled “Integrations (Kustomize)”Integrations have dedicated deploy/undeploy targets:
make deploy-litellm # LiteLLM Gatewaymake deploy-inference-replay # inference-replay proxymake deploy-github # Minty (GitHub token minter)Each has a matching undeploy-* target. These are the development copies of the components the Helm chart renders in a stock install.
RBAC Migration & Deprecation Guidelines
Section titled “RBAC Migration & Deprecation Guidelines”When modifying or deprecating RBAC roles/rolebindings in the operator:
- Update active role construction: Update the builder functions (
buildPlatformLocalRole,buildMinimalPlatformRole, etc.) to generate the updated role definitions. - Dynamic legacy role cleanup: Never leave old roles/rolebindings orphaned on existing clusters.
reconcileRBAC()dynamically audits allRoleBindingobjects in the namespace attached to the agent’s ServiceAccount and deletes any non-canonicalkubeagents*bindings. - Sync controller RBAC annotations: Ensure
// +kubebuilder:rbacannotations on the reconciler include all permissions that the operator itself needs to grant or clean up, and runmake manifeststo regenerateconfig/rbac/role.yaml.
Formatting
Section titled “Formatting”make prettier-check # verify Markdown/YAML formatting (**/*.{md,yaml,yml})make prettier-write # apply formattingPrettier is enforced in CI (.github/workflows/prettier.yml).
Relevant workflows:
k8s-operator-test.yml— runsmake test.docker-publish-k8s-operator.yml— publishes the manager image.e2e-gchat-test.yml— end-to-end Google Chat test.