From c32e8d33f9421f715f4eea351a688dacccf5a188 Mon Sep 17 00:00:00 2001 From: Ishmam Amin Date: Thu, 28 Aug 2025 16:10:28 -0400 Subject: [PATCH 1/3] adding one GIE test --- test/extended/router/gatewayapicontroller.go | 31 ++++++++++++++++--- .../generated/zz_generated.annotations.go | 2 ++ zz_generated.manifests/test-reporting.yaml | 2 ++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/test/extended/router/gatewayapicontroller.go b/test/extended/router/gatewayapicontroller.go index 449dec9d837d..6d46681a2dc3 100644 --- a/test/extended/router/gatewayapicontroller.go +++ b/test/extended/router/gatewayapicontroller.go @@ -47,10 +47,11 @@ const ( var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feature:Router][apigroup:gateway.networking.k8s.io]", g.Ordered, g.Serial, func() { defer g.GinkgoRecover() var ( - oc = exutil.NewCLIWithPodSecurityLevel("gatewayapi-controller", admissionapi.LevelBaseline) - csvName string - err error - gateways []string + oc = exutil.NewCLIWithPodSecurityLevel("gatewayapi-controller", admissionapi.LevelBaseline) + csvName string + err error + gateways []string + infPoolCRD = "https://raw.githubusercontent.com/kubernetes-sigs/gateway-api-inference-extension/main/config/crd/bases/inference.networking.k8s.io_inferencepools.yaml" ) const ( @@ -246,6 +247,28 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat g.By("Validating the http connectivity to the backend application") assertHttpRouteConnection(defaultRoutename) }) + + g.It("Ensure GIE is enabled after creating an inferencePool CRD", func() { + errCheck := checkGatewayClass(oc, gatewayClassName) + o.Expect(errCheck).NotTo(o.HaveOccurred(), "GatewayClass %q was not installed and accepted", gatewayClassName) + + g.By("Install the GIE CRD") + err := oc.AsAdmin().Run("create").Args("-f", infPoolCRD).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + + g.By("Confirm istio is healthy and contains the env variable") + waitForIstioHealthy(oc) + istioEnv, err := oc.AsAdmin().Run("get").Args("-n", "openshift-ingress", "istio", "openshift-gateway", "-o=jsonpath={.spec.values.pilot.env}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(istioEnv).To(o.ContainSubstring(`ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true`)) + + g.By("Uninstall the GIE CRD and confirm the env variable is removed") + err = oc.AsAdmin().Run("delete").Args("-f", infPoolCRD).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + istioEnv, err = oc.AsAdmin().Run("get").Args("-n", "openshift-ingress", "istio", "openshift-gateway", "-o=jsonpath={.spec.values.pilot.env}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(istioEnv).NotTo(o.ContainSubstring(`ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true`)) + }) }) func skipGatewayIfNonCloudPlatform(oc *exutil.CLI) { diff --git a/test/extended/util/annotate/generated/zz_generated.annotations.go b/test/extended/util/annotate/generated/zz_generated.annotations.go index 7670bb21bcae..79e2dc4cb9ed 100644 --- a/test/extended/util/annotate/generated/zz_generated.annotations.go +++ b/test/extended/util/annotate/generated/zz_generated.annotations.go @@ -1525,6 +1525,8 @@ var Annotations = map[string]string{ "[sig-network-edge][Feature:Idling] Unidling with Deployments [apigroup:route.openshift.io] should work with UDP": " [Suite:openshift/conformance/parallel]", + "[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feature:Router][apigroup:gateway.networking.k8s.io] Ensure GIE is enabled after creating an inferencePool CRD": " [Suite:openshift/conformance/parallel]", + "[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feature:Router][apigroup:gateway.networking.k8s.io] Ensure HTTPRoute object is created": " [Suite:openshift/conformance/parallel]", "[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feature:Router][apigroup:gateway.networking.k8s.io] Ensure LB, service, and dnsRecord are created for a Gateway object": " [Suite:openshift/conformance/parallel]", diff --git a/zz_generated.manifests/test-reporting.yaml b/zz_generated.manifests/test-reporting.yaml index d5d784571771..fcb132dfc174 100644 --- a/zz_generated.manifests/test-reporting.yaml +++ b/zz_generated.manifests/test-reporting.yaml @@ -405,6 +405,8 @@ spec: Verify Gateway API CRDs and ensure required CRDs should already be installed' - featureGate: GatewayAPIController tests: + - testName: '[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feature:Router][apigroup:gateway.networking.k8s.io] + Ensure GIE is enabled after creating an inferencePool CRD' - testName: '[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feature:Router][apigroup:gateway.networking.k8s.io] Ensure HTTPRoute object is created' - testName: '[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feature:Router][apigroup:gateway.networking.k8s.io] From a82a19afa89f847e189266a24c41c42525028325 Mon Sep 17 00:00:00 2001 From: Ishmam Amin Date: Fri, 5 Sep 2025 13:46:34 -0400 Subject: [PATCH 2/3] updating GIE test with env variable polling for ci flakes --- test/extended/router/gatewayapicontroller.go | 28 +++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/test/extended/router/gatewayapicontroller.go b/test/extended/router/gatewayapicontroller.go index 6d46681a2dc3..d0314edb6636 100644 --- a/test/extended/router/gatewayapicontroller.go +++ b/test/extended/router/gatewayapicontroller.go @@ -258,16 +258,32 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat g.By("Confirm istio is healthy and contains the env variable") waitForIstioHealthy(oc) - istioEnv, err := oc.AsAdmin().Run("get").Args("-n", "openshift-ingress", "istio", "openshift-gateway", "-o=jsonpath={.spec.values.pilot.env}").Output() - o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(istioEnv).To(o.ContainSubstring(`ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true`)) + waitIstioErr := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 5*time.Minute, false, func(context context.Context) (bool, error) { + istioEnv, err := oc.AsAdmin().Run("get").Args("-n", "openshift-ingress", "istio", "openshift-gateway", "-o=jsonpath={.spec.values.pilot.env}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + if strings.Contains(istioEnv, `ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true`) { + e2e.Logf("GIE has been enabled, and the env variable is present in Istio resource") + return true, nil + } + e2e.Logf("GIE env variable is not present, retrying...") + return false, nil + }) + o.Expect(waitIstioErr).NotTo(o.HaveOccurred(), "Timed out waiting for Istio to have GIE env variable") g.By("Uninstall the GIE CRD and confirm the env variable is removed") err = oc.AsAdmin().Run("delete").Args("-f", infPoolCRD).Execute() o.Expect(err).NotTo(o.HaveOccurred()) - istioEnv, err = oc.AsAdmin().Run("get").Args("-n", "openshift-ingress", "istio", "openshift-gateway", "-o=jsonpath={.spec.values.pilot.env}").Output() - o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(istioEnv).NotTo(o.ContainSubstring(`ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true`)) + waitIstioErr = wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 5*time.Minute, false, func(context context.Context) (bool, error) { + istioEnv, err := oc.AsAdmin().Run("get").Args("-n", "openshift-ingress", "istio", "openshift-gateway", "-o=jsonpath={.spec.values.pilot.env}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + if strings.Contains(istioEnv, `ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true`) { + e2e.Logf("GIE env variable is still present, trying again...") + return false, nil + } + e2e.Logf("GIE env variable has been removed from the Istio resource") + return true, nil + }) + o.Expect(waitIstioErr).NotTo(o.HaveOccurred(), "Timed out waiting for Istio to remove GIE env variable") }) }) From 76d46738f0b4c23a25b3eeedbed9045922c04925 Mon Sep 17 00:00:00 2001 From: Ishmam Amin Date: Mon, 15 Sep 2025 16:57:11 -0400 Subject: [PATCH 3/3] address team comments --- test/extended/router/gatewayapicontroller.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test/extended/router/gatewayapicontroller.go b/test/extended/router/gatewayapicontroller.go index d0314edb6636..a5564a593c03 100644 --- a/test/extended/router/gatewayapicontroller.go +++ b/test/extended/router/gatewayapicontroller.go @@ -260,8 +260,11 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat waitForIstioHealthy(oc) waitIstioErr := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 5*time.Minute, false, func(context context.Context) (bool, error) { istioEnv, err := oc.AsAdmin().Run("get").Args("-n", "openshift-ingress", "istio", "openshift-gateway", "-o=jsonpath={.spec.values.pilot.env}").Output() - o.Expect(err).NotTo(o.HaveOccurred()) - if strings.Contains(istioEnv, `ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true`) { + if err != nil { + e2e.Logf("Failed getting openshift-gateway istio cr: %v", err) + return false, nil + } + if strings.Contains(istioEnv, `"ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true"`) { e2e.Logf("GIE has been enabled, and the env variable is present in Istio resource") return true, nil } @@ -275,8 +278,11 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat o.Expect(err).NotTo(o.HaveOccurred()) waitIstioErr = wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 5*time.Minute, false, func(context context.Context) (bool, error) { istioEnv, err := oc.AsAdmin().Run("get").Args("-n", "openshift-ingress", "istio", "openshift-gateway", "-o=jsonpath={.spec.values.pilot.env}").Output() - o.Expect(err).NotTo(o.HaveOccurred()) - if strings.Contains(istioEnv, `ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true`) { + if err != nil { + e2e.Logf("Failed getting openshift-gateway istio cr: %v", err) + return false, nil + } + if strings.Contains(istioEnv, `"ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true"`) { e2e.Logf("GIE env variable is still present, trying again...") return false, nil } @@ -307,7 +313,10 @@ func waitForIstioHealthy(oc *exutil.CLI) { resource := types.NamespacedName{Namespace: "openshift-ingress", Name: "openshift-gateway"} err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Minute, false, func(context context.Context) (bool, error) { istioStatus, errIstio := oc.AsAdmin().Run("get").Args("-n", resource.Namespace, "istio", resource.Name, "-o=jsonpath={.status.state}").Output() - o.Expect(errIstio).NotTo(o.HaveOccurred()) + if errIstio != nil { + e2e.Logf("Failed getting openshift-gateway istio cr status: %v", errIstio) + return false, nil + } if istioStatus != "Healthy" { e2e.Logf("Istio CR %q is not healthy, retrying...", resource.Name) return false, nil