Fix authz-ingress test flake (#14812)

This commit is contained in:
Frank Budinsky 2024-04-01 13:15:05 -04:00 committed by GitHub
parent 42f9bc4451
commit 051d6a5f73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 7 deletions

View File

@ -57,6 +57,11 @@ Create the gateway:
{{< text bash >}} {{< text bash >}}
$ kubectl apply -f @samples/httpbin/gateway-api/httpbin-gateway.yaml@ -n foo $ kubectl apply -f @samples/httpbin/gateway-api/httpbin-gateway.yaml@ -n foo
{{< /text >}}
Wait for the gateway to be ready:
{{< text bash >}}
$ kubectl wait --for=condition=programmed gtw -n foo httpbin-gateway $ kubectl wait --for=condition=programmed gtw -n foo httpbin-gateway
{{< /text >}} {{< /text >}}

View File

@ -37,23 +37,26 @@ kubectl get pods -n istio-system -o name -l istio=ingressgateway | sed 's|pod/||
snip_before_you_begin_4() { snip_before_you_begin_4() {
kubectl apply -f samples/httpbin/gateway-api/httpbin-gateway.yaml -n foo kubectl apply -f samples/httpbin/gateway-api/httpbin-gateway.yaml -n foo
kubectl wait --for=condition=programmed gtw -n foo httpbin-gateway
} }
snip_before_you_begin_5() { snip_before_you_begin_5() {
kubectl get pods -n foo -o name -l gateway.networking.k8s.io/gateway-name=httpbin-gateway | sed 's|pod/||' | while read -r pod; do istioctl proxy-config log "$pod" -n foo --level rbac:debug; done kubectl wait --for=condition=programmed gtw -n foo httpbin-gateway
} }
snip_before_you_begin_6() { snip_before_you_begin_6() {
kubectl get pods -n foo -o name -l gateway.networking.k8s.io/gateway-name=httpbin-gateway | sed 's|pod/||' | while read -r pod; do istioctl proxy-config log "$pod" -n foo --level rbac:debug; done
}
snip_before_you_begin_7() {
export INGRESS_HOST=$(kubectl get gtw httpbin-gateway -n foo -o jsonpath='{.status.addresses[0].value}') export INGRESS_HOST=$(kubectl get gtw httpbin-gateway -n foo -o jsonpath='{.status.addresses[0].value}')
export INGRESS_PORT=$(kubectl get gtw httpbin-gateway -n foo -o jsonpath='{.spec.listeners[?(@.name=="http")].port}') export INGRESS_PORT=$(kubectl get gtw httpbin-gateway -n foo -o jsonpath='{.spec.listeners[?(@.name=="http")].port}')
} }
snip_before_you_begin_7() { snip_before_you_begin_8() {
curl "$INGRESS_HOST:$INGRESS_PORT"/headers -s -o /dev/null -w "%{http_code}\n" curl "$INGRESS_HOST:$INGRESS_PORT"/headers -s -o /dev/null -w "%{http_code}\n"
} }
! IFS=$'\n' read -r -d '' snip_before_you_begin_7_out <<\ENDSNIP ! IFS=$'\n' read -r -d '' snip_before_you_begin_8_out <<\ENDSNIP
200 200
ENDSNIP ENDSNIP

View File

@ -34,8 +34,9 @@ _wait_for_deployment foo httpbin
if [ "$GATEWAY_API" == "true" ]; then if [ "$GATEWAY_API" == "true" ]; then
snip_before_you_begin_4 snip_before_you_begin_4
_verify_contains snip_before_you_begin_5 "rbac: debug" kubectl wait --for=condition=programmed gtw -n foo httpbin-gateway --timeout=90s
snip_before_you_begin_6 _verify_contains snip_before_you_begin_6 "rbac: debug"
snip_before_you_begin_7
else else
snip_before_you_begin_2 snip_before_you_begin_2
_verify_contains snip_before_you_begin_3 "rbac: debug" _verify_contains snip_before_you_begin_3 "rbac: debug"
@ -44,7 +45,7 @@ else
_set_ingress_environment_variables _set_ingress_environment_variables
fi fi
_verify_same snip_before_you_begin_7 "$snip_before_you_begin_7_out" _verify_same snip_before_you_begin_8 "$snip_before_you_begin_8_out"
if [ "$GATEWAY_API" == "true" ]; then if [ "$GATEWAY_API" == "true" ]; then
snip_network_load_balancer_2 snip_network_load_balancer_2