@@ -1822,27 +1822,57 @@ var _ = Describe("OpenStackOperator controller", func() {
18221822 th .DeleteInstance ,
18231823 CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
18241824 )
1825+
1826+ Eventually (func (g Gomega ) {
1827+ keystoneAPI := keystone .GetKeystoneAPI (names .KeystoneAPIName )
1828+ g .Expect (keystoneAPI ).Should (Not (BeNil ()))
1829+ }, timeout , interval ).Should (Succeed ())
1830+ keystone .SimulateKeystoneAPIReady (names .KeystoneAPIName )
1831+
1832+ Eventually (func (g Gomega ) {
1833+ osversion := GetOpenStackVersion (names .OpenStackControlplaneName )
1834+ g .Expect (osversion ).Should (Not (BeNil ()))
1835+
1836+ th .ExpectCondition (
1837+ names .OpenStackVersionName ,
1838+ ConditionGetterFunc (OpenStackVersionConditionGetter ),
1839+ corev1 .OpenStackVersionInitialized ,
1840+ k8s_corev1 .ConditionTrue ,
1841+ )
1842+ }, timeout , interval ).Should (Succeed ())
1843+
1844+ th .CreateSecret (types.NamespacedName {Name : "openstack-config-secret" , Namespace : namespace }, map [string ][]byte {"secure.yaml" : []byte ("foo" )})
1845+ th .CreateConfigMap (types.NamespacedName {Name : "openstack-config" , Namespace : namespace }, map [string ]interface {}{"clouds.yaml" : string ("foo" ), "OS_CLOUD" : "default" })
18251846 })
18261847
1827- It ("should set the galera nodeSelector" , func () {
1848+ It ("sets nodeSelector in resource specs" , func () {
1849+ Eventually (func (g Gomega ) {
1850+ osc := th .GetPod (names .OpenStackClientName )
1851+ g .Expect (osc .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1852+ }, timeout , interval ).Should (Succeed ())
18281853 Eventually (func (g Gomega ) {
18291854 db := mariadb .GetGalera (names .DBName )
18301855 g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
18311856 }, timeout , interval ).Should (Succeed ())
18321857 Eventually (func (g Gomega ) {
1833- db := mariadb . GetGalera (names .DBCell1Name )
1834- g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1858+ rmq := GetRabbitMQCluster (names .RabbitMQName )
1859+ g .Expect (rmq . Spec . Override . StatefulSet . Spec . Template .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
18351860 }, timeout , interval ).Should (Succeed ())
1861+
18361862 })
18371863
1838- It ("should update the galera nodeSelector" , func () {
1864+ It ("updates nodeSelector in resource specs when changed" , func () {
1865+ Eventually (func (g Gomega ) {
1866+ osc := th .GetPod (names .OpenStackClientName )
1867+ g .Expect (osc .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1868+ }, timeout , interval ).Should (Succeed ())
18391869 Eventually (func (g Gomega ) {
18401870 db := mariadb .GetGalera (names .DBName )
18411871 g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
18421872 }, timeout , interval ).Should (Succeed ())
18431873 Eventually (func (g Gomega ) {
1844- db := mariadb . GetGalera (names .DBCell1Name )
1845- g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1874+ rmq := GetRabbitMQCluster (names .RabbitMQName )
1875+ g .Expect (rmq . Spec . Override . StatefulSet . Spec . Template .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
18461876 }, timeout , interval ).Should (Succeed ())
18471877
18481878 Eventually (func (g Gomega ) {
@@ -1854,55 +1884,126 @@ var _ = Describe("OpenStackOperator controller", func() {
18541884 g .Expect (k8sClient .Update (ctx , OSCtlplane )).Should (Succeed ())
18551885 }, timeout , interval ).Should (Succeed ())
18561886
1887+ Eventually (func (g Gomega ) {
1888+ osc := th .GetPod (names .OpenStackClientName )
1889+ g .Expect (osc .Spec .NodeSelector ).To (Equal (map [string ]string {"foo2" : "bar2" }))
1890+ }, timeout , interval ).Should (Succeed ())
18571891 Eventually (func (g Gomega ) {
18581892 db := mariadb .GetGalera (names .DBName )
18591893 g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo2" : "bar2" }))
18601894 }, timeout , interval ).Should (Succeed ())
18611895 Eventually (func (g Gomega ) {
1862- db := mariadb . GetGalera (names .DBCell1Name )
1863- g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo2" : "bar2" }))
1896+ rmq := GetRabbitMQCluster (names .RabbitMQName )
1897+ g .Expect (rmq . Spec . Override . StatefulSet . Spec . Template .Spec .NodeSelector ).To (Equal (map [string ]string {"foo2" : "bar2" }))
18641898 }, timeout , interval ).Should (Succeed ())
18651899 })
18661900
1867- It ("should allow the galera nodeSelector to be overridden" , func () {
1901+ It ("allows nodeSelector service override" , func () {
1902+ Eventually (func (g Gomega ) {
1903+ osc := th .GetPod (names .OpenStackClientName )
1904+ g .Expect (osc .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1905+ }, timeout , interval ).Should (Succeed ())
18681906 Eventually (func (g Gomega ) {
18691907 db := mariadb .GetGalera (names .DBName )
18701908 g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
18711909 }, timeout , interval ).Should (Succeed ())
18721910 Eventually (func (g Gomega ) {
1873- db := mariadb . GetGalera (names .DBCell1Name )
1874- g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1911+ rmq := GetRabbitMQCluster (names .RabbitMQName )
1912+ g .Expect (rmq . Spec . Override . StatefulSet . Spec . Template .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
18751913 }, timeout , interval ).Should (Succeed ())
18761914
18771915 Eventually (func (g Gomega ) {
18781916 OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
18791917
1880- newNodeSelector := map [string ]string {
1881- "foo2" : "bar2" ,
1918+ oscNodeSelector := map [string ]string {
1919+ "foo" : "osc" ,
1920+ }
1921+ OSCtlplane .Spec .OpenStackClient .Template .NodeSelector = & oscNodeSelector
1922+
1923+ galeraNodeSelector := map [string ]string {
1924+ "foo" : "galera" ,
18821925 }
18831926 galeraTemplates := * (OSCtlplane .Spec .Galera .Templates )
18841927 dbTemplate := galeraTemplates [names .DBName .Name ]
1885- dbTemplate .NodeSelector = & newNodeSelector
1928+ dbTemplate .NodeSelector = & galeraNodeSelector
18861929 galeraTemplates [names .DBName .Name ] = dbTemplate
1930+ OSCtlplane .Spec .Galera .Templates = & galeraTemplates
1931+
1932+ rmqNodeSelector := map [string ]string {
1933+ "foo" : "rmq" ,
1934+ }
1935+ rmqTemplates := * OSCtlplane .Spec .Rabbitmq .Templates
1936+ rmqTemplate := rmqTemplates [names .RabbitMQName .Name ]
1937+ rmqTemplate .NodeSelector = & rmqNodeSelector
1938+ rmqTemplates [names .RabbitMQName .Name ] = rmqTemplate
1939+ OSCtlplane .Spec .Rabbitmq .Templates = & rmqTemplates
18871940
1888- emptyNodeSelector := map [string ]string {}
1889- cell1Template := galeraTemplates [names .DBCell1Name .Name ]
1890- cell1Template .NodeSelector = & emptyNodeSelector
1891- galeraTemplates [names .DBCell1Name .Name ] = cell1Template
1941+ g .Expect (k8sClient .Update (ctx , OSCtlplane )).Should (Succeed ())
1942+ }, timeout , interval ).Should (Succeed ())
1943+
1944+ Eventually (func (g Gomega ) {
1945+ osc := th .GetPod (names .OpenStackClientName )
1946+ g .Expect (osc .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "osc" }))
1947+ }, timeout , interval ).Should (Succeed ())
1948+ Eventually (func (g Gomega ) {
1949+ db := mariadb .GetGalera (names .DBName )
1950+ g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "galera" }))
1951+ }, timeout , interval ).Should (Succeed ())
1952+ Eventually (func (g Gomega ) {
1953+ rmq := GetRabbitMQCluster (names .RabbitMQName )
1954+ g .Expect (rmq .Spec .Override .StatefulSet .Spec .Template .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "rmq" }))
1955+ }, timeout , interval ).Should (Succeed ())
1956+ })
18921957
1958+ It ("allows nodeSelector service override to empty" , func () {
1959+ Eventually (func (g Gomega ) {
1960+ osc := th .GetPod (names .OpenStackClientName )
1961+ g .Expect (osc .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1962+ }, timeout , interval ).Should (Succeed ())
1963+ Eventually (func (g Gomega ) {
1964+ db := mariadb .GetGalera (names .DBName )
1965+ g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1966+ }, timeout , interval ).Should (Succeed ())
1967+ Eventually (func (g Gomega ) {
1968+ rmq := GetRabbitMQCluster (names .RabbitMQName )
1969+ g .Expect (rmq .Spec .Override .StatefulSet .Spec .Template .Spec .NodeSelector ).To (Equal (map [string ]string {"foo" : "bar" }))
1970+ }, timeout , interval ).Should (Succeed ())
1971+
1972+ Eventually (func (g Gomega ) {
1973+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1974+
1975+ oscNodeSelector := map [string ]string {}
1976+ OSCtlplane .Spec .OpenStackClient .Template .NodeSelector = & oscNodeSelector
1977+
1978+ galeraNodeSelector := map [string ]string {}
1979+ galeraTemplates := * (OSCtlplane .Spec .Galera .Templates )
1980+ dbTemplate := galeraTemplates [names .DBName .Name ]
1981+ dbTemplate .NodeSelector = & galeraNodeSelector
1982+ galeraTemplates [names .DBName .Name ] = dbTemplate
18931983 OSCtlplane .Spec .Galera .Templates = & galeraTemplates
18941984
1985+ rmqNodeSelector := map [string ]string {}
1986+ rmqTemplates := * OSCtlplane .Spec .Rabbitmq .Templates
1987+ rmqTemplate := rmqTemplates [names .RabbitMQName .Name ]
1988+ rmqTemplate .NodeSelector = & rmqNodeSelector
1989+ rmqTemplates [names .RabbitMQName .Name ] = rmqTemplate
1990+ OSCtlplane .Spec .Rabbitmq .Templates = & rmqTemplates
1991+
18951992 g .Expect (k8sClient .Update (ctx , OSCtlplane )).Should (Succeed ())
18961993 }, timeout , interval ).Should (Succeed ())
18971994
18981995 Eventually (func (g Gomega ) {
1899- db := mariadb . GetGalera (names .DBName )
1900- g .Expect (* db .Spec .NodeSelector ).To (Equal ( map [ string ] string { "foo2" : "bar2" } ))
1996+ osc := th . GetPod (names .OpenStackClientName )
1997+ g .Expect (osc .Spec .NodeSelector ).To (BeNil ( ))
19011998 }, timeout , interval ).Should (Succeed ())
19021999 Eventually (func (g Gomega ) {
1903- db := mariadb .GetGalera (names .DBCell1Name )
2000+ db := mariadb .GetGalera (names .DBName )
19042001 g .Expect (* db .Spec .NodeSelector ).To (Equal (map [string ]string {}))
19052002 }, timeout , interval ).Should (Succeed ())
2003+ Eventually (func (g Gomega ) {
2004+ rmq := GetRabbitMQCluster (names .RabbitMQName )
2005+ g .Expect (rmq .Spec .Override .StatefulSet .Spec .Template .Spec .NodeSelector ).To (BeNil ())
2006+ }, timeout , interval ).Should (Succeed ())
19062007 })
19072008 })
19082009
0 commit comments