Skip to content

Commit d939535

Browse files
Update Gateway API to v1.0.0 (#1250)
Problems: - NGF does not support v1.0.0 of Gateway API. - NGF does not use the official PartiallyInvalid condition from Gateway API SDK. - The Gateway API validating webhook should only be installed when Kubernetes version is <1.25 Solutions: - Update to v1.0.0 of Gateway API - Replace custom PartiallyInvalid condition with the Gateway API condition. - Add logic to pipeline and conformance scripts to conditionally install the webhook. Co-authored-by: Ciara Stacke <c.stacke@f5.com>
1 parent 76c9cb8 commit d939535

File tree

133 files changed

+1968
-1848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+1968
-1848
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ jobs:
222222
make create-kind-cluster KIND_KUBE_CONFIG=${kube_config}
223223
echo "KUBECONFIG=${kube_config}" >> "$GITHUB_ENV"
224224
kind load docker-image ${{ steps.ngf-meta.outputs.tags }} ${{ steps.nginx-meta.outputs.tags }}
225-
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v0.8.1/standard-install.yaml
226-
kubectl wait --for=condition=complete job/gateway-api-admission-patch job/gateway-api-admission -n gateway-system
225+
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/standard-install.yaml
227226
228227
- name: Install Chart
229228
run: >

.github/workflows/conformance.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ jobs:
145145
ngf_prefix=$(echo ${{ steps.ngf-meta.outputs.tags }} | cut -d ":" -f 1)
146146
ngf_tag=$(echo ${{ steps.ngf-meta.outputs.tags }} | cut -d ":" -f 2)
147147
if [ ${{ github.event_name }} == "schedule" ]; then export GW_API_VERSION=main; fi
148+
if [ ${{ startsWith(matrix.k8s-version, '1.23') || startsWith(matrix.k8s-version, '1.24') }} == "true" ]; then export INSTALL_WEBHOOK=true; fi
148149
make install-ngf-local-no-build NGF_PREFIX=${ngf_prefix} NGF_TAG=${ngf_tag}
149150
working-directory: ./conformance
150151

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ from the main branch.
3838
The table below summarizes the options regarding the images, manifests, documentation and examples and gives your links
3939
to the correct versions:
4040

41-
| Version | Description | Installation Manifests | Documentation and Examples |
42-
|----------------|------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
43-
| Latest release | For production use | [Manifests](https://github.com/nginxinc/nginx-gateway-fabric/tree/v1.0.0/deploy). | [Documentation](https://github.com/nginxinc/nginx-gateway-fabric/tree/v1.0.0/docs). [Examples](https://github.com/nginxinc/nginx-gateway-fabric/tree/v1.0.0/examples). |
41+
| Version | Description | Installation Manifests | Documentation and Examples |
42+
|----------------|------------------------------------------|-----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
43+
| Latest release | For production use | [Manifests](https://github.com/nginxinc/nginx-gateway-fabric/tree/v1.0.0/deploy). | [Documentation](https://github.com/nginxinc/nginx-gateway-fabric/tree/v1.0.0/docs). [Examples](https://github.com/nginxinc/nginx-gateway-fabric/tree/v1.0.0/examples). |
4444
| Edge | For experimental use and latest features | [Manifests](https://github.com/nginxinc/nginx-gateway-fabric/tree/main/deploy). | [Documentation](https://github.com/nginxinc/nginx-gateway-fabric/tree/main/docs). [Examples](https://github.com/nginxinc/nginx-gateway-fabric/tree/main/examples). |
4545

4646
### Versioning
@@ -61,15 +61,15 @@ the [Issue Lifecycle](ISSUE_LIFECYCLE.md) document for information on issue crea
6161
The following table lists the software versions NGINX Gateway Fabric supports.
6262

6363
| NGINX Gateway Fabric | Gateway API | Kubernetes | NGINX OSS |
64-
|--------------------------|-------------|------------|-----------|
65-
| Edge | 0.8.1 | 1.23+ | 1.25.2 |
66-
| 1.0.0 | 0.8.1 | 1.23+ | 1.25.2 |
67-
| 0.6.0 | 0.8.0 | 1.23+ | 1.25.2 |
68-
| 0.5.0 | 0.7.1 | 1.21+ | 1.25.x * |
69-
| 0.4.0 | 0.7.1 | 1.21+ | 1.25.x * |
70-
| 0.3.0 | 0.6.2 | 1.21+ | 1.23.x * |
71-
| 0.2.0 | 0.5.1 | 1.21+ | 1.21.x * |
72-
| 0.1.0 | 0.5.0 | 1.19+ | 1.21.3 |
64+
|----------------------|-------------|------------|-----------|
65+
| Edge | 1.0.0 | 1.23+ | 1.25.3 |
66+
| 1.0.0 | 0.8.1 | 1.23+ | 1.25.2 |
67+
| 0.6.0 | 0.8.0 | 1.23+ | 1.25.2 |
68+
| 0.5.0 | 0.7.1 | 1.21+ | 1.25.x * |
69+
| 0.4.0 | 0.7.1 | 1.21+ | 1.25.x * |
70+
| 0.3.0 | 0.6.2 | 1.21+ | 1.23.x * |
71+
| 0.2.0 | 0.5.1 | 1.21+ | 1.21.x * |
72+
| 0.1.0 | 0.5.0 | 1.19+ | 1.21.3 |
7373

7474
\*the installation manifests use the minor version of NGINX container image (e.g. 1.25) and the patch version is not
7575
specified. This means that the latest available patch version is used.

cmd/gateway/validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
const (
1515
// nolint:lll
16-
// Regex from: https://github.com/kubernetes-sigs/gateway-api/blob/v0.8.1/apis/v1beta1/shared_types.go#L551
16+
// Regex from: https://github.com/kubernetes-sigs/gateway-api/blob/v1.0.0/apis/v1/shared_types.go#L640
1717
controllerNameRegex = `^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` //nolint:lll
1818
)
1919

conformance/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
NGF_TAG = edge
22
NGF_PREFIX = nginx-gateway-fabric
33
NGINX_IMAGE_NAME = $(NGF_PREFIX)/nginx
4-
GW_API_VERSION ?= 0.8.1
4+
GW_API_VERSION ?= 1.0.0
55
GATEWAY_CLASS = nginx
66
SUPPORTED_FEATURES = HTTPRoute,HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect,GatewayClassObservedGenerationBump
77
KIND_IMAGE ?= $(shell grep -m1 'FROM kindest/node' <tests/Dockerfile | awk -F'[ ]' '{print $$2}')
@@ -13,6 +13,7 @@ CRDS=../deploy/manifests/crds/
1313
STATIC_MANIFEST=provisioner/static-deployment.yaml
1414
PROVISIONER_MANIFEST=provisioner/provisioner.yaml
1515
NGINX_IMAGE=$(shell yq '.spec.template.spec.containers[1].image as $$nginx_ver | $$nginx_ver' $(STATIC_MANIFEST))
16+
INSTALL_WEBHOOK ?= false
1617
.DEFAULT_GOAL := help
1718

1819
.PHONY: help
@@ -47,8 +48,7 @@ load-images: ## Load NGF and NGINX images on configured kind cluster
4748

4849
.PHONY: prepare-ngf-dependencies
4950
prepare-ngf-dependencies: update-ngf-manifest ## Install NGF dependencies on configured kind cluster
50-
./scripts/install-gateway.sh $(GW_API_VERSION)
51-
kubectl wait --for=condition=available --timeout=60s deployment gateway-api-admission-server -n gateway-system
51+
./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
5252
kubectl apply -f $(CRDS)
5353
kubectl apply -f $(NGF_MANIFEST)
5454

@@ -93,7 +93,7 @@ uninstall-ngf: uninstall-k8s-components undo-manifests-update ## Uninstall NGF o
9393
.PHONY: uninstall-k8s-components
9494
uninstall-k8s-components: ## Uninstall installed components on configured kind cluster
9595
-kubectl delete -f $(NGF_MANIFEST)
96-
./scripts/uninstall-gateway.sh $(GW_API_VERSION)
96+
./scripts/uninstall-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
9797
kubectl delete clusterrole nginx-gateway-provisioner
9898
kubectl delete clusterrolebinding nginx-gateway-provisioner
9999

conformance/README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,24 @@ update-ngf-manifest Update the NGF deployment manifest image names an
3838

3939
**Note:** The following variables are configurable when running the below `make` commands:
4040

41-
| Variable | Default | Description |
42-
|-------------------------|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
43-
| TAG | latest | The tag for the conformance test image |
44-
| PREFIX | conformance-test-runner | The prefix for the conformance test image |
45-
| NGF_TAG | edge | The tag for the locally built NGF image |
46-
| NGF_PREFIX | nginx-gateway-fabric | The prefix for the locally built NGF image |
47-
| GW_API_VERSION | 0.8.1 | 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 |
49-
| KIND_KUBE_CONFIG | ~/.kube/kind/config | The location of the kubeconfig |
50-
| GATEWAY_CLASS | nginx | The gateway class that should be used for the tests |
51-
| 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. |
52-
| 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 |
54-
| NGF_MANIFEST | ../deploy/manifests/nginx-gateway.yaml | The location of the NGF manifest |
55-
| SERVICE_MANIFEST | ../deploy/manifests/service/nodeport.yaml | The location of the NGF Service manifest |
56-
| STATIC_MANIFEST | provisioner/static-deployment.yaml | The location of the NGF static deployment manifest |
57-
| PROVISIONER_MANIFEST | provisioner/provisioner.yaml | The location of the NGF provisioner manifest |
41+
| Variable | Default | Description |
42+
|----------------------|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
43+
| TAG | latest | The tag for the conformance test image |
44+
| PREFIX | conformance-test-runner | The prefix for the conformance test image |
45+
| NGF_TAG | edge | The tag for the locally built NGF image |
46+
| NGF_PREFIX | nginx-gateway-fabric | The prefix for the locally built NGF image |
47+
| GW_API_VERSION | 1.0.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 |
49+
| KIND_KUBE_CONFIG | ~/.kube/kind/config | The location of the kubeconfig |
50+
| GATEWAY_CLASS | nginx | The gateway class that should be used for the tests |
51+
| 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. |
52+
| 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 |
54+
| NGF_MANIFEST | ../deploy/manifests/nginx-gateway.yaml | The location of the NGF manifest |
55+
| SERVICE_MANIFEST | ../deploy/manifests/service/nodeport.yaml | The location of the NGF Service manifest |
56+
| STATIC_MANIFEST | provisioner/static-deployment.yaml | The location of the NGF static deployment manifest |
57+
| PROVISIONER_MANIFEST | provisioner/provisioner.yaml | The location of the NGF provisioner manifest |
58+
| INSTALL_WEBHOOK | false | Install the Gateway API Validating Webhook. Necessary for Kubernetes versions < 1.25. |
5859

5960
### Step 1 - Create a kind Cluster
6061

conformance/scripts/install-gateway.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@ if [ -z $1 ]; then
55
exit 1
66
fi
77

8+
if [ -z $2 ]; then
9+
echo "install webhook argument not set; exiting"
10+
exit 1
11+
fi
12+
813
if [ $1 == "main" ]; then
914
temp_dir=$(mktemp -d)
1015
cd ${temp_dir}
1116
curl -s https://codeload.github.com/kubernetes-sigs/gateway-api/tar.gz/main | tar -xz --strip=2 gateway-api-main/config
12-
kubectl apply -f webhook
1317
kubectl apply -f crd/standard
18+
if [ $2 == "true" ]; then
19+
kubectl apply -f webhook
20+
kubectl wait --for=condition=available --timeout=60s deployment gateway-api-admission-server -n gateway-system
21+
fi
1422
rm -rf ${temp_dir}
1523
else
1624
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/standard-install.yaml
25+
if [ $2 == "true" ]; then
26+
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/webhook-install.yaml
27+
kubectl wait --for=condition=available --timeout=60s deployment gateway-api-admission-server -n gateway-system
28+
fi
1729
fi

conformance/scripts/uninstall-gateway.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ if [ $1 == "main" ]; then
99
temp_dir=$(mktemp -d)
1010
cd ${temp_dir}
1111
curl -s https://codeload.github.com/kubernetes-sigs/gateway-api/tar.gz/main | tar -xz --strip=2 gateway-api-main/config
12-
kubectl delete -f webhook
1312
kubectl delete -f crd/standard
13+
if [ $2 == "true" ]; then
14+
kubectl delete -f webhook
15+
fi
1416
rm -rf ${temp_dir}
1517
else
1618
kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/standard-install.yaml
19+
if [ $2 == "true" ]; then
20+
kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/webhook-install.yaml
21+
fi
1722
fi

conformance/tests/conformance_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"k8s.io/apimachinery/pkg/util/sets"
2626
"sigs.k8s.io/controller-runtime/pkg/client"
2727
"sigs.k8s.io/controller-runtime/pkg/client/config"
28+
v1 "sigs.k8s.io/gateway-api/apis/v1"
2829
"sigs.k8s.io/gateway-api/apis/v1alpha2"
2930
"sigs.k8s.io/gateway-api/apis/v1beta1"
3031
"sigs.k8s.io/gateway-api/conformance/apis/v1alpha1"
@@ -43,6 +44,7 @@ func TestConformance(t *testing.T) {
4344
g.Expect(err).To(BeNil())
4445

4546
g.Expect(v1alpha2.AddToScheme(client.Scheme())).To(Succeed())
47+
g.Expect(v1.AddToScheme(client.Scheme())).To(Succeed())
4648
g.Expect(v1beta1.AddToScheme(client.Scheme())).To(Succeed())
4749

4850
supportedFeatures := suite.ParseSupportedFeatures(*flags.SupportedFeatures)

0 commit comments

Comments
 (0)