Developer Guide
Prerequisites
Docker
Iterating on the Cluster API Operator involves repeatedly building Docker containers.
A Cluster
You'll likely want an existing cluster as your management cluster. The easiest way to do this is with kind v0.9 or newer, as explained in the quick start.
Make sure your cluster is set as the default for kubectl
.
If it's not, you will need to modify subsequent kubectl
commands below.
kubectl
kubectl for interacting with the management cluster.
Helm
Helm for installing operator on the cluster (optional).
A container registry
If you're using kind, you'll need a way to push your images to a registry so they can be pulled. You can instead side-load all images, but the registry workflow is lower-friction.
Most users test with GCR, but you could also use something like Docker Hub.
If you choose not to use GCR, you'll need to set the REGISTRY
environment variable.
Kustomize
You'll need to install kustomize
.
There is a version of kustomize
built into kubectl, but it does not have all the features of kustomize
v3 and will not work.
Kubebuilder
You'll need to install kubebuilder
.
Cert-Manager
You'll need to deploy cert-manager components on your management cluster, using kubectl
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.2/cert-manager.yaml
Ensure the cert-manager webhook service is ready before creating the Cluster API Operator components.
This can be done by following instructions for manual verification from the cert-manager website. Note: make sure to follow instructions for the release of cert-manager you are installing.
Development
Option 1: Tilt
Tilt is a tool for quickly building, pushing, and reloading Docker containers as part of a Kubernetes deployment.
Once you have a running Kubernetes cluster, you can run:
tilt up
That's it! Tilt will automatically reload the deployment to your local cluster every time you make a code change.
Option 2: The kustomize way
# Build all the images
make docker-build
# Push images
make docker-push
# Apply the manifests
kustomize build config/default | ./hack/tools/bin/envsubst | kubectl apply -f -