- Install go
- Get the latest patch version for go v1.11.
- Install jq
brew install jq
on MacOS.
- Install gettext package
brew install gettext && brew link --force gettext
on MacOS.
- Install KIND
go get sigs.k8s.io/kind
.
- Install bazel
- Configure Python 2.7+ with pyenv if your default is Python 3.x.
go get -d sigs.k8s.io/cluster-api-provider-azure
Ensure you have updated the vendor directory with:
cd "$(go env GOPATH)/src/sigs.k8s.io/cluster-api-provider-azure"
make dep-ensure
This provider is modeled after the upstream Cluster API project. To get familiar with Cluster API resources, concepts and conventions, refer to the Cluster API gitbook.
Part of running cluster-api-provider-azure is generating manifests to run. Generating dev manifests allows you to test dev images instead of the default releases.
Any public container registry can be leveraged for storing cluster-api-provider-azure container images.
Change some code!
Your environment must have the Azure credentials as outlined in the getting started prerequisites section
-
Login to your container registry using
docker login
.e.g.,
docker login quay.io
-
To build images with custom tags and push to your custom image registry, run the
make docker-build
as follows:REGISTRY="<container-registry>" MANAGER_IMAGE_TAG="<image-tag>" make docker-build
-
Push your docker images:
REGISTRY="<container-registry>" MANAGER_IMAGE_TAG="<image-tag>" make docker-push
NOTE: It's expected that some set of Azure credentials are available at the time, either as environment variable, or some other SDK-supported method.
Whenever you are working on a branch, you will need to generate manifests using:
make clean # Clean up any previous manifests
REGISTRY="<container-registry>" MANAGER_IMAGE_TAG="<image-tag>" RESOURCE_GROUP="<resource-group>" CLUSTER_NAME="<cluster-name>" make manifests
You will then have a sample cluster and machine manifest in:
/cmd/clusterctl/examples/azure/out
and a provider components file to use with clusterctl in
cmd/clusterctl/examples/azure/out/provider-components.yaml
Generate custom binaries:
make binaries
Ensure kind has been reset:
make kind-reset
make create-cluster
will launch a bootstrap cluster and then run the generated
manifests creating a target cluster in Azure.
If you're interested in creating the cluster with verbose logging, you can instead run:
time clusterctl create cluster -v 10 \
--provider azure \
--bootstrap-type kind \
-m ./cmd/clusterctl/examples/azure/out/machines.yaml \
-c ./cmd/clusterctl/examples/azure/out/cluster.yaml \
-p ./cmd/clusterctl/examples/azure/out/provider-components.yaml \
-a ./cmd/clusterctl/examples/azure/out/addons.yaml
While clusterctl is running, you can optionally follow the controller logs in a separate window as follows:
export KUBECONFIG="$(kind get kubeconfig-path --name="clusterapi")" # Export the kind kubeconfig
time kubectl get po -o wide --all-namespaces -w # Watch pod creation until azure-provider-controller-manager-0 is available
kubectl logs azure-provider-controller-manager-0 -n azure-provider-system -f # Follow the controller logs
After this is finished you will have
a kubeconfig copied locally. You can debug most issues by SSHing into the
instances that have been created and reading /var/lib/waagent/custom-script/download/0/stdout
.
Pull requests and issues are highly encouraged! If you're interested in submitting PRs to the project, please be sure to run some initial checks prior to submission:
make lint # Runs a suite of quick scripts to check code structure
make test # Runs tests on the Go code
make test
executes the project's unit tests. These tests do not stand up a
Kubernetes cluster, nor do they have external dependencies.
Mocks are set up using Bazel, see build
If you then want to use these mocks with go test ./...
, run
make copy-genmocks