|
| 1 | +NKG_TAG = edge |
| 2 | +NKG_PREFIX = nginx-kubernetes-gateway |
| 3 | +GATEWAY_CLASS = nginx |
| 4 | +SUPPORTED_FEATURES = Gateway,HTTPRoute |
| 5 | +KIND_KUBE_CONFIG_FOLDER = $${HOME}/.kube/kind |
| 6 | +TAG = latest |
| 7 | +PREFIX = conformance-test-runner |
| 8 | +.DEFAULT_GOAL := help |
| 9 | + |
| 10 | +.PHONY: help |
| 11 | +help: Makefile ## Display this help |
| 12 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "; printf "Usage:\n\n make \033[36m<target>\033[0m\n\nTargets:\n\n"}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' |
| 13 | + |
| 14 | +.PHONY: build-test-runner-image |
| 15 | +build-test-runner-image: ## Build conformance test runner image |
| 16 | + docker build -t $(PREFIX):$(TAG) -f tests/Dockerfile .. |
| 17 | + |
| 18 | +.PHONY: create-kind-cluster |
| 19 | +create-kind-cluster: ## Create a kind cluster |
| 20 | + kind create cluster --image kindest/node:v1.27.1 |
| 21 | + kind export kubeconfig --kubeconfig $(KIND_KUBE_CONFIG_FOLDER)/config |
| 22 | + |
| 23 | +.PHONY: prepare-nkg |
| 24 | +prepare-nkg: ## Build and load NKG container on configured kind cluster |
| 25 | + cd .. && make PREFIX=$(NKG_PREFIX) TAG=$(NKG_TAG) container |
| 26 | + kind load docker-image $(NKG_PREFIX):$(NKG_TAG) |
| 27 | + |
| 28 | +.PHONY: install-nkg |
| 29 | +install-nkg: ## Install NKG with provisioner on configured kind cluster |
| 30 | + kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v0.7.0/standard-install.yaml |
| 31 | + kubectl wait --for=condition=available --timeout=60s deployment gateway-api-admission-server -n gateway-system |
| 32 | + kubectl apply -f ../deploy/manifests/namespace.yaml |
| 33 | + kubectl create configmap njs-modules --from-file=../internal/nginx/modules/src/httpmatches.js -n nginx-gateway |
| 34 | + kubectl apply -f ../deploy/manifests/nginx-conf.yaml |
| 35 | + kubectl apply -f ../deploy/manifests/rbac.yaml |
| 36 | + kubectl apply -f ../deploy/manifests/gatewayclass.yaml |
| 37 | + kubectl apply -f ../deploy/manifests/service/nodeport.yaml |
| 38 | + kubectl apply -f provisioner/provisioner.yaml |
| 39 | + |
| 40 | +.PHONY: update-test-kind-config |
| 41 | +update-test-kind-config: ## Update kind config |
| 42 | + sed -ir "s|server:.*|server: https://kind-control-plane:6443|" $(KIND_KUBE_CONFIG_FOLDER)/config |
| 43 | + |
| 44 | +.PHONY: run-conformance-tests |
| 45 | +run-conformance-tests: update-test-kind-config ## Run conformance tests |
| 46 | + docker run --network=kind --rm -v $(KIND_KUBE_CONFIG_FOLDER):/root/.kube $(PREFIX):$(TAG) \ |
| 47 | + go test -v . -tags conformance -args --gateway-class=$(GATEWAY_CLASS) --supported-features=$(SUPPORTED_FEATURES) |
| 48 | + |
| 49 | +.PHONY: uninstall-nkg |
| 50 | +uninstall-nkg: ## Uninstall NKG on configured kind cluster |
| 51 | + kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v0.7.0/standard-install.yaml |
| 52 | + kubectl delete -f ../deploy/manifests/rbac.yaml |
| 53 | + kubectl delete -f ../deploy/manifests/namespace.yaml |
| 54 | + kubectl delete clusterrole nginx-gateway-provisioner |
| 55 | + kubectl delete clusterrolebinding nginx-gateway-provisioner |
| 56 | + |
| 57 | +.PHONY: delete-kind-cluster |
| 58 | +delete-kind-cluster: ## Delete kind cluster |
| 59 | + kind delete cluster |
0 commit comments