KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v $$(go list ./... | grep -v /e2e) -coverprofile cover.out
.PHONY:test-e2e
test-e2e:manifestsfmtvet## Run the e2e tests. Expected an isolated environment using Kind.
@command -v kind >/dev/null 2>&1||{\
echo"Kind is not installed. Please install Kind manually.";\
exit 1;\
}
@kind get clusters | grep -q 'kind'||{\
echo"No Kind cluster is running. Please start a Kind cluster before running the e2e tests.";\
exit 1;\
}
go test ./test/e2e/ -v -ginkgo.v
.PHONY:lint
lint:golangci-lint## Run golangci-lint linter
$(GOLANGCI_LINT) run
.PHONY:lint-fix
lint-fix:golangci-lint## Run golangci-lint linter and perform fixes
install:manifests## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUBECTL) apply -f helm/netbird-operator/crds
.PHONY:uninstall
uninstall:manifests## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUBECTL) delete -f helm/netbird-operator/crds
.PHONY:deploy
deploy:manifests## Deploy controller to the K8s cluster specified in ~/.kube/config.
undeploy:## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(HELM) uninstall -n netbird netbird-operator
##@ Dependencies
## Location to install dependencies to
LOCALBIN?=$(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
## Tool Binaries
KUBECTL?= kubectl
CONTROLLER_GEN?=$(LOCALBIN)/controller-gen
ENVTEST?=$(LOCALBIN)/setup-envtest
GOLANGCI_LINT=$(LOCALBIN)/golangci-lint
HELM?= helm
## Tool Versions
CONTROLLER_TOOLS_VERSION?= v0.17.1
#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}')
GOLANGCI_LINT_VERSION?= v1.63.4
.PHONY:controller-gen
controller-gen:$(CONTROLLER_GEN)## Download controller-gen locally if necessary.