The prerequisites include:
In addition, you also need to install the prerequisites for Cluster API as well in order to run it alongside this controller.
Tilt is a tool that allows hot reloading for Kubernetes controllers. Cluster API includes its own Tiltfile that can be used to run CAAPH on a local Kind cluster. It's strongly recommended to use Tilt for development work.
Clone the Cluster API and CAAPH repositories into your Go src folder:
$ git clone [email protected]:kubernetes-sigs/cluster-api.git ${GOPATH}/src/cluster-api
$ git clone [email protected]:Jont828/cluster-api-addon-provider-helm.git ${GOPATH}/src/cluster-api-addon-provider-helm
Afterwards your folder structure should look like this:
src/
├── cluster-api
└── cluster-api-addon-provider-helm
Refer to this guide to set up Tilt for Cluster API.
In particular, for our purposes we only need to set up tilt-settings.yaml
in Cluster API to enable CAAPH as a provider. Add the following fields to the lists in tilt-settings.yaml
:
provider_repos:
- "../cluster-api-addon-provider-helm"
enable_providers:
- helm
Calico is automatically installed when workload clusters are started.
From src/cluster-api-addon-provider-helm
run:
$ ./hack/setup-calico-autoinstallation.sh
See Automatically install calico in workload clusters with Tilt for more details.
From src/cluster-api
run:
$ make tilt-up
From within Tilt, you should be able to see the CAAPH controller running alongside the Cluster API controllers with the CRDs installed.
Automatically install calico in workload clusters using the yaml manifest provided by CAAPH.
The setup script(setup-calico-autoinstallation.sh
) generates a tiltfile to incorporate the above yaml manifest as a Tilt resource.
Setup script (setup-calico-autoinstallation.sh
) Summary:
- Generate the tiltfile to incorporate the above yaml manifest as a Tilt resource.
- Refer to Tiltfile API Reference for functions used in the tiltfile.
- The tiltfile is output to the
src/cluster-api/tilt.d
directory.- Run
make tilt-up
,files under thesrc/cluster-api/tilt.d
are automatically started. (excluding subdirectories)
- Run
The yaml manifest (src/cluster-api-addon-provider-helm/config/samples/calico-cni.yaml
) is changed, it is redeployed by Tilt.
For the target workload clusters
The yaml manifest (src/cluster-api-addon-provider-helm/config/samples/calico-cni.yaml
) is for all workload clusters.
An example targeting workload clusters with a specific label.
spec:
clusterSelector:
matchLabels:
cni: calico