This project provides a complete scaffolding for a Kubernetes controller with local development tooling. The reconciliation logic is intentionally left empty as a starting point for implementation.
Before you begin, ensure you have the following tools installed:
- Go 1.21+: Download and install Go
- kubectl: Install kubectl
- Docker: Install Docker
First, install the development tools:
make install-toolsThis will install:
controller-gen: For generating CRDs and DeepCopy methodsgolangci-lint: For linting Go codekind: For creating local Kubernetes clusters
Create a KinD cluster for local development:
make cluster.upThis creates a KinD cluster named interview-reconciler.
Run the controller locally (this also installs CRDs):
make runThe controller will connect to your KinD cluster using your kubeconfig.
- Start the environment with
make cluster.up - Run the controller with
make run - Edit code, then stop the controller (Ctrl+C) and re-run
make run - Test your changes with kubectl commands
cmd/controller/ # Controller main entrypoint
internal/controller/ # Reconciler implementation
kind.yaml # KinD cluster configuration
Makefile # Build targets
make install-tools- Install required development tools
make generate- Generate code and CRDsmake lint- Run golangci-lint lintermake build- Build the controller binary locally
make cluster.up- Create KinD clustermake cluster.down- Delete KinD clustermake install- Install CRDs into clustermake run- Run controller locally (also installs CRDs)
Delete the KinD cluster:
make cluster.down