Skip to content

Commit d5c70d7

Browse files
author
Kate Osborn
committed
Install webhook in conformance tests on k8s < 1.25
1 parent 6665a74 commit d5c70d7

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

.github/workflows/conformance.yml

+1
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

conformance/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -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,7 +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+
./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
5152
kubectl apply -f $(CRDS)
5253
kubectl apply -f $(NGF_MANIFEST)
5354

@@ -92,7 +93,7 @@ uninstall-ngf: uninstall-k8s-components undo-manifests-update ## Uninstall NGF o
9293
.PHONY: uninstall-k8s-components
9394
uninstall-k8s-components: ## Uninstall installed components on configured kind cluster
9495
-kubectl delete -f $(NGF_MANIFEST)
95-
./scripts/uninstall-gateway.sh $(GW_API_VERSION)
96+
./scripts/uninstall-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
9697
kubectl delete clusterrole nginx-gateway-provisioner
9798
kubectl delete clusterrolebinding nginx-gateway-provisioner
9899

conformance/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ update-ngf-manifest Update the NGF deployment manifest image names an
5555
| SERVICE_MANIFEST | ../deploy/manifests/service/nodeport.yaml | The location of the NGF Service manifest |
5656
| STATIC_MANIFEST | provisioner/static-deployment.yaml | The location of the NGF static deployment manifest |
5757
| 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

+13
Original file line numberDiff line numberDiff line change
@@ -5,12 +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
1217
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
1322
rm -rf ${temp_dir}
1423
else
1524
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
1629
fi

conformance/scripts/uninstall-gateway.sh

+6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ if [ $1 == "main" ]; then
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
1212
kubectl delete -f crd/standard
13+
if [ $2 == "true" ]; then
14+
kubectl delete -f webhook
15+
fi
1316
rm -rf ${temp_dir}
1417
else
1518
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
1622
fi

0 commit comments

Comments
 (0)