@@ -30,6 +30,8 @@ import (
3030
3131 k8s_corev1 "k8s.io/api/core/v1"
3232 k8s_errors "k8s.io/apimachinery/pkg/api/errors"
33+
34+ //metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3335 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3436 "k8s.io/apimachinery/pkg/types"
3537 "k8s.io/utils/ptr"
@@ -40,11 +42,14 @@ import (
4042 cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1"
4143 rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
4244 topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
45+
46+ //keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
4347 "github.com/openstack-k8s-operators/lib-common/modules/certmanager"
4448 "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
4549 "github.com/openstack-k8s-operators/lib-common/modules/common/service"
4650 "github.com/openstack-k8s-operators/lib-common/modules/common/tls"
4751 manilav1 "github.com/openstack-k8s-operators/manila-operator/api/v1beta1"
52+ novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1"
4853 clientv1 "github.com/openstack-k8s-operators/openstack-operator/apis/client/v1beta1"
4954 corev1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1"
5055 ovnv1 "github.com/openstack-k8s-operators/ovn-operator/api/v1beta1"
@@ -1812,74 +1817,144 @@ var _ = Describe("OpenStackOperator controller", func() {
18121817
18131818 When ("A OpenStackControlplane instance is created with top-scope notifications config pushed down" , func () {
18141819 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- })
1820+ // // ?keystone exists
1821+ // keystoneAPI := &keystonev1.KeystoneAPI{
1822+ // TypeMeta: metav1.TypeMeta{
1823+ // APIVersion: "keystone.openstack.org/v1beta1",
1824+ // Kind: "KeystoneAPI",
1825+ // },
1826+ // ObjectMeta: metav1.ObjectMeta{
1827+ // Name: names.KeystoneAPIName.Name,
1828+ // Namespace: names.KeystoneAPIName.Namespace,
1829+ // },
1830+ // Spec: keystonev1.KeystoneAPISpec{
1831+ // KeystoneAPISpecCore: keystonev1.KeystoneAPISpecCore{
1832+ // APITimeout: 60,
1833+ // },
1834+ // },
1835+ // }
1836+ // gomega.Expect(th.K8sClient.Create(th.Ctx, keystoneAPI.DeepCopy())).Should(gomega.Succeed())
1837+ // DeferCleanup(k8sClient.Delete, ctx, keystoneAPI)
18281838
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- })
1839+ Eventually (func (g Gomega ) {
1840+ keystoneAPI := keystone .GetKeystoneAPI (names .KeystoneAPIName )
1841+ g .Expect (keystoneAPI ).Should (Not (BeNil ()))
1842+ }, timeout , interval ).Should (Succeed ())
1843+ // make keystoneAPI ready and create secrets usually created by keystone-controller
1844+ keystone .SimulateKeystoneAPIReady (names .KeystoneAPIName )
18341845
1835- When ("A OpenStackControlplane instance is created with notifications config override" , func () {
1836- BeforeEach (func () {
1837- spec := GetDefaultOpenStackControlPlaneSpec ()
1838- spec ["notificationsBus" ] = map [string ]interface {}{
1839- "rabbitMqClusterName" : ptr .To ("rabbitmq-notifications-top-scope" ),
1840- }
1841- spec ["nova" ] = map [string ]interface {}{
1842- "enabled" : false ,
1843- "template" : map [string ]interface {}{
1844- "notificationsBusInstance" : ptr .To ("rabbitmq-custom" ),
1845- },
1846- }
1847- DeferCleanup (
1848- th .DeleteInstance ,
1849- CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
1850- )
1851- })
1846+ // openstackversion exists
1847+ // Eventually(func(g Gomega) {
1848+ // osversion := GetOpenStackVersion(names.OpenStackControlplaneName)
1849+ // g.Expect(osversion).Should(Not(BeNil()))
1850+
1851+ // th.ExpectCondition(
1852+ // names.OpenStackVersionName,
1853+ // ConditionGetterFunc(OpenStackVersionConditionGetter),
1854+ // corev1.OpenStackVersionInitialized,
1855+ // k8s_corev1.ConditionTrue,
1856+ // )
1857+ // }, timeout, interval).Should(Succeed())
18521858
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- })
1859+ th .CreateSecret (types.NamespacedName {Name : "openstack-config-secret" , Namespace : namespace }, map [string ][]byte {"secure.yaml" : []byte ("foo" )})
1860+ th .CreateConfigMap (types.NamespacedName {Name : "openstack-config" , Namespace : namespace }, map [string ]interface {}{"clouds.yaml" : string ("foo" ), "OS_CLOUD" : "default" })
18581861
1859- When ("A OpenStackControlplane instance is created with notifications config force-disabled" , func () {
1860- BeforeEach (func () {
18611862 spec := GetDefaultOpenStackControlPlaneSpec ()
1862- spec ["notificationsBus " ] = map [string ]interface {}{
1863- "rabbitMqClusterName " : ptr . To ( "" ) ,
1863+ spec ["placement " ] = map [string ]interface {}{
1864+ "enabled " : true ,
18641865 }
18651866 spec ["nova" ] = map [string ]interface {}{
1866- "enabled" : false ,
1867+ "enabled" : true ,
1868+ "apiOverride" : map [string ]interface {}{"route" : map [string ]interface {}{}},
18671869 "template" : map [string ]interface {}{
1868- "notificationsBusInstance " : ptr . To ( "rabbitmq-maybe" ) ,
1870+ "secret " : "osp-secret" ,
18691871 },
18701872 }
1871- DeferCleanup (
1872- th .DeleteInstance ,
1873- CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
1874- )
18751873 })
18761874
1877- It ("should have Nova enabled and its notifications bus instance configured for a special empty value " , func () {
1875+ It ("should have nova and deps enabled with nova notifications bus instance configured by inheritance " , func () {
18781876 OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1879- Expect (* OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (Equal ("" ))
1877+ Expect (OSCtlplane .Spec .Nova .Enabled ).Should (BeTrue ())
1878+ Expect (OSCtlplane .Spec .Galera .Enabled ).Should (BeTrue ())
1879+ Expect (OSCtlplane .Spec .Rabbitmq .Enabled ).Should (BeTrue ())
1880+ Expect (OSCtlplane .Spec .Memcached .Enabled ).Should (BeTrue ())
1881+ Expect (OSCtlplane .Spec .Keystone .Enabled ).Should (BeTrue ())
1882+ Expect (OSCtlplane .Spec .Placement .Enabled ).Should (BeTrue ())
1883+ Expect (OSCtlplane .Spec .Glance .Enabled ).Should (BeTrue ())
1884+ Expect (OSCtlplane .Spec .Neutron .Enabled ).Should (BeTrue ())
1885+
1886+ nova := & novav1.Nova {}
1887+ Eventually (func (g Gomega ) {
1888+ g .Expect (k8sClient .Get (ctx , names .NovaName , nova )).Should (Succeed ())
1889+ g .Expect (nova ).ShouldNot (BeNil ())
1890+ nova .Status .ObservedGeneration = nova .Generation
1891+ nova .Status .Conditions .MarkTrue (novav1 .NovaAPIReadyCondition , "Ready" )
1892+ g .Expect (th .K8sClient .Status ().Update (th .Ctx , nova )).To (Succeed ())
1893+ th .Logger .Info ("Simulated nova ready" , "on" , names .CinderName )
1894+ }, timeout , interval ).Should (Succeed ())
1895+
1896+ // expect the ready status to propagate to control plane object
1897+ Eventually (func (_ Gomega ) {
1898+ th .ExpectCondition (
1899+ names .OpenStackControlplaneName ,
1900+ ConditionGetterFunc (OpenStackControlPlaneConditionGetter ),
1901+ corev1 .OpenStackControlPlaneNovaReadyCondition ,
1902+ k8s_corev1 .ConditionTrue ,
1903+ )
1904+ }, timeout , interval ).Should (Succeed ())
1905+
1906+ Expect (* OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (Equal ("rabbitmq-notifications" ))
18801907 })
18811908 })
18821909
1910+ // When("A OpenStackControlplane instance is created with notifications config override", func() {
1911+ // BeforeEach(func() {
1912+ // spec := GetDefaultOpenStackControlPlaneSpec()
1913+ // spec["notificationsBus"] = map[string]interface{}{
1914+ // "rabbitMqClusterName": ptr.To("rabbitmq-notifications-top-scope"),
1915+ // }
1916+ // spec["nova"] = map[string]interface{}{
1917+ // "enabled": false,
1918+ // "template": map[string]interface{}{
1919+ // "notificationsBusInstance": ptr.To("rabbitmq-custom"),
1920+ // },
1921+ // }
1922+ // DeferCleanup(
1923+ // th.DeleteInstance,
1924+ // CreateOpenStackControlPlane(names.OpenStackControlplaneName, spec),
1925+ // )
1926+ // })
1927+
1928+ // It("should have Nova notifications bus instance configured from local templates", func() {
1929+ // OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName)
1930+ // Expect(*OSCtlplane.Spec.Nova.Template.NotificationsBusInstance).Should(Equal("rabbitmq-custom"))
1931+ // })
1932+ // })
1933+
1934+ // When("A OpenStackControlplane instance is created with notifications config force-disabled", func() {
1935+ // BeforeEach(func() {
1936+ // spec := GetDefaultOpenStackControlPlaneSpec()
1937+ // spec["notificationsBus"] = map[string]interface{}{
1938+ // "rabbitMqClusterName": ptr.To(""),
1939+ // }
1940+ // spec["nova"] = map[string]interface{}{
1941+ // "enabled": false,
1942+ // "template": map[string]interface{}{
1943+ // "notificationsBusInstance": ptr.To("rabbitmq-maybe"),
1944+ // },
1945+ // }
1946+ // DeferCleanup(
1947+ // th.DeleteInstance,
1948+ // CreateOpenStackControlPlane(names.OpenStackControlplaneName, spec),
1949+ // )
1950+ // })
1951+
1952+ // It("should have Nova enabled and its notifications bus instance configured for a special empty value", func() {
1953+ // OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName)
1954+ // Expect(*OSCtlplane.Spec.Nova.Template.NotificationsBusInstance).Should(Equal(""))
1955+ // })
1956+ // })
1957+
18831958 When ("OpenStackControlplane instance is deleted" , func () {
18841959 BeforeEach (func () {
18851960 DeferCleanup (
0 commit comments