From 380298be2e1967dea16c2683599955b9a475e10d Mon Sep 17 00:00:00 2001 From: Craig Box Date: Fri, 23 Aug 2024 22:49:53 +1200 Subject: [PATCH] fix Gateway API test --- .../security/authorization/authz-ingress/test.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/en/docs/tasks/security/authorization/authz-ingress/test.sh b/content/en/docs/tasks/security/authorization/authz-ingress/test.sh index 12887648d8646..e4b4b36ee4680 100644 --- a/content/en/docs/tasks/security/authorization/authz-ingress/test.sh +++ b/content/en/docs/tasks/security/authorization/authz-ingress/test.sh @@ -77,12 +77,12 @@ _verify_same snip_ipbased_allow_list_and_deny_list_5 "$snip_ipbased_allow_list_a if [ "$GATEWAY_API" == "true" ]; then _verify_like snip_ipbased_allow_list_and_deny_list_8 "$snip_ipbased_allow_list_and_deny_list_8_out" - CLIENT_IP=$(kubectl get pods -n foo -o name -l istio.io/gateway-name=httpbin-gateway | sed 's|pod/||' | while read -r pod; do kubectl logs "$pod" -n foo | grep remoteIP; done | tail -1 | awk -F, '{print $3}' | awk -F: '{print $2}' | sed 's/ //') && echo "$CLIENT_IP" + snip_ipbased_allow_list_and_deny_list_8 snip_ipbased_allow_list_and_deny_list_12 _wait_for_istio authorizationpolicy foo ingress-policy else _verify_like snip_ipbased_allow_list_and_deny_list_6 "$snip_ipbased_allow_list_and_deny_list_6_out" - CLIENT_IP=$(kubectl get pods -n istio-system | grep ingress | awk '{print $1}' | while read -r pod; do kubectl logs "$pod" -n istio-system | grep remoteIP; done | tail -1 | awk -F, '{print $3}' | awk -F: '{print $2}' | sed 's/ //') && echo "$CLIENT_IP" + snip_ipbased_allow_list_and_deny_list_6 snip_ipbased_allow_list_and_deny_list_10 _wait_for_istio authorizationpolicy istio-system ingress-policy fi @@ -90,12 +90,12 @@ _verify_same snip_ipbased_allow_list_and_deny_list_14 "$snip_ipbased_allow_list_ if [ "$GATEWAY_API" == "true" ]; then _verify_like snip_ipbased_allow_list_and_deny_list_9 "$snip_ipbased_allow_list_and_deny_list_9_out" - CLIENT_IP=$(kubectl get pods -n foo -o name -l istio.io/gateway-name=httpbin-gateway | sed 's|pod/||' | while read -r pod; do kubectl logs "$pod" -n foo | grep remoteIP; done | tail -1 | awk -F, '{print $4}' | awk -F: '{print $2}' | sed 's/ //') && echo "$CLIENT_IP" + snip_ipbased_allow_list_and_deny_list_9 snip_ipbased_allow_list_and_deny_list_13 _wait_for_istio authorizationpolicy foo ingress-policy else _verify_like snip_ipbased_allow_list_and_deny_list_7 "$snip_ipbased_allow_list_and_deny_list_7_out" - CLIENT_IP=$(kubectl get pods -n istio-system -o name -l istio=ingressgateway | sed 's|pod/||' | while read -r pod; do kubectl logs "$pod" -n istio-system | grep remoteIP; done | tail -1 | awk -F, '{print $3}' | awk -F: '{print $2}' | sed 's/ //') && echo "$CLIENT_IP" + snip_ipbased_allow_list_and_deny_list_7 snip_ipbased_allow_list_and_deny_list_11 _wait_for_istio authorizationpolicy istio-system ingress-policy fi @@ -104,7 +104,7 @@ _verify_same snip_ipbased_allow_list_and_deny_list_14 "$snip_ipbased_allow_list_ # Test client IP denied if [ "$GATEWAY_API" == "true" ]; then - CLIENT_IP=$(kubectl get pods -n foo -o name -l istio.io/gateway-name=httpbin-gateway | sed 's|pod/||' | while read -r pod; do kubectl logs "$pod" -n foo | grep remoteIP; done | tail -1 | awk -F, '{print $3}' | awk -F: '{print $2}' | sed 's/ //') && echo "$CLIENT_IP" + CLIENT_IP=$(kubectl get pods -n foo -o name -l gateway.networking.k8s.io/gateway-name=httpbin-gateway | sed 's|pod/||' | while read -r pod; do kubectl logs "$pod" -n foo | grep remoteIP; done | tail -1 | awk -F, '{print $3}' | awk -F: '{print $2}' | sed 's/ //') && echo "$CLIENT_IP" snip_ipbased_allow_list_and_deny_list_17 _wait_for_istio authorizationpolicy foo ingress-policy else @@ -115,7 +115,7 @@ fi _verify_same snip_ipbased_allow_list_and_deny_list_19 "$snip_ipbased_allow_list_and_deny_list_19_out" if [ "$GATEWAY_API" == "true" ]; then - CLIENT_IP=$(kubectl get pods -n foo -o name -l istio.io/gateway-name=httpbin-gateway | sed 's|pod/||' | while read -r pod; do kubectl logs "$pod" -n foo | grep remoteIP; done | tail -1 | awk -F, '{print $4}' | awk -F: '{print $2}' | sed 's/ //') && echo "$CLIENT_IP" + CLIENT_IP=$(kubectl get pods -n foo -o name -l gateway.networking.k8s.io/gateway-name=httpbin-gateway | sed 's|pod/||' | while read -r pod; do kubectl logs "$pod" -n foo | grep remoteIP; done | tail -1 | awk -F, '{print $4}' | awk -F: '{print $2}' | sed 's/ //') && echo "$CLIENT_IP" snip_ipbased_allow_list_and_deny_list_18 _wait_for_istio authorizationpolicy foo ingress-policy else