Skip to content

Add plus to test suites #1536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
strategy:
matrix:
k8s-version: ["1.23.17", "latest"]
nginx-image: [nginx, nginx-plus]
permissions:
contents: write # needed for uploading release artifacts
steps:
Expand Down Expand Up @@ -63,7 +64,7 @@ jobs:
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: |
name=ghcr.io/nginxinc/nginx-gateway-fabric/nginx
name=ghcr.io/nginxinc/nginx-gateway-fabric/${{ matrix.nginx-image }}
tags: |
type=semver,pattern={{version}}
type=edge
Expand All @@ -74,7 +75,7 @@ jobs:
run: |
ngf_prefix=ghcr.io/nginxinc/nginx-gateway-fabric
ngf_tag=${{ steps.ngf-meta.outputs.version }}
make update-ngf-manifest PREFIX=${ngf_prefix} TAG=${ngf_tag}
make update-ngf-manifest${{ matrix.nginx-image == 'nginx-plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
working-directory: ./conformance

- name: Build binary
Expand All @@ -98,16 +99,17 @@ jobs:
- name: Build NGINX Docker Image
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
file: build/Dockerfile.nginx
file: build/Dockerfile${{ matrix.nginx-image == 'nginx' && '.nginx' || '' }}${{ matrix.nginx-image == 'nginx-plus' && '.nginxplus' || ''}}
tags: ${{ steps.nginx-meta.outputs.tags }}
context: "."
load: true
cache-from: type=gha,scope=nginx
cache-to: type=gha,scope=nginx,mode=max
cache-from: type=gha,scope=${{ matrix.nginx-image }}
cache-to: type=gha,scope=${{ matrix.nginx-image }},mode=max
pull: true
build-args: |
NJS_DIR=internal/mode/static/nginx/modules/src
NGINX_CONF_DIR=internal/mode/static/nginx/conf
BUILD_AGENT=gha

- name: Update Go Modules
if: ${{ github.event_name == 'schedule' }}
Expand Down Expand Up @@ -146,7 +148,7 @@ jobs:
ngf_tag=${{ steps.ngf-meta.outputs.version }}
if [ ${{ github.event_name }} == "schedule" ]; then export GW_API_VERSION=main; fi
if [ ${{ startsWith(matrix.k8s-version, '1.23') || startsWith(matrix.k8s-version, '1.24') }} == "true" ]; then export INSTALL_WEBHOOK=true; fi
make install-ngf-local-no-build PREFIX=${ngf_prefix} TAG=${ngf_tag}
make install-ngf-local-no-build${{ matrix.nginx-image == 'nginx-plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
working-directory: ./conformance

- name: Run conformance tests
Expand Down
28 changes: 26 additions & 2 deletions conformance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ TAG = edge
VERSION = 1.1.0 # NGF version
PREFIX = nginx-gateway-fabric
NGINX_PREFIX = $(PREFIX)/nginx
NGINX_PLUS_PREFIX ?= $(PREFIX)/nginx-plus
GW_API_VERSION ?= 1.0.0
GATEWAY_CLASS = nginx
SUPPORTED_FEATURES = HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect,HTTPRouteHostRewrite,HTTPRoutePathRewrite,GatewayPort8080
Expand All @@ -13,7 +14,6 @@ NGF_MANIFEST=../deploy/manifests/nginx-gateway.yaml
CRDS=../deploy/manifests/crds/
STATIC_MANIFEST=provisioner/static-deployment.yaml
PROVISIONER_MANIFEST=provisioner/provisioner.yaml
NGINX_IMAGE=$(shell yq '.spec.template.spec.containers[1].image as $$nginx_ver | $$nginx_ver' $(STATIC_MANIFEST))
INSTALL_WEBHOOK ?= false
.DEFAULT_GOAL := help

Expand All @@ -39,20 +39,38 @@ create-kind-cluster: ## Create a kind cluster
update-ngf-manifest: ## Update the NGF deployment manifest image names and imagePullPolicies
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 -

.PHONY: update-ngf-manifest-with-plus
update-ngf-manifest-with-plus: ## Update the NGF deployment manifest image names and imagePullPolicies including nginx-plus
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 -

.PHONY: build-images
build-images: ## Build NGF and nginx images
build-images: ## Build NGF and NGINX images
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) build-images

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

.PHONY: build-images-with-plus
build-images-with-plus: ## Build NGF and NGINX Plus images
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) build-images-with-plus

.PHONY: load-images-with-plus
load-images-with-plus: ## Load NGF and NGINX Plus images on configured kind cluster
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) load-images-with-plus

.PHONY: prepare-ngf-dependencies
prepare-ngf-dependencies: update-ngf-manifest ## Install NGF dependencies on configured kind cluster
./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
kubectl apply -f $(CRDS)
kubectl apply -f $(NGF_MANIFEST)

.PHONY: prepare-ngf-dependencies-with-plus
prepare-ngf-dependencies-with-plus: update-ngf-manifest-with-plus ## Install NGF dependencies with Plus on configured kind cluster
./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
kubectl apply -f $(CRDS)
kubectl apply -f $(NGF_MANIFEST)

.PHONY: deploy-updated-provisioner
deploy-updated-provisioner: ## Update provisioner manifest and deploy to the configured kind cluster
yq '(select(di != 3))' $(PROVISIONER_MANIFEST) | kubectl apply -f -
Expand All @@ -64,6 +82,12 @@ install-ngf-local-build: prepare-ngf-dependencies build-images load-images deplo
.PHONY: install-ngf-local-no-build
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

.PHONY: install-ngf-local-build-with-plus
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

.PHONY: install-ngf-local-no-build-with-plus
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

.PHONY: install-ngf-edge
install-ngf-edge: prepare-ngf-dependencies ## Install NGF with provisioner from edge on configured kind cluster
kubectl apply -f $(PROVISIONER_MANIFEST)
Expand Down
64 changes: 44 additions & 20 deletions conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,30 @@ make
```

```text
build-images Build NGF and nginx images
build-test-runner-image Build conformance test runner image
cleanup-conformance-tests Clean up conformance tests fixtures
create-kind-cluster Create a kind cluster
delete-kind-cluster Delete kind cluster
deploy-updated-provisioner Update provisioner manifest and deploy to the configured kind cluster
help Display this help
install-ngf-edge Install NGF with provisioner from edge on configured kind cluster
install-ngf-local-build Install NGF from local build with provisioner on configured kind cluster
install-ngf-local-no-build Install NGF from local build with provisioner on configured kind cluster but do not build the NGF image
load-images Load NGF and NGINX images on configured kind cluster
prepare-ngf-dependencies Install NGF dependencies on configured kind cluster
reset-go-modules Reset the go modules changes
run-conformance-tests Run conformance tests
undo-manifests-update Undo the changes in the manifest files
uninstall-ngf Uninstall NGF on configured kind cluster and undo manifest changes
update-go-modules Update the gateway-api go modules to latest main version
update-ngf-manifest Update the NGF deployment manifest image names and imagePullPolicies
build-images-with-plus Build NGF and NGINX Plus images
build-images Build NGF and NGINX images
build-test-runner-image Build conformance test runner image
cleanup-conformance-tests Clean up conformance tests fixtures
create-kind-cluster Create a kind cluster
delete-kind-cluster Delete kind cluster
deploy-updated-provisioner Update provisioner manifest and deploy to the configured kind cluster
help Display this help
install-ngf-edge Install NGF with provisioner from edge on configured kind cluster
install-ngf-local-build-with-plus Install NGF with Plus from local build with provisioner on configured kind cluster
install-ngf-local-build Install NGF from local build with provisioner on configured kind cluster
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
install-ngf-local-no-build Install NGF from local build with provisioner on configured kind cluster but do not build the NGF image
load-images-with-plus Load NGF and NGINX Plus images on configured kind cluster
load-images Load NGF and NGINX images on configured kind cluster
prepare-ngf-dependencies-with-plus Install NGF dependencies with Plus on configured kind cluster
prepare-ngf-dependencies Install NGF dependencies on configured kind cluster
reset-go-modules Reset the go modules changes
run-conformance-tests Run conformance tests
undo-manifests-update Undo the changes in the manifest files
uninstall-ngf Uninstall NGF on configured kind cluster and undo manifest changes
update-go-modules Update the gateway-api go modules to latest main version
update-ngf-manifest-with-plus Update the NGF deployment manifest image names and imagePullPolicies including nginx-plus
update-ngf-manifest Update the NGF deployment manifest image names and imagePullPolicies
```

**Note:** The following variables are configurable when running the below `make` commands:
Expand All @@ -50,7 +56,6 @@ update-ngf-manifest Update the NGF deployment manifest image names an
| GATEWAY_CLASS | nginx | The gateway class that should be used for the tests |
| 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. |
| EXEMPT_FEATURES | ReferenceGrant | The features that should not be tested by the conformance tests |
| NGINX_IMAGE | as defined in the provisioner/static-deployment.yaml file | The NGINX image for the NGF deployments |
| NGF_MANIFEST | ../deploy/manifests/nginx-gateway.yaml | The location of the NGF manifest |
| SERVICE_MANIFEST | ../deploy/manifests/service/nodeport.yaml | The location of the NGF Service manifest |
| STATIC_MANIFEST | provisioner/static-deployment.yaml | The location of the NGF static deployment manifest |
Expand Down Expand Up @@ -87,6 +92,12 @@ make create-kind-cluster KIND_IMAGE=kindest/node:v1.27.3
make install-ngf-local-build
```

Or, to install NGF with NGINX Plus enabled (NGINX Plus cert and key must exist in the root of the repo):

```makefile
make install-ngf-local-build-with-plus
```

#### *Option 2* Install NGINX Gateway Fabric from local already built image to configured kind cluster

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

Or, to install NGF with NGINX Plus enabled:

```makefile
make install-ngf-no-build-with-plus
```

> Note: If choosing this option, the following step *must* be completed manually *before* you build the image:

```makefile
make update-ngf-manifest PREFIX=<ngf_repo_name> TAG=<ngf_image_tag>
```

Or, if you are building the NGINX Plus image:

```makefile
make update-ngf-manifest-with-plus PREFIX=<ngf_repo_name> TAG=<ngf_image_tag>
```

#### *Option 3* Install NGINX Gateway Fabric from edge to configured kind cluster

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

```makefile
make install-ngf-edge
Expand Down
20 changes: 18 additions & 2 deletions tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
TAG = edge
PREFIX = nginx-gateway-fabric
NGINX_PREFIX = $(PREFIX)/nginx
NGINX_PLUS_PREFIX = $(PREFIX)/nginx-plus
PLUS_ENABLED=false
PULL_POLICY=Never
GW_API_PREV_VERSION ?= 1.0.0 ## Supported Gateway API version from previous NGF release
GW_API_VERSION ?= 1.0.0 ## Supported Gateway API version for NGF under test
Expand All @@ -14,6 +16,12 @@ ifneq ($(GINKGO_LABEL),)
override GINKGO_FLAGS += -ginkgo.label-filter "$(GINKGO_LABEL)"
endif

# Check if PLUS_ENABLED is true
ifeq ($(PLUS_ENABLED),true)
# If true, set NGINX_PREFIX to $NGINX_PLUS_PREFIX
NGINX_PREFIX := $(NGINX_PLUS_PREFIX)
endif

.PHONY: help
help: Makefile ## Display this help
@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}'
Expand All @@ -26,13 +34,21 @@ create-kind-cluster: ## Create a kind cluster
build-images: ## Build NGF and NGINX images
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) build-images

.PHONY: build-images-with-plus
build-images-with-plus: ## Build NGF and NGINX Plus images
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) build-images-with-plus

.PHONY: load-images
load-images: ## Load NGF and NGINX images on configured kind cluster
kind load docker-image $(PREFIX):$(TAG) $(NGINX_PREFIX):$(TAG)
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) load-images

.PHONY: load-images-with-plus
load-images-with-plus: ## Load NGF and NGINX Plus images on configured kind cluster
cd .. && make PREFIX=$(PREFIX) TAG=$(TAG) load-images-with-plus

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

Expand Down
Loading