@@ -1620,6 +1620,11 @@ var _ = Describe("OpenStackOperator controller", func() {
16201620 "dbType" : "SB" ,
16211621 },
16221622 },
1623+ "ovnController" : map [string ]interface {}{
1624+ "nicMappings" : map [string ]interface {}{
1625+ "datacentre" : "ospbr" ,
1626+ },
1627+ },
16231628 },
16241629 }
16251630 DeferCleanup (
@@ -1670,6 +1675,37 @@ var _ = Describe("OpenStackOperator controller", func() {
16701675 }, timeout , interval ).Should (Succeed ())
16711676 })
16721677
1678+ It ("should remove ovn-controller if nicMappings are removed" , func () {
1679+ // Update spec
1680+ Eventually (func (g Gomega ) {
1681+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1682+ OSCtlplane .Spec .Ovn .Template .OVNController .NicMappings = nil
1683+ g .Expect (k8sClient .Update (ctx , OSCtlplane )).Should (Succeed ())
1684+ }, timeout , interval ).Should (Succeed ())
1685+
1686+ // ovn services exist
1687+ Eventually (func (g Gomega ) {
1688+ ovnNorthd := ovn .GetOVNNorthd (names .OVNNorthdName )
1689+ g .Expect (ovnNorthd ).Should (Not (BeNil ()))
1690+ }, timeout , interval ).Should (Succeed ())
1691+
1692+ // If nicMappings are not configured, ovnController shouldn't spawn
1693+ Eventually (func (g Gomega ) {
1694+ instance := & ovnv1.OVNController {}
1695+ g .Expect (th .K8sClient .Get (th .Ctx , names .OVNControllerName , instance )).Should (Not (Succeed ()))
1696+ }, timeout , interval ).Should (Succeed ())
1697+
1698+ Eventually (func (g Gomega ) {
1699+ ovnDbServerNB := ovn .GetOVNDBCluster (names .OVNDbServerNBName )
1700+ g .Expect (ovnDbServerNB ).Should (Not (BeNil ()))
1701+ }, timeout , interval ).Should (Succeed ())
1702+
1703+ Eventually (func (g Gomega ) {
1704+ ovnDbServerSB := ovn .GetOVNDBCluster (names .OVNDbServerSBName )
1705+ g .Expect (ovnDbServerSB ).Should (Not (BeNil ()))
1706+ }, timeout , interval ).Should (Succeed ())
1707+ })
1708+
16731709 It ("should remove OVN resources on disable" , func () {
16741710 Eventually (func (g Gomega ) {
16751711 OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
0 commit comments