@@ -30,6 +30,7 @@ import (
3030
3131 k8s_corev1 "k8s.io/api/core/v1"
3232 k8s_errors "k8s.io/apimachinery/pkg/api/errors"
33+
3334 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3435 "k8s.io/apimachinery/pkg/types"
3536 "k8s.io/utils/ptr"
@@ -40,17 +41,20 @@ import (
4041 cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1"
4142 rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
4243 topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
44+
4345 "github.com/openstack-k8s-operators/lib-common/modules/certmanager"
4446 "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
4547 "github.com/openstack-k8s-operators/lib-common/modules/common/service"
4648 "github.com/openstack-k8s-operators/lib-common/modules/common/tls"
4749 manilav1 "github.com/openstack-k8s-operators/manila-operator/api/v1beta1"
50+ novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1"
4851 clientv1 "github.com/openstack-k8s-operators/openstack-operator/apis/client/v1beta1"
4952 corev1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1"
5053 ovnv1 "github.com/openstack-k8s-operators/ovn-operator/api/v1beta1"
54+ placementv1 "github.com/openstack-k8s-operators/placement-operator/api/v1beta1"
5155)
5256
53- var _ = Describe ("OpenStackOperator controller" , func () {
57+ var _ = Describe ("OpenStackOperator controller" , Focus , func () {
5458 BeforeEach (func () {
5559 // lib-common uses OPERATOR_TEMPLATES env var to locate the "templates"
5660 // directory of the operator. We need to set them othervise lib-common
@@ -1810,76 +1814,153 @@ var _ = Describe("OpenStackOperator controller", func() {
18101814 })
18111815 })
18121816
1813- When ("A OpenStackControlplane instance is created with top-scope notifications config pushed down" , func () {
1817+ When ("A OpenStackControlplane instance is created with top-scope notifications config pushed down" , Focus , func () {
18141818 BeforeEach (func () {
1815- spec := GetDefaultOpenStackControlPlaneSpec ()
1816- spec ["notificationsBus" ] = map [string ]interface {}{
1817- "rabbitMqClusterName" : ptr .To ("rabbitmq-notifications" ),
1818- }
1819- spec ["nova" ] = map [string ]interface {}{
1820- "enabled" : false ,
1821- "template" : map [string ]interface {}{},
1822- }
1823- DeferCleanup (
1824- th .DeleteInstance ,
1825- CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
1826- )
1827- })
1819+ // NOTE(bogdando): DBs certs need to be created here as well, but those are leaking from the other non-isolated tests
1820+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCertName ))
1821+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQNotificationsCertName ))
1822+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCell1CertName ))
1823+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .MemcachedCertName ))
1824+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .OVNNorthdCertName ))
1825+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .OVNControllerCertName ))
1826+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .NeutronOVNCertName ))
18281827
1829- It ("should have Nova notifications bus instance configured by inheritance" , func () {
1830- OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1831- Expect (* OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (ContainSubstring ("rabbitmq-notifications" ))
1832- })
1833- })
1828+ DeferCleanup (k8sClient .Delete , ctx ,
1829+ th .CreateSecret (types.NamespacedName {Name : "openstack-config-secret" , Namespace : namespace }, map [string ][]byte {"secure.yaml" : []byte ("foo" )}))
1830+ DeferCleanup (k8sClient .Delete , ctx ,
1831+ th .CreateConfigMap (types.NamespacedName {Name : "openstack-config" , Namespace : namespace }, map [string ]interface {}{"clouds.yaml" : string ("foo" ), "OS_CLOUD" : "default" }))
18341832
1835- When ("A OpenStackControlplane instance is created with notifications config override" , func () {
1836- BeforeEach (func () {
18371833 spec := GetDefaultOpenStackControlPlaneSpec ()
1838- spec ["notificationsBus" ] = map [string ]interface {}{
1839- "rabbitMqClusterName" : ptr .To ("rabbitmq-notifications-top-scope" ),
1840- }
18411834 spec ["nova" ] = map [string ]interface {}{
1835+ "enabled" : true ,
1836+ }
1837+ // turn off unrelated to this test case services
1838+ spec ["horizon" ] = map [string ]interface {}{
18421839 "enabled" : false ,
1843- "template" : map [string ]interface {}{
1844- "notificationsBusInstance" : ptr .To ("rabbitmq-custom" ),
1845- },
18461840 }
1847- DeferCleanup (
1848- th .DeleteInstance ,
1849- CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
1850- )
1851- })
1852-
1853- It ("should have Nova notifications bus instance configured from local templates" , func () {
1854- OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1855- Expect (* OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (Equal ("rabbitmq-custom" ))
1856- })
1857- })
1858-
1859- When ("A OpenStackControlplane instance is created with notifications config force-disabled" , func () {
1860- BeforeEach (func () {
1861- spec := GetDefaultOpenStackControlPlaneSpec ()
1862- spec ["notificationsBus" ] = map [string ]interface {}{
1863- "rabbitMqClusterName" : ptr .To ("" ),
1841+ spec ["cinder" ] = map [string ]interface {}{
1842+ "enabled" : false ,
18641843 }
1865- spec ["nova " ] = map [string ]interface {}{
1844+ spec ["swift " ] = map [string ]interface {}{
18661845 "enabled" : false ,
1867- "template" : map [string ]interface {}{
1868- "notificationsBusInstance" : ptr .To ("rabbitmq-maybe" ),
1869- },
18701846 }
1847+ spec ["redis" ] = map [string ]interface {}{
1848+ "enabled" : false ,
1849+ }
1850+ spec ["ironic" ] = map [string ]interface {}{
1851+ "enabled" : false ,
1852+ }
1853+ spec ["designate" ] = map [string ]interface {}{
1854+ "enabled" : false ,
1855+ }
1856+ spec ["barbican" ] = map [string ]interface {}{
1857+ "enabled" : false ,
1858+ }
1859+ spec ["manila" ] = map [string ]interface {}{
1860+ "enabled" : false ,
1861+ }
1862+ spec ["heat" ] = map [string ]interface {}{
1863+ "enabled" : false ,
1864+ }
1865+ spec ["telemetry" ] = map [string ]interface {}{
1866+ "enabled" : false ,
1867+ }
1868+ // spec["watcher"] = map[string]interface{}{
1869+ // "enabled": false,
1870+ // }
1871+
18711872 DeferCleanup (
18721873 th .DeleteInstance ,
18731874 CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
18741875 )
1876+ SimulateControlplaneReady ()
1877+
1878+ // enable Nova with dependencies, disable TLS
1879+ Eventually (func (g Gomega ) {
1880+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1881+ OSCtlplane .Spec .TLS .PodLevel .Enabled = false
1882+ OSCtlplane .Spec .Keystone .Enabled = true
1883+ OSCtlplane .Spec .Glance .Enabled = true
1884+ OSCtlplane .Spec .Neutron .Enabled = true
1885+ OSCtlplane .Spec .Placement .Enabled = true
1886+ OSCtlplane .Spec .NotificationsBus .RabbitMqClusterName = ptr .To ("rabbitmq-notifications" )
1887+ OSCtlplane .Spec .Placement .Template = & placementv1.PlacementAPISpecCore {}
1888+ OSCtlplane .Spec .Placement .Template .APITimeout = 60
1889+ OSCtlplane .Spec .Nova .Enabled = true
1890+ OSCtlplane .Spec .Nova .Template = & novav1.NovaSpecCore {}
1891+ OSCtlplane .Spec .Nova .Template .APITimeout = 60
1892+ OSCtlplane .Spec .Nova .Template .NotificationsBusInstance = nil
1893+ g .Expect (k8sClient .Update (ctx , OSCtlplane )).Should (Succeed ())
1894+ }, timeout , interval ).Should (Succeed ())
1895+
1896+ Eventually (func (g Gomega ) {
1897+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1898+ OSCtlplane .Status .ObservedGeneration = OSCtlplane .Generation
1899+ OSCtlplane .Status .Conditions .MarkTrue (corev1 .OpenStackControlPlaneMemcachedReadyCondition , "Ready" )
1900+ OSCtlplane .Status .Conditions .MarkTrue (corev1 .OpenStackControlPlaneRabbitMQReadyCondition , "Ready" )
1901+ OSCtlplane .Status .Conditions .MarkTrue (corev1 .OpenStackControlPlaneNeutronReadyCondition , "Ready" )
1902+ OSCtlplane .Status .Conditions .MarkTrue (corev1 .OpenStackControlPlaneGlanceReadyCondition , "Ready" )
1903+ OSCtlplane .Status .Conditions .MarkTrue (corev1 .OpenStackControlPlanePlacementAPIReadyCondition , "Ready" )
1904+ OSCtlplane .Status .Conditions .MarkTrue (corev1 .OpenStackControlPlaneNovaReadyCondition , "Ready" )
1905+ g .Expect (k8sClient .Update (ctx , OSCtlplane )).Should (Succeed ())
1906+ th .Logger .Info ("Simulated nova and its dependencies ready" , "on" , names .OpenStackControlplaneName )
1907+ }, timeout , interval ).Should (Succeed ())
18751908 })
18761909
1877- It ("should have Nova enabled and its notifications bus instance configured for a special empty value" , func () {
1910+ It ("should have nova and deps enabled with nova notifications bus instance configured by inheritance" , Focus , func () {
18781911 OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1879- Expect (* OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (Equal ("" ))
1912+ Expect (OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (Equal ("rabbitmq-notifications " ))
18801913 })
18811914 })
18821915
1916+ // When("A OpenStackControlplane instance is created with notifications config override", func() {
1917+ // BeforeEach(func() {
1918+ // spec := GetDefaultOpenStackControlPlaneSpec()
1919+ // spec["notificationsBus"] = map[string]interface{}{
1920+ // "rabbitMqClusterName": ptr.To("rabbitmq-notifications-top-scope"),
1921+ // }
1922+ // spec["nova"] = map[string]interface{}{
1923+ // "enabled": false,
1924+ // "template": map[string]interface{}{
1925+ // "notificationsBusInstance": ptr.To("rabbitmq-custom"),
1926+ // },
1927+ // }
1928+ // DeferCleanup(
1929+ // th.DeleteInstance,
1930+ // CreateOpenStackControlPlane(names.OpenStackControlplaneName, spec),
1931+ // )
1932+ // })
1933+
1934+ // It("should have Nova notifications bus instance configured from local templates", func() {
1935+ // OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName)
1936+ // Expect(*OSCtlplane.Spec.Nova.Template.NotificationsBusInstance).Should(Equal("rabbitmq-custom"))
1937+ // })
1938+ // })
1939+
1940+ // When("A OpenStackControlplane instance is created with notifications config force-disabled", func() {
1941+ // BeforeEach(func() {
1942+ // spec := GetDefaultOpenStackControlPlaneSpec()
1943+ // spec["notificationsBus"] = map[string]interface{}{
1944+ // "rabbitMqClusterName": ptr.To(""),
1945+ // }
1946+ // spec["nova"] = map[string]interface{}{
1947+ // "enabled": false,
1948+ // "template": map[string]interface{}{
1949+ // "notificationsBusInstance": ptr.To("rabbitmq-maybe"),
1950+ // },
1951+ // }
1952+ // DeferCleanup(
1953+ // th.DeleteInstance,
1954+ // CreateOpenStackControlPlane(names.OpenStackControlplaneName, spec),
1955+ // )
1956+ // })
1957+
1958+ // It("should have Nova enabled and its notifications bus instance configured for a special empty value", func() {
1959+ // OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName)
1960+ // Expect(*OSCtlplane.Spec.Nova.Template.NotificationsBusInstance).Should(Equal(""))
1961+ // })
1962+ // })
1963+
18831964 When ("OpenStackControlplane instance is deleted" , func () {
18841965 BeforeEach (func () {
18851966 DeferCleanup (
0 commit comments