@@ -1427,6 +1427,92 @@ var _ = Describe("Testing core-controller installation", func() {
14271427 Expect (pullSecret .Kind ).To (Equal ("Installation" ))
14281428 })
14291429
1430+ It ("should correctly patch FelixConfig and BGPConfig with ClusterRouteMode not set" , func () {
1431+ cr .Spec .CalicoNetwork = & operator.CalicoNetworkSpec {}
1432+ Expect (c .Create (ctx , cr )).NotTo (HaveOccurred ())
1433+ _ , err := r .Reconcile (ctx , reconcile.Request {})
1434+ Expect (err ).ShouldNot (HaveOccurred ())
1435+
1436+ fc := & v3.FelixConfiguration {}
1437+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, fc )
1438+ Expect (err ).ShouldNot (HaveOccurred ())
1439+ Expect (fc .Spec .ProgramClusterRoutes ).NotTo (BeNil ())
1440+ Expect (* fc .Spec .ProgramClusterRoutes ).To (Equal ("Disabled" ))
1441+
1442+ bgpConfig := & v3.BGPConfiguration {}
1443+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, bgpConfig )
1444+ Expect (err ).ShouldNot (HaveOccurred ())
1445+ Expect (bgpConfig .Spec .ProgramClusterRoutes ).NotTo (BeNil ())
1446+ Expect (* bgpConfig .Spec .ProgramClusterRoutes ).To (Equal ("Enabled" ))
1447+ })
1448+
1449+ It ("should correctly patch FelixConfig and BGPConfig with ClusterRouteMode set to BIRD" , func () {
1450+ bird := operator .ClusterRoutingModeBIRD
1451+ cr .Spec .CalicoNetwork = & operator.CalicoNetworkSpec {ClusterRoutingMode : & bird }
1452+ Expect (c .Create (ctx , cr )).NotTo (HaveOccurred ())
1453+ _ , err := r .Reconcile (ctx , reconcile.Request {})
1454+ Expect (err ).ShouldNot (HaveOccurred ())
1455+
1456+ fc := & v3.FelixConfiguration {}
1457+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, fc )
1458+ Expect (err ).ShouldNot (HaveOccurred ())
1459+ Expect (fc .Spec .ProgramClusterRoutes ).NotTo (BeNil ())
1460+ Expect (* fc .Spec .ProgramClusterRoutes ).To (Equal ("Disabled" ))
1461+
1462+ bgpConfig := & v3.BGPConfiguration {}
1463+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, bgpConfig )
1464+ Expect (err ).ShouldNot (HaveOccurred ())
1465+ Expect (bgpConfig .Spec .ProgramClusterRoutes ).NotTo (BeNil ())
1466+ Expect (* bgpConfig .Spec .ProgramClusterRoutes ).To (Equal ("Enabled" ))
1467+ })
1468+
1469+ It ("should correctly patch FelixConfig and BGPConfig with ClusterRouteMode set to Felix" , func () {
1470+ felix := operator .ClusterRoutingModeFelix
1471+ cr .Spec .CalicoNetwork = & operator.CalicoNetworkSpec {ClusterRoutingMode : & felix }
1472+ Expect (c .Create (ctx , cr )).NotTo (HaveOccurred ())
1473+ _ , err := r .Reconcile (ctx , reconcile.Request {})
1474+ Expect (err ).ShouldNot (HaveOccurred ())
1475+
1476+ fc := & v3.FelixConfiguration {}
1477+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, fc )
1478+ Expect (err ).ShouldNot (HaveOccurred ())
1479+ Expect (fc .Spec .ProgramClusterRoutes ).NotTo (BeNil ())
1480+ Expect (* fc .Spec .ProgramClusterRoutes ).To (Equal ("Enabled" ))
1481+
1482+ bgpConfig := & v3.BGPConfiguration {}
1483+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, bgpConfig )
1484+ Expect (err ).ShouldNot (HaveOccurred ())
1485+ Expect (bgpConfig .Spec .ProgramClusterRoutes ).NotTo (BeNil ())
1486+ Expect (* bgpConfig .Spec .ProgramClusterRoutes ).To (Equal ("Disabled" ))
1487+ })
1488+
1489+ It ("should create the default BGPConfig and FelixConfig with ClusterRoutingMode set" , func () {
1490+ bgpConfig := & v3.BGPConfiguration {}
1491+ err := c .Get (ctx , types.NamespacedName {Name : "default" }, bgpConfig )
1492+ Expect (err ).Should (HaveOccurred ())
1493+
1494+ fc := & v3.FelixConfiguration {}
1495+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, fc )
1496+ Expect (err ).Should (HaveOccurred ())
1497+
1498+ felix := operator .ClusterRoutingModeFelix
1499+ cr .Spec .CalicoNetwork = & operator.CalicoNetworkSpec {ClusterRoutingMode : & felix }
1500+ Expect (c .Create (ctx , cr )).NotTo (HaveOccurred ())
1501+ _ , err = r .Reconcile (ctx , reconcile.Request {})
1502+ Expect (err ).ShouldNot (HaveOccurred ())
1503+
1504+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, fc )
1505+ Expect (err ).ShouldNot (HaveOccurred ())
1506+ Expect (fc .Spec .ProgramClusterRoutes ).NotTo (BeNil ())
1507+ Expect (* fc .Spec .ProgramClusterRoutes ).To (Equal ("Enabled" ))
1508+
1509+ bgpConfig = & v3.BGPConfiguration {}
1510+ err = c .Get (ctx , types.NamespacedName {Name : "default" }, bgpConfig )
1511+ Expect (err ).ShouldNot (HaveOccurred ())
1512+ Expect (bgpConfig .Spec .ProgramClusterRoutes ).NotTo (BeNil ())
1513+ Expect (* bgpConfig .Spec .ProgramClusterRoutes ).To (Equal ("Disabled" ))
1514+ })
1515+
14301516 It ("should set vxlanVNI to 10000 when provider is DockerEE" , func () {
14311517 cr .Spec .KubernetesProvider = operator .ProviderDockerEE
14321518 Expect (c .Create (ctx , cr )).NotTo (HaveOccurred ())
0 commit comments