docs/book/src/reference/artifacts.md
To test your controllers, you will need to use the tarballs containing the required binaries:
./bin/k8s/
└── 1.25.0-darwin-amd64
├── etcd
├── kube-apiserver
└── kubectl
These tarballs are released by controller-tools, and you can find the list of available versions at: envtest-releases.yaml.
When you run make envtest or make test, the necessary tarballs are downloaded and properly
configured for your project.
To learn more about the tooling used to configure ENVTEST, which is utilized in the setup-envtest
target in the Makefile of projects built with Kubebuilder, see the README
of its tooling. Additionally, you can find more information by reviewing the Kubebuilder ENVTEST documentation.
Artifacts provided under https://storage.googleapis.com/kubebuilder-tools are deprecated and Kubebuilder maintainers are no longer able to support, build, or ensure the promotion of these artifacts.
You will find the ENVTEST binaries available in the new location from k8s release 1.28, see: https://github.com/kubernetes-sigs/controller-tools/blob/main/envtest-releases.yaml.
Also, binaries to test your controllers after k8s 1.29.3 will no longer be found in the old location.
New binaries are only promoted in the new location.
You should ensure that your projects are using the new location.
Please ensure you use setup-envtest from the controller-runtime release v0.19.0 to be able to download those.
This update is fully transparent for Kubebuilder users.
The artefacts for ENVTEST k8s 1.31 are exclusively available at: Controller Tools Releases.
You can refer to the Makefile of the Kubebuilder scaffold and observe that the envtest setup is consistently aligned across all controller-runtime releases. Starting from release-0.19, it is configured to automatically download the artefact from the correct location, ensuring that kubebuilder users are not impacted.
## Tool Binaries
..
ENVTEST ?= $(LOCALBIN)/setup-envtest
...
## Tool Versions
...
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
...
.PHONY: setup-envtest
setup-envtest: envtest ## Download the binaries required for ENVTEST in the local bin directory.
@echo "Setting up envtest binaries for Kubernetes version $(ENVTEST_K8S_VERSION)..."
@$(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path || { \
echo "Error: Failed to set up envtest binaries for version $(ENVTEST_K8S_VERSION)."; \
exit 1; \
}
.PHONY: envtest
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
$(ENVTEST): $(LOCALBIN)
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))