@@ -1887,31 +1887,17 @@ func generateLayer3Subnets(cidrs string) []string {
18871887
18881888// userDefinedNetworkReadyFunc returns a function that checks for the NetworkCreated condition in the provided udn
18891889func userDefinedNetworkReadyFunc (client dynamic.Interface , namespace , name string ) func () error {
1890- return func () error {
1891- udn , err := client .Resource (udnGVR ).Namespace (namespace ).Get (context .Background (), name , metav1.GetOptions {}, "status" )
1892- if err != nil {
1893- return err
1894- }
1895- conditions , err := getConditions (udn )
1896- if err != nil {
1897- return err
1898- }
1899- if len (conditions ) == 0 {
1900- return fmt .Errorf ("no conditions found in: %v" , udn )
1901- }
1902- for _ , condition := range conditions {
1903- if condition .Type == "NetworkCreated" && condition .Status == metav1 .ConditionTrue {
1904- return nil
1905- }
1906- }
1907- return fmt .Errorf ("no NetworkCreated condition found in: %v" , udn )
1908- }
1890+ return networkReadyFunc (client .Resource (udnGVR ).Namespace (namespace ), name )
19091891}
19101892
19111893// userDefinedNetworkReadyFunc returns a function that checks for the NetworkCreated condition in the provided cluster udn
19121894func clusterUserDefinedNetworkReadyFunc (client dynamic.Interface , name string ) func () error {
1895+ return networkReadyFunc (client .Resource (clusterUDNGVR ), name )
1896+ }
1897+
1898+ func networkReadyFunc (client dynamic.ResourceInterface , name string ) func () error {
19131899 return func () error {
1914- cUDN , err := client .Resource ( clusterUDNGVR ). Get (context .Background (), name , metav1.GetOptions {}, "status" )
1900+ cUDN , err := client .Get (context .Background (), name , metav1.GetOptions {}, "status" )
19151901 if err != nil {
19161902 return err
19171903 }
0 commit comments