22set -euo pipefail
33
44GATEWAY_API_VERSION=" ${GATEWAY_API_VERSION:- v1.5.1} "
5+ GATEWAY_API_CHANNEL=" ${GATEWAY_API_CHANNEL:- experimental} "
56BASE_URL=" https://github.com/kubernetes-sigs/gateway-api/releases/download/${GATEWAY_API_VERSION} "
67
8+ case " $GATEWAY_API_CHANNEL " in
9+ standard | experimental)
10+ ;;
11+ * )
12+ echo " GATEWAY_API_CHANNEL must be standard or experimental, got: $GATEWAY_API_CHANNEL " >&2
13+ exit 1
14+ ;;
15+ esac
16+
17+ tmpdir=" $( mktemp -d) "
18+ cleanup () {
19+ rm -rf " $tmpdir "
20+ }
21+ trap cleanup EXIT
22+
23+ manifest_file=" $tmpdir /${GATEWAY_API_CHANNEL} -install.yaml"
24+ curl -fsSL --connect-timeout 15 --max-time 120 --retry 3 --retry-delay 5 --retry-all-errors \
25+ " ${BASE_URL} /${GATEWAY_API_CHANNEL} -install.yaml" \
26+ -o " $manifest_file "
27+
728apply_with_retries () {
829 local manifest=" $1 "
930
1031 for attempt in 1 2 3; do
11- if kubectl apply -f " $manifest " ; then
32+ if kubectl apply --server-side - f " $manifest " ; then
1233 return 0
1334 fi
1435
@@ -20,9 +41,14 @@ apply_with_retries() {
2041 return 1
2142}
2243
23- apply_with_retries " ${BASE_URL} /standard-install.yaml"
24- apply_with_retries " ${BASE_URL} /experimental-install.yaml"
44+ apply_with_retries " $manifest_file "
2545kubectl wait --for=condition=established crd/gatewayclasses.gateway.networking.k8s.io --timeout=60s
2646kubectl wait --for=condition=established crd/gateways.gateway.networking.k8s.io --timeout=60s
2747kubectl wait --for=condition=established crd/httproutes.gateway.networking.k8s.io --timeout=60s
2848kubectl wait --for=condition=established crd/referencegrants.gateway.networking.k8s.io --timeout=60s
49+
50+ if [[ " $GATEWAY_API_CHANNEL " == " experimental" ]]; then
51+ kubectl wait --for=condition=established crd/tcproutes.gateway.networking.k8s.io --timeout=60s
52+ kubectl wait --for=condition=established crd/udproutes.gateway.networking.k8s.io --timeout=60s
53+ kubectl wait --for=condition=established crd/tlsroutes.gateway.networking.k8s.io --timeout=60s
54+ fi
0 commit comments