Skip to content

Commit 60f3032

Browse files
authored
Add plus to test suites (#1536)
1 parent 074b526 commit 60f3032

File tree

12 files changed

+136
-48
lines changed

12 files changed

+136
-48
lines changed

.github/workflows/conformance.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
strategy:
3030
matrix:
3131
k8s-version: ["1.23.17", "latest"]
32+
nginx-image: [nginx, nginx-plus]
3233
permissions:
3334
contents: write # needed for uploading release artifacts
3435
steps:
@@ -63,7 +64,7 @@ jobs:
6364
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
6465
with:
6566
images: |
66-
name=ghcr.io/nginxinc/nginx-gateway-fabric/nginx
67+
name=ghcr.io/nginxinc/nginx-gateway-fabric/${{ matrix.nginx-image }}
6768
tags: |
6869
type=semver,pattern={{version}}
6970
type=edge
@@ -74,7 +75,7 @@ jobs:
7475
run: |
7576
ngf_prefix=ghcr.io/nginxinc/nginx-gateway-fabric
7677
ngf_tag=${{ steps.ngf-meta.outputs.version }}
77-
make update-ngf-manifest PREFIX=${ngf_prefix} TAG=${ngf_tag}
78+
make update-ngf-manifest${{ matrix.nginx-image == 'nginx-plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
7879
working-directory: ./conformance
7980

8081
- name: Build binary
@@ -98,16 +99,17 @@ jobs:
9899
- name: Build NGINX Docker Image
99100
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
100101
with:
101-
file: build/Dockerfile.nginx
102+
file: build/Dockerfile${{ matrix.nginx-image == 'nginx' && '.nginx' || '' }}${{ matrix.nginx-image == 'nginx-plus' && '.nginxplus' || ''}}
102103
tags: ${{ steps.nginx-meta.outputs.tags }}
103104
context: "."
104105
load: true
105-
cache-from: type=gha,scope=nginx
106-
cache-to: type=gha,scope=nginx,mode=max
106+
cache-from: type=gha,scope=${{ matrix.nginx-image }}
107+
cache-to: type=gha,scope=${{ matrix.nginx-image }},mode=max
107108
pull: true
108109
build-args: |
109110
NJS_DIR=internal/mode/static/nginx/modules/src
110111
NGINX_CONF_DIR=internal/mode/static/nginx/conf
112+
BUILD_AGENT=gha
111113
112114
- name: Update Go Modules
113115
if: ${{ github.event_name == 'schedule' }}
@@ -146,7 +148,7 @@ jobs:
146148
ngf_tag=${{ steps.ngf-meta.outputs.version }}
147149
if [ ${{ github.event_name }} == "schedule" ]; then export GW_API_VERSION=main; fi
148150
if [ ${{ startsWith(matrix.k8s-version, '1.23') || startsWith(matrix.k8s-version, '1.24') }} == "true" ]; then export INSTALL_WEBHOOK=true; fi
149-
make install-ngf-local-no-build PREFIX=${ngf_prefix} TAG=${ngf_tag}
151+
make install-ngf-local-no-build${{ matrix.nginx-image == 'nginx-plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
150152
working-directory: ./conformance
151153

152154
- name: Run conformance tests

conformance/Makefile

+26-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ TAG = edge
22
VERSION = 1.1.0 # NGF version
33
PREFIX = nginx-gateway-fabric
44
NGINX_PREFIX = $(PREFIX)/nginx
5+
NGINX_PLUS_PREFIX ?= $(PREFIX)/nginx-plus
56
GW_API_VERSION ?= 1.0.0
67
GATEWAY_CLASS = nginx
78
SUPPORTED_FEATURES = HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect,HTTPRouteHostRewrite,HTTPRoutePathRewrite,GatewayPort8080
@@ -13,7 +14,6 @@ NGF_MANIFEST=../deploy/manifests/nginx-gateway.yaml
1314
CRDS=../deploy/manifests/crds/
1415
STATIC_MANIFEST=provisioner/static-deployment.yaml
1516
PROVISIONER_MANIFEST=provisioner/provisioner.yaml
16-
NGINX_IMAGE=$(shell yq '.spec.template.spec.containers[1].image as $$nginx_ver | $$nginx_ver' $(STATIC_MANIFEST))
1717
INSTALL_WEBHOOK ?= false
1818
.DEFAULT_GOAL := help
1919

@@ -39,20 +39,38 @@ create-kind-cluster: ## Create a kind cluster
3939
update-ngf-manifest: ## Update the NGF deployment manifest image names and imagePullPolicies
4040
cd .. && make generate-manifests HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE="--set nginxGateway.kind=skip" HELM_TEMPLATE_COMMON_ARGS="--set nginxGateway.image.repository=$(PREFIX) --set nginxGateway.image.tag=$(TAG) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=$(NGINX_PREFIX) --set nginx.image.tag=$(TAG) --set nginx.image.pullPolicy=Never" && cd -
4141

42+
.PHONY: update-ngf-manifest-with-plus
43+
update-ngf-manifest-with-plus: ## Update the NGF deployment manifest image names and imagePullPolicies including nginx-plus
44+
cd .. && make generate-manifests HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE="--set nginxGateway.kind=skip" HELM_TEMPLATE_COMMON_ARGS="--set nginxGateway.image.repository=$(PREFIX) --set nginxGateway.image.tag=$(TAG) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=$(NGINX_PLUS_PREFIX) --set nginx.image.tag=$(TAG) --set nginx.image.pullPolicy=Never --set nginx.plus=true" && cd -
45+
4246
.PHONY: build-images
43-
build-images: ## Build NGF and nginx images
47+
build-images: ## Build NGF and NGINX images
4448
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) build-images
4549

4650
.PHONY: load-images
4751
load-images: ## Load NGF and NGINX images on configured kind cluster
4852
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) load-images
4953

54+
.PHONY: build-images-with-plus
55+
build-images-with-plus: ## Build NGF and NGINX Plus images
56+
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) build-images-with-plus
57+
58+
.PHONY: load-images-with-plus
59+
load-images-with-plus: ## Load NGF and NGINX Plus images on configured kind cluster
60+
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) load-images-with-plus
61+
5062
.PHONY: prepare-ngf-dependencies
5163
prepare-ngf-dependencies: update-ngf-manifest ## Install NGF dependencies on configured kind cluster
5264
./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
5365
kubectl apply -f $(CRDS)
5466
kubectl apply -f $(NGF_MANIFEST)
5567

68+
.PHONY: prepare-ngf-dependencies-with-plus
69+
prepare-ngf-dependencies-with-plus: update-ngf-manifest-with-plus ## Install NGF dependencies with Plus on configured kind cluster
70+
./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
71+
kubectl apply -f $(CRDS)
72+
kubectl apply -f $(NGF_MANIFEST)
73+
5674
.PHONY: deploy-updated-provisioner
5775
deploy-updated-provisioner: ## Update provisioner manifest and deploy to the configured kind cluster
5876
yq '(select(di != 3))' $(PROVISIONER_MANIFEST) | kubectl apply -f -
@@ -64,6 +82,12 @@ install-ngf-local-build: prepare-ngf-dependencies build-images load-images deplo
6482
.PHONY: install-ngf-local-no-build
6583
install-ngf-local-no-build: prepare-ngf-dependencies load-images deploy-updated-provisioner ## Install NGF from local build with provisioner on configured kind cluster but do not build the NGF image
6684

85+
.PHONY: install-ngf-local-build-with-plus
86+
install-ngf-local-build-with-plus: prepare-ngf-dependencies-with-plus build-images-with-plus load-images-with-plus deploy-updated-provisioner ## Install NGF with Plus from local build with provisioner on configured kind cluster
87+
88+
.PHONY: install-ngf-local-no-build-with-plus
89+
install-ngf-local-no-build-with-plus: prepare-ngf-dependencies-with-plus load-images-with-plus deploy-updated-provisioner ## Install NGF with Plus from local build with provisioner on configured kind cluster but do not build the NGF image
90+
6791
.PHONY: install-ngf-edge
6892
install-ngf-edge: prepare-ngf-dependencies ## Install NGF with provisioner from edge on configured kind cluster
6993
kubectl apply -f $(PROVISIONER_MANIFEST)

conformance/README.md

+44-20
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,30 @@ make
1616
```
1717

1818
```text
19-
build-images Build NGF and nginx images
20-
build-test-runner-image Build conformance test runner image
21-
cleanup-conformance-tests Clean up conformance tests fixtures
22-
create-kind-cluster Create a kind cluster
23-
delete-kind-cluster Delete kind cluster
24-
deploy-updated-provisioner Update provisioner manifest and deploy to the configured kind cluster
25-
help Display this help
26-
install-ngf-edge Install NGF with provisioner from edge on configured kind cluster
27-
install-ngf-local-build Install NGF from local build with provisioner on configured kind cluster
28-
install-ngf-local-no-build Install NGF from local build with provisioner on configured kind cluster but do not build the NGF image
29-
load-images Load NGF and NGINX images on configured kind cluster
30-
prepare-ngf-dependencies Install NGF dependencies on configured kind cluster
31-
reset-go-modules Reset the go modules changes
32-
run-conformance-tests Run conformance tests
33-
undo-manifests-update Undo the changes in the manifest files
34-
uninstall-ngf Uninstall NGF on configured kind cluster and undo manifest changes
35-
update-go-modules Update the gateway-api go modules to latest main version
36-
update-ngf-manifest Update the NGF deployment manifest image names and imagePullPolicies
19+
build-images-with-plus Build NGF and NGINX Plus images
20+
build-images Build NGF and NGINX images
21+
build-test-runner-image Build conformance test runner image
22+
cleanup-conformance-tests Clean up conformance tests fixtures
23+
create-kind-cluster Create a kind cluster
24+
delete-kind-cluster Delete kind cluster
25+
deploy-updated-provisioner Update provisioner manifest and deploy to the configured kind cluster
26+
help Display this help
27+
install-ngf-edge Install NGF with provisioner from edge on configured kind cluster
28+
install-ngf-local-build-with-plus Install NGF with Plus from local build with provisioner on configured kind cluster
29+
install-ngf-local-build Install NGF from local build with provisioner on configured kind cluster
30+
install-ngf-local-no-build-with-plus Install NGF with Plus from local build with provisioner on configured kind cluster but do not build the NGF image
31+
install-ngf-local-no-build Install NGF from local build with provisioner on configured kind cluster but do not build the NGF image
32+
load-images-with-plus Load NGF and NGINX Plus images on configured kind cluster
33+
load-images Load NGF and NGINX images on configured kind cluster
34+
prepare-ngf-dependencies-with-plus Install NGF dependencies with Plus on configured kind cluster
35+
prepare-ngf-dependencies Install NGF dependencies on configured kind cluster
36+
reset-go-modules Reset the go modules changes
37+
run-conformance-tests Run conformance tests
38+
undo-manifests-update Undo the changes in the manifest files
39+
uninstall-ngf Uninstall NGF on configured kind cluster and undo manifest changes
40+
update-go-modules Update the gateway-api go modules to latest main version
41+
update-ngf-manifest-with-plus Update the NGF deployment manifest image names and imagePullPolicies including nginx-plus
42+
update-ngf-manifest Update the NGF deployment manifest image names and imagePullPolicies
3743
```
3844

3945
**Note:** The following variables are configurable when running the below `make` commands:
@@ -50,7 +56,6 @@ update-ngf-manifest Update the NGF deployment manifest image names an
5056
| GATEWAY_CLASS | nginx | The gateway class that should be used for the tests |
5157
| SUPPORTED_FEATURES | HTTPRoute,HTTPRouteQueryParamMatching, HTTPRouteMethodMatching,HTTPRoutePortRedirect, HTTPRouteSchemeRedirect | The supported features that should be tested by the conformance tests. Ensure the list is comma separated with no spaces. |
5258
| EXEMPT_FEATURES | ReferenceGrant | The features that should not be tested by the conformance tests |
53-
| NGINX_IMAGE | as defined in the provisioner/static-deployment.yaml file | The NGINX image for the NGF deployments |
5459
| NGF_MANIFEST | ../deploy/manifests/nginx-gateway.yaml | The location of the NGF manifest |
5560
| SERVICE_MANIFEST | ../deploy/manifests/service/nodeport.yaml | The location of the NGF Service manifest |
5661
| STATIC_MANIFEST | provisioner/static-deployment.yaml | The location of the NGF static deployment manifest |
@@ -87,6 +92,12 @@ make create-kind-cluster KIND_IMAGE=kindest/node:v1.27.3
8792
make install-ngf-local-build
8893
```
8994

95+
Or, to install NGF with NGINX Plus enabled (NGINX Plus cert and key must exist in the root of the repo):
96+
97+
```makefile
98+
make install-ngf-local-build-with-plus
99+
```
100+
90101
#### *Option 2* Install NGINX Gateway Fabric from local already built image to configured kind cluster
91102

92103
You can optionally skip the actual *build* step.
@@ -95,15 +106,28 @@ You can optionally skip the actual *build* step.
95106
make install-ngf-local-no-build
96107
```
97108

109+
Or, to install NGF with NGINX Plus enabled:
110+
111+
```makefile
112+
make install-ngf-no-build-with-plus
113+
```
114+
98115
> Note: If choosing this option, the following step *must* be completed manually *before* you build the image:
99116
100117
```makefile
101118
make update-ngf-manifest PREFIX=<ngf_repo_name> TAG=<ngf_image_tag>
102119
```
103120

121+
Or, if you are building the NGINX Plus image:
122+
123+
```makefile
124+
make update-ngf-manifest-with-plus PREFIX=<ngf_repo_name> TAG=<ngf_image_tag>
125+
```
126+
104127
#### *Option 3* Install NGINX Gateway Fabric from edge to configured kind cluster
105128

106-
You can also skip the build NGF image step and prepare the environment to instead use the `edge` image
129+
You can also skip the build NGF image step and prepare the environment to instead use the `edge` image. Note that this
130+
option does not currently support installing with NGINX Plus enabled.
107131

108132
```makefile
109133
make install-ngf-edge

tests/Makefile

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
TAG = edge
22
PREFIX = nginx-gateway-fabric
33
NGINX_PREFIX = $(PREFIX)/nginx
4+
NGINX_PLUS_PREFIX = $(PREFIX)/nginx-plus
5+
PLUS_ENABLED=false
46
PULL_POLICY=Never
57
GW_API_PREV_VERSION ?= 1.0.0 ## Supported Gateway API version from previous NGF release
68
GW_API_VERSION ?= 1.0.0 ## Supported Gateway API version for NGF under test
@@ -14,6 +16,12 @@ ifneq ($(GINKGO_LABEL),)
1416
override GINKGO_FLAGS += -ginkgo.label-filter "$(GINKGO_LABEL)"
1517
endif
1618

19+
# Check if PLUS_ENABLED is true
20+
ifeq ($(PLUS_ENABLED),true)
21+
# If true, set NGINX_PREFIX to $NGINX_PLUS_PREFIX
22+
NGINX_PREFIX := $(NGINX_PLUS_PREFIX)
23+
endif
24+
1725
.PHONY: help
1826
help: Makefile ## Display this help
1927
@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}'
@@ -26,13 +34,21 @@ create-kind-cluster: ## Create a kind cluster
2634
build-images: ## Build NGF and NGINX images
2735
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) build-images
2836

