@@ -38,6 +38,25 @@ import (
3838
3939const openDefaultPortsAnnotation = "k8s.ovn.org/open-default-ports"
4040
41+ // NOTE: We are observing pod creation requests taking more than two minutes t
42+ // reach the CNI for the CNI to do the necessary plumbing. This is causing tests
43+ // to timeout since pod doesn't go into ready state.
44+ // See https://issues.redhat.com/browse/OCPBUGS-48362 for details. We can revisit
45+ // these values when that bug is fixed but given the Kubernetes test default for a
46+ // pod to startup is 5mins: https://github.com/kubernetes/kubernetes/blob/60c4c2b2521fb454ce69dee737e3eb91a25e0535/test/e2e/framework/timeouts.go#L22-L23
47+ // we are not too far from the mark or against test policy
48+ const podReadyPollTimeout = 4 * time .Minute
49+ const podReadyPollInterval = 6 * time .Second
50+
51+ // NOTE: Upstream, we use either the default of gomega which is 1sec polltimeout with 10ms pollinterval OR
52+ // the tests have hardcoded values with 5sec being common for polltimeout and 10ms for pollinterval
53+ // This is being changed to be 10seconds poll timeout to account for infrastructure complexity between
54+ // OpenShift and KIND clusters. Also changing the polling interval to be 1 second so that in both
55+ // Eventually and Consistently blocks we get at least 10 retries (10/1) in good conditions and 5 retries (10/2) in
56+ // bad conditions since connectToServer util has a 2 second timeout.
57+ const serverConnectPollTimeout = 10 * time .Second
58+ const serverConnectPollInterval = 1 * time .Second
59+
4160var _ = Describe ("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:UserDefinedPrimaryNetworks]" , func () {
4261 // TODO: so far, only the isolation tests actually require this PSA ... Feels wrong to run everything priviliged.
4362 // I've tried to have multiple kubeframeworks (from multiple OCs) running (with different project names) but
@@ -263,7 +282,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
263282 By ("checking the default network pod can't reach UDN pod on IP " + destIP )
264283 Consistently (func () bool {
265284 return connectToServer (podConfiguration {namespace : defaultPod .Namespace , name : defaultPod .Name }, destIP , port ) != nil
266- }, 5 * time . Second ).Should (BeTrue ())
285+ }, serverConnectPollTimeout , serverConnectPollInterval ).Should (BeTrue ())
267286 }
268287
269288 defaultIPv4 , defaultIPv6 , err := podIPsForDefaultNetwork (
@@ -280,11 +299,11 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
280299 By ("checking the default network client pod can reach default pod on IP " + destIP )
281300 Eventually (func () bool {
282301 return connectToServer (podConfiguration {namespace : defaultClientPod .Namespace , name : defaultClientPod .Name }, destIP , defaultPort ) == nil
283- }).Should (BeTrue ())
302+ }, serverConnectPollTimeout , serverConnectPollInterval ).Should (BeTrue ())
284303 By ("checking the UDN pod can't reach the default network pod on IP " + destIP )
285304 Consistently (func () bool {
286305 return connectToServer (udnPodConfig , destIP , defaultPort ) != nil
287- }, 5 * time . Second ).Should (BeTrue ())
306+ }, serverConnectPollTimeout , serverConnectPollInterval ).Should (BeTrue ())
288307 }
289308
290309 // connectivity check is run every second + 1sec initialDelay
@@ -314,7 +333,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
314333 ping , "-I" , "eth0" , "-c" , "1" , "-W" , "1" , hostIP .IP ,
315334 )
316335 return err == nil
317- }, 4 * time .Second ).Should (BeFalse ())
336+ }, 4 * time .Second , 1 * time . Second ).Should (BeFalse ())
318337 }
319338
320339 By ("asserting UDN pod can reach the kapi service in the default network" )
@@ -331,7 +350,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
331350 "--insecure" ,
332351 "https://kubernetes.default/healthz" )
333352 return err == nil
334- }, 5 * time .Second ).Should (BeTrue ())
353+ }, 5 * time .Second , 1 * time . Second ).Should (BeTrue ())
335354
336355 By ("asserting UDN pod can't reach default services via default network interface" )
337356 // route setup is already done, get kapi IPs
@@ -353,7 +372,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
353372 "--insecure" ,
354373 fmt .Sprintf ("https://%s/healthz" , kapiIP ))
355374 return err != nil
356- }, 5 * time .Second ).Should (BeTrue ())
375+ }, 5 * time .Second , 1 * time . Second ).Should (BeTrue ())
357376 }
358377 },
359378 Entry (
@@ -662,7 +681,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
662681 _ = nadClient .NetworkAttachmentDefinitions (f .Namespace .Name ).Delete (ctx , testUdnName , metav1.DeleteOptions {})
663682 _ , err := nadClient .NetworkAttachmentDefinitions (f .Namespace .Name ).Get (ctx , testUdnName , metav1.GetOptions {})
664683 return err
665- }).ShouldNot (HaveOccurred (),
684+ }, udnInUseDeleteTimeout , deleteNetworkInterval ).ShouldNot (HaveOccurred (),
666685 "should fail to delete UserDefinedNetwork associated NetworkAttachmentDefinition when used" )
667686
668687 By ("verify UserDefinedNetwork status reports consuming pod" )
@@ -907,7 +926,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
907926 _ = nadClient .NetworkAttachmentDefinitions (inUseNetTestTenantNamespace ).Delete (ctx , testClusterUdnName , metav1.DeleteOptions {})
908927 _ , err := nadClient .NetworkAttachmentDefinitions (inUseNetTestTenantNamespace ).Get (ctx , testClusterUdnName , metav1.GetOptions {})
909928 return err
910- }).ShouldNot (HaveOccurred (),
929+ }, udnInUseDeleteTimeout , deleteNetworkInterval ).ShouldNot (HaveOccurred (),
911930 "should fail to delete UserDefinedNetwork associated NetworkAttachmentDefinition when used" )
912931
913932 By ("verify CR status reports consuming pod" )
@@ -969,6 +988,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
969988 By ("create primary Cluster UDN CR" )
970989 cudnName := randomNetworkMetaName ()
971990 cleanup , err := createManifest (f .Namespace .Name , newPrimaryClusterUDNManifest (cudnName , testTenantNamespaces ... ))
991+ Expect (err ).NotTo (HaveOccurred ())
972992 DeferCleanup (func () {
973993 cleanup ()
974994 _ , err := e2ekubectl .RunKubectl ("" , "delete" , "clusteruserdefinednetwork" , cudnName , "--wait" , fmt .Sprintf ("--timeout=%ds" , 60 ))
@@ -1060,7 +1080,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
10601080 By ("checking the default network pod can't reach UDN pod on IP " + destIP )
10611081 Consistently (func () bool {
10621082 return connectToServer (podConfiguration {namespace : defaultClientPod .Namespace , name : defaultClientPod .Name }, destIP , port ) != nil
1063- }, 5 * time . Second ).Should (BeTrue ())
1083+ }, serverConnectPollTimeout , serverConnectPollInterval ).Should (BeTrue ())
10641084 }
10651085
10661086 By ("Open UDN pod port" )
@@ -1078,7 +1098,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
10781098 By ("checking the default network pod can reach UDN pod on IP " + destIP )
10791099 Eventually (func () bool {
10801100 return connectToServer (podConfiguration {namespace : defaultClientPod .Namespace , name : defaultClientPod .Name }, destIP , port ) == nil
1081- }, 5 * time . Second ).Should (BeTrue ())
1101+ }, serverConnectPollTimeout , serverConnectPollInterval ).Should (BeTrue ())
10821102 }
10831103
10841104 By ("Update UDN pod port with the wrong syntax" )
@@ -1097,10 +1117,11 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
10971117 By ("checking the default network pod can't reach UDN pod on IP " + destIP )
10981118 Eventually (func () bool {
10991119 return connectToServer (podConfiguration {namespace : defaultClientPod .Namespace , name : defaultClientPod .Name }, destIP , port ) != nil
1100- }, 5 * time . Second ).Should (BeTrue ())
1120+ }, serverConnectPollTimeout , serverConnectPollInterval ).Should (BeTrue ())
11011121 }
11021122 By ("Verify syntax error is reported via event" )
11031123 events , err := cs .CoreV1 ().Events (udnPod .Namespace ).List (context .Background (), metav1.ListOptions {})
1124+ Expect (err ).NotTo (HaveOccurred ())
11041125 found := false
11051126 for _ , event := range events .Items {
11061127 if event .Reason == "ErrorUpdatingResource" && strings .Contains (event .Message , "invalid protocol ppp" ) {
@@ -1586,7 +1607,7 @@ func runUDNPod(cs clientset.Interface, namespace string, podConfig podConfigurat
15861607 return v1 .PodFailed
15871608 }
15881609 return updatedPod .Status .Phase
1589- }, 2 * time . Minute , 6 * time . Second ).Should (Equal (v1 .PodRunning ))
1610+ }, podReadyPollTimeout , podReadyPollInterval ).Should (Equal (v1 .PodRunning ))
15901611 return updatedPod
15911612}
15921613
0 commit comments