@@ -47,10 +47,11 @@ const (
47
47
var _ = g .Describe ("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feature:Router][apigroup:gateway.networking.k8s.io]" , g .Ordered , g .Serial , func () {
48
48
defer g .GinkgoRecover ()
49
49
var (
50
- oc = exutil .NewCLIWithPodSecurityLevel ("gatewayapi-controller" , admissionapi .LevelBaseline )
51
- csvName string
52
- err error
53
- gateways []string
50
+ oc = exutil .NewCLIWithPodSecurityLevel ("gatewayapi-controller" , admissionapi .LevelBaseline )
51
+ csvName string
52
+ err error
53
+ gateways []string
54
+ infPoolCRD = "https://raw.githubusercontent.com/kubernetes-sigs/gateway-api-inference-extension/main/config/crd/bases/inference.networking.k8s.io_inferencepools.yaml"
54
55
)
55
56
56
57
const (
@@ -246,6 +247,50 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat
246
247
g .By ("Validating the http connectivity to the backend application" )
247
248
assertHttpRouteConnection (defaultRoutename )
248
249
})
250
+
251
+ g .It ("Ensure GIE is enabled after creating an inferencePool CRD" , func () {
252
+ errCheck := checkGatewayClass (oc , gatewayClassName )
253
+ o .Expect (errCheck ).NotTo (o .HaveOccurred (), "GatewayClass %q was not installed and accepted" , gatewayClassName )
254
+
255
+ g .By ("Install the GIE CRD" )
256
+ err := oc .AsAdmin ().Run ("create" ).Args ("-f" , infPoolCRD ).Execute ()
257
+ o .Expect (err ).NotTo (o .HaveOccurred ())
258
+
259
+ g .By ("Confirm istio is healthy and contains the env variable" )
260
+ waitForIstioHealthy (oc )
261
+ waitIstioErr := wait .PollUntilContextTimeout (context .Background (), 1 * time .Second , 5 * time .Minute , false , func (context context.Context ) (bool , error ) {
262
+ istioEnv , err := oc .AsAdmin ().Run ("get" ).Args ("-n" , "openshift-ingress" , "istio" , "openshift-gateway" , "-o=jsonpath={.spec.values.pilot.env}" ).Output ()
263
+ if err != nil {
264
+ e2e .Logf ("Failed getting openshift-gateway istio cr: %v" , err )
265
+ return false , nil
266
+ }
267
+ if strings .Contains (istioEnv , `"ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true"` ) {
268
+ e2e .Logf ("GIE has been enabled, and the env variable is present in Istio resource" )
269
+ return true , nil
270
+ }
271
+ e2e .Logf ("GIE env variable is not present, retrying..." )
272
+ return false , nil
273
+ })
274
+ o .Expect (waitIstioErr ).NotTo (o .HaveOccurred (), "Timed out waiting for Istio to have GIE env variable" )
275
+
276
+ g .By ("Uninstall the GIE CRD and confirm the env variable is removed" )
277
+ err = oc .AsAdmin ().Run ("delete" ).Args ("-f" , infPoolCRD ).Execute ()
278
+ o .Expect (err ).NotTo (o .HaveOccurred ())
279
+ waitIstioErr = wait .PollUntilContextTimeout (context .Background (), 1 * time .Second , 5 * time .Minute , false , func (context context.Context ) (bool , error ) {
280
+ istioEnv , err := oc .AsAdmin ().Run ("get" ).Args ("-n" , "openshift-ingress" , "istio" , "openshift-gateway" , "-o=jsonpath={.spec.values.pilot.env}" ).Output ()
281
+ if err != nil {
282
+ e2e .Logf ("Failed getting openshift-gateway istio cr: %v" , err )
283
+ return false , nil
284
+ }
285
+ if strings .Contains (istioEnv , `"ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true"` ) {
286
+ e2e .Logf ("GIE env variable is still present, trying again..." )
287
+ return false , nil
288
+ }
289
+ e2e .Logf ("GIE env variable has been removed from the Istio resource" )
290
+ return true , nil
291
+ })
292
+ o .Expect (waitIstioErr ).NotTo (o .HaveOccurred (), "Timed out waiting for Istio to remove GIE env variable" )
293
+ })
249
294
})
250
295
251
296
func skipGatewayIfNonCloudPlatform (oc * exutil.CLI ) {
@@ -268,7 +313,10 @@ func waitForIstioHealthy(oc *exutil.CLI) {
268
313
resource := types.NamespacedName {Namespace : "openshift-ingress" , Name : "openshift-gateway" }
269
314
err := wait .PollUntilContextTimeout (context .Background (), 1 * time .Second , 10 * time .Minute , false , func (context context.Context ) (bool , error ) {
270
315
istioStatus , errIstio := oc .AsAdmin ().Run ("get" ).Args ("-n" , resource .Namespace , "istio" , resource .Name , "-o=jsonpath={.status.state}" ).Output ()
271
- o .Expect (errIstio ).NotTo (o .HaveOccurred ())
316
+ if errIstio != nil {
317
+ e2e .Logf ("Failed getting openshift-gateway istio cr status: %v" , errIstio )
318
+ return false , nil
319
+ }
272
320
if istioStatus != "Healthy" {
273
321
e2e .Logf ("Istio CR %q is not healthy, retrying..." , resource .Name )
274
322
return false , nil
0 commit comments