1
+ #! /usr/bin/env bash
2
+
3
+ set -o errexit
4
+ set -o nounset
5
+ set -o pipefail
6
+
7
+ export GATEWAY_FORWARDED_PORT=" ${GATEWAY_PORT:- 8888} "
8
+
9
+ source e2e/tests/functions.bash
10
+
11
+ # TODO: We may want to accept other providers, for now to keep it simple we will go with Envoy Gateway
12
+ function setup_suite {
13
+ log " Installing envoy gateway"
14
+
15
+ kubectl apply --server-side -f https://github.com/envoyproxy/gateway/releases/download/v1.5.0/install.yaml
16
+ kubectl wait --timeout=5m -n envoy-gateway-system deployment/envoy-gateway --for=condition=Available
17
+
18
+ # Install envoy gateway class
19
+ log " Creating GatewayClass"
20
+ kubectl apply -f e2e/manifests/infrastructure/gatewayclass.yaml
21
+ kubectl wait gatewayclass/eg --for=condition=Accepted=True
22
+ # TODO: Add HTTPS listener
23
+ log " Creating Gateway"
24
+ kubectl apply -f e2e/manifests/infrastructure/gateway.yaml
25
+ sleep 3 # Give some time for controller to reconcile gateway and start a deployment
26
+ export GATEWAY_NAME=$( kubectl get deploy -n envoy-gateway-system --selector=gateway.envoyproxy.io/owning-gateway-namespace=default,gateway.envoyproxy.io/owning-gateway-name=eg -o name | cut -f 2 -d /)
27
+ kubectl wait --timeout=2m deploy -n envoy-gateway-system ${GATEWAY_NAME} --for=condition=Available
28
+ log " Starting port-forwarding to gateway"
29
+ kubectl -n envoy-gateway-system port-forward service/${GATEWAY_NAME} ${GATEWAY_FORWARDED_PORT} :80 &
30
+ export KUBECTL_FORWARDER_PID=$!
31
+
32
+ log " Setting the sample application"
33
+ kubectl apply -f e2e/manifests/infrastructure/backend.yaml
34
+ kubectl wait --timeout=2m deploy backend --for=condition=Available
35
+ log " Test is ready to roll"
36
+ }
37
+
38
+ # We don't remove envoy gateway during teardown to avoid the reinstallation that has high cost
39
+ function teardown_suite {
40
+ kill ${KUBECTL_FORWARDER_PID}
41
+ log " Killed port-forwarding"
42
+ log " Removing the sample application"
43
+ kubectl delete -f e2e/manifests/infrastructure/backend.yaml
44
+ log " Cleaning gateway and gatewayclass resources"
45
+ kubectl delete -f e2e/manifests/infrastructure/gateway.yaml
46
+ kubectl delete -f e2e
38BA
/manifests/infrastructure/gatewayclass.yaml
47
+ }
0 commit comments