Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions test/extended/router/gatewayapicontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -246,6 +247,44 @@ 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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need a defer like function for removing the GIE CRD ?
may be in the g.AfterAll(func().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@melvinjoseph86 removing the inference Pool CRD is a part of the test process, I do it below to confirm that the istio no longer has the env variable

o.Expect(err).NotTo(o.HaveOccurred())

g.By("Confirm istio is healthy and contains the env variable")
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`) {
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())
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")
})
})

func skipGatewayIfNonCloudPlatform(oc *exutil.CLI) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions zz_generated.manifests/test-reporting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down