@@ -47,7 +47,6 @@ type testRA struct {
4747 SelectsDefault bool
4848 AdvertisePods bool
4949 AdvertiseEgressIPs bool
50- Status * metav1.ConditionStatus
5150}
5251
5352func (tra testRA ) RouteAdvertisements () * ratypes.RouteAdvertisements {
@@ -93,9 +92,6 @@ func (tra testRA) RouteAdvertisements() *ratypes.RouteAdvertisements {
9392 MatchLabels : tra .FRRConfigurationSelector ,
9493 }
9594 }
96- if tra .Status != nil {
97- ra .Status .Conditions = []metav1.Condition {{Type : "Accepted" , Status : * tra .Status }}
98- }
9995 return ra
10096}
10197
@@ -780,38 +776,6 @@ func TestController_reconcile(t *testing.T) {
780776 },
781777 expectNADAnnotations : map [string ]map [string ]string {"default" : {types .OvnRouteAdvertisementsKey : "[\" ra\" ]" }, "red" : {types .OvnRouteAdvertisementsKey : "[\" ra\" ]" }},
782778 },
783- {
784- name : "reconciles RouteAdvertisements status even when no other updates are required" ,
785- ra : & testRA {Name : "ra" , AdvertisePods : true , AdvertiseEgressIPs : true , SelectsDefault : true , Status : ptr .To (metav1 .ConditionFalse )},
786- frrConfigs : []* testFRRConfig {
787- {
788- Name : "frrConfig" ,
789- Namespace : frrNamespace ,
790- Routers : []* testRouter {
791- {ASN : 1 , Prefixes : []string {"1.1.1.0/24" }, Neighbors : []* testNeighbor {
792- {ASN : 1 , Address : "1.0.0.100" },
793- }},
794- },
795- },
796- {
797- Labels : map [string ]string {types .OvnRouteAdvertisementsKey : "ra" },
798- Annotations : map [string ]string {types .OvnRouteAdvertisementsKey : "ra/frrConfig/node" },
799- NodeSelector : map [string ]string {"kubernetes.io/hostname" : "node" },
800- Routers : []* testRouter {
801- {ASN : 1 , Prefixes : []string {"1.0.1.1/32" , "1.1.0.0/24" }, Neighbors : []* testNeighbor {
802- {ASN : 1 , Address : "1.0.0.100" , Advertise : []string {"1.0.1.1/32" , "1.1.0.0/24" }, Receive : []string {"1.1.0.0/16/24" }},
803- }},
804- },
805- },
806- },
807- nads : []* testNAD {
808- {Name : "default" , Namespace : "ovn-kubernetes" , Network : "default" , Annotations : map [string ]string {types .OvnRouteAdvertisementsKey : "[\" ra\" ]" }},
809- },
810- nodes : []* testNode {{Name : "node" , SubnetsAnnotation : "{\" default\" :\" 1.1.0.0/24\" }" }},
811- eips : []* testEIP {{Name : "eip" , EIPs : map [string ]string {"node" : "1.0.1.1" }}},
812- reconcile : "ra" ,
813- expectAcceptedStatus : metav1 .ConditionTrue ,
814- },
815779 {
816780 name : "fails to reconcile a secondary network" ,
817781 ra : & testRA {Name : "ra" , AdvertisePods : true , NetworkSelector : map [string ]string {"selected" : "true" }},
@@ -1041,6 +1005,11 @@ func TestController_reconcile(t *testing.T) {
10411005
10421006 c := NewController (nm .Interface (), wf , fakeClientset )
10431007
1008+ // prime the default network NAD
1009+ if defaultNAD == nil {
1010+ defaultNAD , err = c .getOrCreateDefaultNetworkNAD ()
1011+ g .Expect (err ).ToNot (gomega .HaveOccurred ())
1012+ }
10441013 // prime the default network NAD namespace
10451014 namespace := & corev1.Namespace {
10461015 ObjectMeta : metav1.ObjectMeta {
@@ -1049,15 +1018,11 @@ func TestController_reconcile(t *testing.T) {
10491018 }
10501019 _ , err = fakeClientset .KubeClient .CoreV1 ().Namespaces ().Create (context .Background (), namespace , metav1.CreateOptions {})
10511020 g .Expect (err ).ToNot (gomega .HaveOccurred ())
1052- // prime the default network NAD
1053- if defaultNAD == nil {
1054- defaultNAD , err = c .getOrCreateDefaultNetworkNAD ()
1055- g .Expect (err ).ToNot (gomega .HaveOccurred ())
1056- // update it with the annotation that network manager would set
1057- defaultNAD .Annotations = map [string ]string {types .OvnNetworkNameAnnotation : types .DefaultNetworkName }
1058- _ , err = fakeClientset .NetworkAttchDefClient .K8sCniCncfIoV1 ().NetworkAttachmentDefinitions (defaultNAD .Namespace ).Update (context .Background (), defaultNAD , metav1.UpdateOptions {})
1059- g .Expect (err ).ToNot (gomega .HaveOccurred ())
1060- }
1021+
1022+ // update it with the annotation that network manager would set
1023+ defaultNAD .Annotations = map [string ]string {types .OvnNetworkNameAnnotation : types .DefaultNetworkName }
1024+ _ , err = fakeClientset .NetworkAttchDefClient .K8sCniCncfIoV1 ().NetworkAttachmentDefinitions (defaultNAD .Namespace ).Update (context .Background (), defaultNAD , metav1.UpdateOptions {})
1025+ g .Expect (err ).ToNot (gomega .HaveOccurred ())
10611026
10621027 err = wf .Start ()
10631028 g .Expect (err ).ToNot (gomega .HaveOccurred ())
@@ -1074,13 +1039,7 @@ func TestController_reconcile(t *testing.T) {
10741039 )
10751040
10761041 err = nm .Start ()
1077- // some test cases start with a bad RA status, avoid asserting
1078- // initial sync in this case as it will fail
1079- if tt .ra == nil || tt .ra .Status == nil || * tt .ra .Status == metav1 .ConditionTrue {
1080- g .Expect (err ).ToNot (gomega .HaveOccurred ())
1081- } else {
1082- g .Expect (err ).To (gomega .HaveOccurred ())
1083- }
1042+ g .Expect (err ).ToNot (gomega .HaveOccurred ())
10841043 // we just need the inital sync
10851044 nm .Stop ()
10861045
0 commit comments