Skip to content

Run conformance tests on minimum k8s version #1020

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
Sep 1, 2023
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
8 changes: 6 additions & 2 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
conformance-tests:
name: Gateway Conformance Tests
runs-on: ubuntu-22.04
strategy:
matrix:
k8s-version: ["1.23.17", "latest"]
permissions:
contents: write # needed for uploading release artifacts
steps:
Expand Down Expand Up @@ -128,7 +131,8 @@ jobs:
- name: Deploy Kubernetes
id: k8s
run: |
make create-kind-cluster KIND_KUBE_CONFIG=${{ github.workspace }}/kube-${{ github.run_id }}
k8s_version=${{ matrix.k8s-version }}
make create-kind-cluster KIND_KUBE_CONFIG=${{ github.workspace }}/kube-${{ github.run_id }} ${{ ! contains(matrix.k8s-version, 'latest') && 'KIND_IMAGE=kindest/node:v${k8s_version}' || '' }}
echo "KUBECONFIG=${{ github.workspace }}/kube-${{ github.run_id }}" >> "$GITHUB_ENV"
working-directory: ./conformance

Expand All @@ -155,7 +159,7 @@ jobs:
working-directory: ./conformance

- name: Upload profile to release
if: startsWith(github.ref, 'refs/tags/')
if: ${{ matrix.k8s-version == 'latest' && startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.ref_name }} conformance-profile.yaml
Expand Down
2 changes: 1 addition & 1 deletion conformance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ NGINX_IMAGE_NAME = $(NKG_PREFIX)/nginx
GW_API_VERSION ?= 0.8.0
GATEWAY_CLASS = nginx
SUPPORTED_FEATURES = HTTPRoute,HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect,GatewayClassObservedGenerationBump
KIND_IMAGE ?= $(shell grep -m1 'FROM kindest/node' <tests/Dockerfile | awk -F'[ ]' '{print $$2}')
KIND_KUBE_CONFIG=$${HOME}/.kube/kind/config
TAG = latest
PREFIX = conformance-test-runner
Expand All @@ -30,7 +31,6 @@ build-test-runner-image: ## Build conformance test runner image

.PHONY: create-kind-cluster
create-kind-cluster: ## Create a kind cluster
$(eval KIND_IMAGE=$(shell grep -m1 'FROM kindest/node' <tests/Dockerfile | awk -F'[ ]' '{print $$2}'))
kind create cluster --image $(KIND_IMAGE)
kind export kubeconfig --kubeconfig $(KIND_KUBE_CONFIG)

Expand Down
8 changes: 8 additions & 0 deletions conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ update-nkg-manifest Update the NKG deployment manifest image names an
| NKG_TAG | edge | The tag for the locally built NKG image |
| NKG_PREFIX | nginx-kubernetes-gateway | The prefix for the locally built NKG image |
| GW_API_VERSION | 0.8.0 | Tag for the Gateway API version to check out. Set to `main` to get the latest version |
| KIND_IMAGE | Latest kind image, as defined in the tests/Dockerfile | The kind image to use |
| KIND_KUBE_CONFIG | ~/.kube/kind/config | The location of the kubeconfig |
| 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. |
Expand All @@ -61,6 +62,13 @@ update-nkg-manifest Update the NKG deployment manifest image names an
make create-kind-cluster
```

> Note: The default kind cluster deployed is the latest available version. You can specify a different version by
> defining the kind image to use through the KIND_IMAGE variable, e.g.

```makefile
make create-kind-cluster KIND_IMAGE=kindest/node:v1.27.3
```

### Step 2 - Install Nginx Kubernetes Gateway to configured kind cluster

> Note: If you want to run the latest conformance tests from the Gateway API `main` branch, set the following
Expand Down