diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index b84d35e26..d53ad637d 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -145,6 +145,7 @@ jobs: ngf_prefix=$(echo ${{ steps.ngf-meta.outputs.tags }} | cut -d ":" -f 1) ngf_tag=$(echo ${{ steps.ngf-meta.outputs.tags }} | cut -d ":" -f 2) 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 NGF_PREFIX=${ngf_prefix} NGF_TAG=${ngf_tag} working-directory: ./conformance diff --git a/conformance/Makefile b/conformance/Makefile index dcf06923b..47078450f 100644 --- a/conformance/Makefile +++ b/conformance/Makefile @@ -13,6 +13,7 @@ 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 .PHONY: help @@ -47,7 +48,7 @@ load-images: ## Load NGF and NGINX images on configured kind cluster .PHONY: prepare-ngf-dependencies prepare-ngf-dependencies: update-ngf-manifest ## Install NGF dependencies on configured kind cluster - ./scripts/install-gateway.sh $(GW_API_VERSION) + ./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK) kubectl apply -f $(CRDS) kubectl apply -f $(NGF_MANIFEST) @@ -92,7 +93,7 @@ uninstall-ngf: uninstall-k8s-components undo-manifests-update ## Uninstall NGF o .PHONY: uninstall-k8s-components uninstall-k8s-components: ## Uninstall installed components on configured kind cluster -kubectl delete -f $(NGF_MANIFEST) - ./scripts/uninstall-gateway.sh $(GW_API_VERSION) + ./scripts/uninstall-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK) kubectl delete clusterrole nginx-gateway-provisioner kubectl delete clusterrolebinding nginx-gateway-provisioner diff --git a/conformance/README.md b/conformance/README.md index 58ef9f98d..722cfb335 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -55,6 +55,7 @@ update-ngf-manifest Update the NGF deployment manifest image names an | 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 | | PROVISIONER_MANIFEST | provisioner/provisioner.yaml | The location of the NGF provisioner manifest | +| INSTALL_WEBHOOK | false | Install the Gateway API Validating Webhook. Necessary for Kubernetes versions < 1.25. | ### Step 1 - Create a kind Cluster diff --git a/conformance/scripts/install-gateway.sh b/conformance/scripts/install-gateway.sh index aab570b3d..485e77353 100755 --- a/conformance/scripts/install-gateway.sh +++ b/conformance/scripts/install-gateway.sh @@ -5,12 +5,25 @@ if [ -z $1 ]; then exit 1 fi +if [ -z $2 ]; then + echo "install webhook argument not set; exiting" + exit 1 +fi + if [ $1 == "main" ]; then temp_dir=$(mktemp -d) cd ${temp_dir} curl -s https://codeload.github.com/kubernetes-sigs/gateway-api/tar.gz/main | tar -xz --strip=2 gateway-api-main/config kubectl apply -f crd/standard + if [ $2 == "true" ]; then + kubectl apply -f webhook + kubectl wait --for=condition=available --timeout=60s deployment gateway-api-admission-server -n gateway-system + fi rm -rf ${temp_dir} else kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/standard-install.yaml + if [ $2 == "true" ]; then + kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/webhook-install.yaml + kubectl wait --for=condition=available --timeout=60s deployment gateway-api-admission-server -n gateway-system + fi fi diff --git a/conformance/scripts/uninstall-gateway.sh b/conformance/scripts/uninstall-gateway.sh index 99d162575..333085661 100755 --- a/conformance/scripts/uninstall-gateway.sh +++ b/conformance/scripts/uninstall-gateway.sh @@ -10,7 +10,13 @@ if [ $1 == "main" ]; then cd ${temp_dir} curl -s https://codeload.github.com/kubernetes-sigs/gateway-api/tar.gz/main | tar -xz --strip=2 gateway-api-main/config kubectl delete -f crd/standard + if [ $2 == "true" ]; then + kubectl delete -f webhook + fi rm -rf ${temp_dir} else kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/standard-install.yaml + if [ $2 == "true" ]; then + kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/webhook-install.yaml + fi fi