@@ -258,16 +258,32 @@ var _ = g.Describe("[sig-network-edge][OCPFeatureGate:GatewayAPIController][Feat
258
258
259
259
g .By ("Confirm istio is healthy and contains the env variable" )
260
260
waitForIstioHealthy (oc )
261
- istioEnv , err := oc .AsAdmin ().Run ("get" ).Args ("-n" , "openshift-ingress" , "istio" , "openshift-gateway" , "-o=jsonpath={.spec.values.pilot.env}" ).Output ()
262
- o .Expect (err ).NotTo (o .HaveOccurred ())
263
- o .Expect (istioEnv ).To (o .ContainSubstring (`ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true` ))
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
+ o .Expect (err ).NotTo (o .HaveOccurred ())
264
+ if strings .Contains (istioEnv , `ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true` ) {
265
+ e2e .Logf ("GIE has been enabled, and the env variable is present in Istio resource" )
266
+ return true , nil
267
+ }
268
+ e2e .Logf ("GIE env variable is not present, retrying..." )
269
+ return false , nil
270
+ })
271
+ o .Expect (waitIstioErr ).NotTo (o .HaveOccurred (), "Timed out waiting for Istio to have GIE env variable" )
264
272
265
273
g .By ("Uninstall the GIE CRD and confirm the env variable is removed" )
266
274
err = oc .AsAdmin ().Run ("delete" ).Args ("-f" , infPoolCRD ).Execute ()
267
275
o .Expect (err ).NotTo (o .HaveOccurred ())
268
- istioEnv , err = oc .AsAdmin ().Run ("get" ).Args ("-n" , "openshift-ingress" , "istio" , "openshift-gateway" , "-o=jsonpath={.spec.values.pilot.env}" ).Output ()
269
- o .Expect (err ).NotTo (o .HaveOccurred ())
270
- o .Expect (istioEnv ).NotTo (o .ContainSubstring (`ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true` ))
276
+ waitIstioErr = wait .PollUntilContextTimeout (context .Background (), 1 * time .Second , 5 * time .Minute , false , func (context context.Context ) (bool , error ) {
277
+ istioEnv , err := oc .AsAdmin ().Run ("get" ).Args ("-n" , "openshift-ingress" , "istio" , "openshift-gateway" , "-o=jsonpath={.spec.values.pilot.env}" ).Output ()
278
+ o .Expect (err ).NotTo (o .HaveOccurred ())
279
+ if strings .Contains (istioEnv , `ENABLE_GATEWAY_API_INFERENCE_EXTENSION":"true` ) {
280
+ e2e .Logf ("GIE env variable is still present, trying again..." )
281
+ return false , nil
282
+ }
283
+ e2e .Logf ("GIE env variable has been removed from the Istio resource" )
284
+ return true , nil
285
+ })
286
+ o .Expect (waitIstioErr ).NotTo (o .HaveOccurred (), "Timed out waiting for Istio to remove GIE env variable" )
271
287
})
272
288
})
273
289
0 commit comments