22
33VERSION ?= 2.0.0
44
5-
65IMAGE_TAG ?= dev
76
87IMG ?= apache/apisix-ingress-controller:$(IMAGE_TAG )
98# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
109ENVTEST_K8S_VERSION = 1.30.0
11-
1210KIND_NAME ?= apisix-ingress-cluster
11+
1312GATEAY_API_VERSION ?= v1.2.0
13+ ADC_VERSION ?= 0.19.0
1414
15- TEST_TIMEOUT ?= 45m
15+ TEST_TIMEOUT ?= 60m
16+ TEST_DIR ?= ./test/e2e/apisix/
1617
1718# CRD Reference Documentation
1819CRD_REF_DOCS_VERSION ?= v0.1.0
@@ -104,6 +105,21 @@ test: manifests generate fmt vet envtest ## Run tests.
104105.PHONY : kind-e2e-test
105106kind-e2e-test : kind-up build-image kind-load-images e2e-test
106107
108+ # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
109+ .PHONY : e2e-test
110+ e2e-test :
111+ @kind get kubeconfig --name $(KIND_NAME ) > $$ KUBECONFIG
112+ go test $(TEST_DIR ) -test.timeout=$(TEST_TIMEOUT ) -v -ginkgo.v -ginkgo.focus=" $( TEST_FOCUS) "
113+
114+ .PHONY : conformance-test
115+ conformance-test :
116+ go test -v ./test/conformance -tags=conformance -timeout 60m
117+
118+ .PHONY : conformance-test-standalone
119+ conformance-test-standalone :
120+ @kind get kubeconfig --name $(KIND_NAME ) > $$ KUBECONFIG
121+ go test -v ./test/conformance/apisix -tags=conformance -timeout 60m
122+
107123.PHONY : lint
108124lint : sort-import golangci-lint # # Run golangci-lint linter
109125 $(GOLANGCI_LINT ) run
@@ -164,11 +180,11 @@ build-multi-arch:
164180.PHONY : build-multi-arch-image
165181build-multi-arch-image : build-multi-arch
166182 # daemon.json: "features":{"containerd-snapshotter": true}
167- @docker buildx build --load --platform linux/amd64,linux/arm64 -t $(IMG) .
183+ @docker buildx build --load --platform linux/amd64,linux/arm64 --build-arg ADC_VERSION=$(ADC_VERSION) - t $(IMG) .
168184
169185.PHONY : build-push-multi-arch-image
170186build-push-multi-arch-image : build-multi-arch
171- @docker buildx build --push --platform linux/amd64,linux/arm64 -t $(IMG ) .
187+ @docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg ADC_VERSION= $( ADC_VERSION ) - t $(IMG ) .
172188
173189.PHONY : run
174190run : manifests generate fmt vet # # Run a controller from your host.
@@ -179,7 +195,12 @@ run: manifests generate fmt vet ## Run a controller from your host.
179195# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
180196.PHONY : docker-build
181197docker-build : set-e2e-goos build # # Build docker image with the manager.
182- $(CONTAINER_TOOL ) build -t ${IMG} -f Dockerfile .
198+ @echo " Building with ADC_VERSION=$( ADC_VERSION) "
199+ @if [ " $( strip $( ADC_VERSION) ) " = " dev" ]; then \
200+ $(CONTAINER_TOOL ) build -t ${IMG} -f Dockerfile.dev . ; \
201+ else \
202+ $(CONTAINER_TOOL ) build --build-arg ADC_VERSION=${ADC_VERSION} -t ${IMG} -f Dockerfile . ; \
203+ fi
183204
184205.PHONY : docker-push
185206docker-push : # # Push docker image with the manager.
@@ -255,7 +276,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
255276
256277# # Tool Versions
257278KUSTOMIZE_VERSION ?= v5.4.2
258- CONTROLLER_TOOLS_VERSION ?= v0.15.0
279+ CONTROLLER_TOOLS_VERSION ?= v0.17.2
259280ENVTEST_VERSION ?= release-0.18
260281GOLANGCI_LINT_VERSION ?= v2.1.5
261282
@@ -281,6 +302,10 @@ $(GOLANGCI_LINT): $(LOCALBIN)
281302
282303gofmt : # # Apply go fmt
283304 @gofmt -w -r ' interface{} -> any' .
305+ @gofmt -w -r ' FIt -> It' test
306+ @gofmt -w -r ' FContext -> Context' test
307+ @gofmt -w -r ' FDescribe -> Describe' test
308+ @gofmt -w -r ' FDescribeTable -> DescribeTable' test
284309 @go fmt ./...
285310.PHONY : gofmt
286311
0 commit comments