Skip to content

Commit d4e0437

Browse files
committed
Run conformance tests on minimum k8s version
1 parent 4379a6e commit d4e0437

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.github/workflows/conformance.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
conformance-tests:
3030
name: Gateway Conformance Tests
3131
runs-on: ubuntu-22.04
32+
strategy:
33+
matrix:
34+
k8s-version: ["1.23.17", "latest"]
3235
permissions:
3336
contents: write # needed for uploading release artifacts
3437
steps:
@@ -128,7 +131,8 @@ jobs:
128131
- name: Deploy Kubernetes
129132
id: k8s
130133
run: |
131-
make create-kind-cluster KIND_KUBE_CONFIG=${{ github.workspace }}/kube-${{ github.run_id }}
134+
k8s_version=${{ matrix.k8s-version }}
135+
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}' || '' }}
132136
echo "KUBECONFIG=${{ github.workspace }}/kube-${{ github.run_id }}" >> "$GITHUB_ENV"
133137
working-directory: ./conformance
134138

@@ -155,7 +159,7 @@ jobs:
155159
working-directory: ./conformance
156160

157161
- name: Upload profile to release
158-
if: startsWith(github.ref, 'refs/tags/')
162+
if: ${{ matrix.k8s-version == 'latest' && startsWith(github.ref, 'refs/tags/') }}
159163
env:
160164
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
161165
run: gh release upload ${{ github.ref_name }} conformance-profile.yaml

conformance/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ NGINX_IMAGE_NAME = $(NKG_PREFIX)/nginx
44
GW_API_VERSION ?= 0.8.0
55
GATEWAY_CLASS = nginx
66
SUPPORTED_FEATURES = HTTPRoute,HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect,GatewayClassObservedGenerationBump
7+
KIND_IMAGE ?= $(shell grep -m1 'FROM kindest/node' <tests/Dockerfile | awk -F'[ ]' '{print $$2}')
78
KIND_KUBE_CONFIG=$${HOME}/.kube/kind/config
89
TAG = latest
910
PREFIX = conformance-test-runner
@@ -30,7 +31,6 @@ build-test-runner-image: ## Build conformance test runner image
3031

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

conformance/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ update-nkg-manifest Update the NKG deployment manifest image names an
4545
| NKG_TAG | edge | The tag for the locally built NKG image |
4646
| NKG_PREFIX | nginx-kubernetes-gateway | The prefix for the locally built NKG image |
4747
| GW_API_VERSION | 0.8.0 | Tag for the Gateway API version to check out. Set to `main` to get the latest version |
48+
| KIND_IMAGE | Latest kind image, as defined in the tests/Dockerfile | The kind image to use |
4849
| KIND_KUBE_CONFIG | ~/.kube/kind/config | The location of the kubeconfig |
4950
| GATEWAY_CLASS | nginx | The gateway class that should be used for the tests |
5051
| 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. |
@@ -61,6 +62,13 @@ update-nkg-manifest Update the NKG deployment manifest image names an
6162
make create-kind-cluster
6263
```
6364

65+
> Note: The default kind cluster deployed is the latest available version. You can specify a different version by
66+
> defining the kind image to use through the KIND_IMAGE variable, e.g.
67+
68+
```makefile
69+
make create-kind-cluster KIND_IMAGE=kindest/node:v1.27.3
70+
```
71+
6472
### Step 2 - Install Nginx Kubernetes Gateway to configured kind cluster
6573

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

0 commit comments

Comments
 (0)