1
1
NKG_TAG = edge
2
2
NKG_PREFIX = nginx-kubernetes-gateway
3
- GATEWAY_CLASS = nginx
4
- SUPPORTED_FEATURES = HTTPRoute,HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect
5
- EXEMPT_FEATURES = ReferenceGrant
6
3
KIND_KUBE_CONFIG_FOLDER = $${HOME}/.kube/kind
7
4
TAG = latest
8
5
PREFIX = conformance-test-runner
6
+ NGINX_IMAGE =$(shell yq '.spec.template.spec.containers[1].image as $$nginx_ver | $$nginx_ver' ../deploy/manifests/deployment.yaml)
9
7
.DEFAULT_GOAL := help
10
8
11
9
.PHONY : help
@@ -14,17 +12,20 @@ help: Makefile ## Display this help
14
12
15
13
.PHONY : build-test-runner-image
16
14
build-test-runner-image : # # Build conformance test runner image
17
- docker build -t $(PREFIX ) :$(TAG ) -f tests/Dockerfile ..
15
+ docker build -t $(PREFIX ) :$(TAG ) -f tests/Dockerfile ..
18
16
19
17
.PHONY : create-kind-cluster
20
18
create-kind-cluster : # # Create a kind cluster
21
- kind create cluster --image kindest/node:v1.27.1
19
+ kind create cluster --image kindest/node:v1.27.1
22
20
kind export kubeconfig --kubeconfig $(KIND_KUBE_CONFIG_FOLDER ) /config
23
21
24
22
.PHONY : prepare-nkg
25
- prepare-nkg : # # Build and load NKG container on configured kind cluster
23
+ prepare-nkg : # # Build and load NKG and NGINX containers on configured kind cluster
26
24
cd .. && make PREFIX=$(NKG_PREFIX ) TAG=$(NKG_TAG ) container
27
25
kind load docker-image $(NKG_PREFIX ) :$(NKG_TAG )
26
+ docker pull $(NGINX_IMAGE )
27
+ kind load docker-image $(NGINX_IMAGE )
28
+ yq -i ' with(.spec.template.spec.containers[0]; .image = "$(NKG_PREFIX):$(NKG_TAG)" | .imagePullPolicy = "Never")' ../deploy/manifests/deployment.yaml
28
29
29
30
.PHONY : install-nkg
30
31
install-nkg : # # Install NKG with provisioner on configured kind cluster
@@ -36,16 +37,17 @@ install-nkg: ## Install NKG with provisioner on configured kind cluster
36
37
kubectl apply -f ../deploy/manifests/rbac.yaml
37
38
kubectl apply -f ../deploy/manifests/gatewayclass.yaml
38
39
kubectl apply -f ../deploy/manifests/service/nodeport.yaml
39
- kubectl apply -f provisioner/provisioner.yaml
40
-
41
- .PHONY : update-test-kind-config
42
- update-test-kind-config : # # Update kind config
43
- sed -ir " s|server:.*|server: https://kind-control-plane:6443|" $(KIND_KUBE_CONFIG_FOLDER ) /config
40
+ yq ' (select(di != 3))' provisioner/provisioner.yaml | kubectl apply -f -
41
+ yq ' (select(.spec.template.spec.containers[].image) | .spec.template.spec.containers[].image="$(NKG_PREFIX):$(NKG_TAG)" | .spec.template.spec.containers[].imagePullPolicy = "Never")' provisioner/provisioner.yaml | kubectl apply -f -
44
42
45
43
.PHONY : run-conformance-tests
46
- run-conformance-tests : update-test-kind-config # # Run conformance tests
47
- docker run --network=kind --rm -v $(KIND_KUBE_CONFIG_FOLDER ) :/root/.kube $(PREFIX ) :$(TAG ) \
48
- go test -timeout 25m -v . -tags conformance -args --gateway-class=$(GATEWAY_CLASS ) --debug --supported-features=$(SUPPORTED_FEATURES ) --exempt-features=$(EXEMPT_FEATURES )
44
+ run-conformance-tests : # # Run conformance tests
45
+ kind load docker-image $(PREFIX ) :$(TAG )
46
+ yq ' (select(di != 3))' tests/conformance_spec.yaml | kubectl apply -f -
47
+ yq ' (select(.spec.containers[].image) | .spec.containers[].image="$(PREFIX):$(TAG)")' tests/conformance_spec.yaml | kubectl apply -f -
48
+ sleep 5
49
+ kubectl logs conformance --follow
50
+ kubectl delete -f tests/conformance_spec.yaml
49
51
50
52
.PHONY : uninstall-nkg
51
53
uninstall-nkg : # # Uninstall NKG on configured kind cluster
@@ -54,7 +56,11 @@ uninstall-nkg: ## Uninstall NKG on configured kind cluster
54
56
kubectl delete -f ../deploy/manifests/namespace.yaml
55
57
kubectl delete clusterrole nginx-gateway-provisioner
56
58
kubectl delete clusterrolebinding nginx-gateway-provisioner
57
-
59
+
60
+ .PHONY : undo-image-update
61
+ undo-image-update : # # Undo the NKG image name and tag in deployment manifest
62
+ git checkout -- ../deploy/manifests/deployment.yaml
63
+
58
64
.PHONY : delete-kind-cluster
59
65
delete-kind-cluster : # # Delete kind cluster
60
66
kind delete cluster
0 commit comments