37+
.PHONY: build-images-with-plus
38+
build-images-with-plus: ## Build NGF and NGINX Plus images
39+
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) build-images-with-plus
40+
2941
.PHONY: load-images
3042
load-images: ## Load NGF and NGINX images on configured kind cluster
31-
kind load docker-image $(PREFIX):$(TAG) $(NGINX_PREFIX):$(TAG)
43+
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) load-images
44+
45+
.PHONY: load-images-with-plus
46+
load-images-with-plus: ## Load NGF and NGINX Plus images on configured kind cluster
47+
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) load-images-with-plus
3248

3349
test: ## Run the system tests against your default k8s cluster
3450
go test -v ./suite $(GINKGO_FLAGS) -args --gateway-api-version=$(GW_API_VERSION) \
35-
--gateway-api-prev-version=$(GW_API_PREV_VERSION) --image-tag=$(TAG) \
51+
--gateway-api-prev-version=$(GW_API_PREV_VERSION) --image-tag=$(TAG) --plus-enabled=$(PLUS_ENABLED) \
3652
--ngf-image-repo=$(PREFIX) --nginx-image-repo=$(NGINX_PREFIX) --pull-policy=$(PULL_POLICY) \
3753
--k8s-version=$(K8S_VERSION) --service-type=$(GW_SERVICE_TYPE) --is-gke-internal-lb=$(GW_SVC_GKE_INTERNAL)
3854

0 commit comments

Comments
 (0)