diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index 7d630546c..2e422fae9 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -1828,9 +1828,6 @@ spec: type: string transportURLSecret: type: string - required: - - controlNetworkName - - storageRequest type: object designateCentral: properties: @@ -2313,7 +2310,6 @@ spec: - designateBackendbind9 - designateCentral - designateMdns - - designateNetworkAttachment - designateProducer - designateWorker - rabbitMqClusterName diff --git a/apis/go.mod b/apis/go.mod index 5b9740bfb..ea3c1c380 100644 --- a/apis/go.mod +++ b/apis/go.mod @@ -7,11 +7,11 @@ require ( github.com/go-playground/validator/v10 v10.22.1 github.com/onsi/ginkgo/v2 v2.20.1 github.com/onsi/gomega v1.34.1 - github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241114094618-6febb2d8d6a4 - github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241114094619-8cd575ca0e60 - github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241114094900-9ce3c64786da - github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241114111414-1fdd7f486264 - github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241118124230-6202fa6a0fee + github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241120105734-37d5a9b81262 + github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241120063916-9e97663361d3 + github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241120164406-c06a12f2e42c + github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241120062804-89e9fe93e886 + github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241120140156-1c476cfe7c63 github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241119161147-c38568cb3fb0 github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241118112815-d52a058b34a8 github.com/openstack-k8s-operators/ironic-operator/api v0.5.1-0.20241114211630-5b4dcbed9b37 @@ -19,7 +19,7 @@ require ( github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241114091812-6dc9fd0961dc github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.1-0.20241114091812-6dc9fd0961dc github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241117150431-21b7f58d9ddf - github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241106141725-340c4d78fef0 + github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241120160542-4b457715f74e github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241114104932-eae3f8cd032b github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241119125634-42b7b8417b48 github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241115111947-2336829c2d73 diff --git a/apis/go.sum b/apis/go.sum index 65af26406..12db59525 100644 --- a/apis/go.sum +++ b/apis/go.sum @@ -94,16 +94,16 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6Beb1gQ96Ptej9AE/BvwCBiRj1E= github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4= -github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241114094618-6febb2d8d6a4 h1:vMsxll0P87Gzght042PytRTx5c71hlQLhux/peHONmk= -github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241114094618-6febb2d8d6a4/go.mod h1:Xn5DqgDkAT61fI88mBHsMfyzD4xNh0dYcSI90B3Io08= -github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241114094619-8cd575ca0e60 h1:kpojOnJkO8mC962fidyCUDwayju8U9NPkmScYfQ9dxA= -github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241114094619-8cd575ca0e60/go.mod h1:3NvCHOoCyzcZm046XctbsU/Dx+en3l8jG3nHhZyWOAA= -github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241114094900-9ce3c64786da h1:f2jFQsWopZfBoiI4mIlO7RpGRJ+QYYlfQhy9X7f5Bns= -github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241114094900-9ce3c64786da/go.mod h1:JZSzHp6f07mYkRB71xamFIPlgbFKvzIbv68ttwsEt/o= -github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241114111414-1fdd7f486264 h1:gQXtUfjK1Nj2tSBwarVUlJXEWUiYgu2ovMWEtTBvC4Y= -github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241114111414-1fdd7f486264/go.mod h1:bRqpa/WUQ7D99SAOXEPItxBobRP1oVUo93PWQukChIs= -github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241118124230-6202fa6a0fee h1:bQzR5hdF/5KN/HVD73i0vrQSlsdBCg1eOXfKeJtXfTE= -github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241118124230-6202fa6a0fee/go.mod h1:PuXjq4bV3/mYo4OAD/4tTon0N7E9YYXZHWiZLeZFVek= +github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241120105734-37d5a9b81262 h1:mV28IEmhMfUa5SZuPrEu7mV7Z5AzkYHwyxn4oh+sqHg= +github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241120105734-37d5a9b81262/go.mod h1:Xn5DqgDkAT61fI88mBHsMfyzD4xNh0dYcSI90B3Io08= +github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241120063916-9e97663361d3 h1:oIlRFU4i2OTxUC3gH88KdwtihbQbSS6deNUpaqSSC6M= +github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241120063916-9e97663361d3/go.mod h1:3NvCHOoCyzcZm046XctbsU/Dx+en3l8jG3nHhZyWOAA= +github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241120164406-c06a12f2e42c h1:aGUTBPEVTMvmmdOMJRcd8Zh6lvqqb0HWNGy0mZ10BgM= +github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241120164406-c06a12f2e42c/go.mod h1:JZSzHp6f07mYkRB71xamFIPlgbFKvzIbv68ttwsEt/o= +github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241120062804-89e9fe93e886 h1:mlm90ig3R4iznmPFJ3ROgKNkWb3LNcf2lmIET1hEOdA= +github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241120062804-89e9fe93e886/go.mod h1:mzdn8Y/XF/4nP2/Il8fk0n8ZdwIS5EuZms+IbRkqJ4I= +github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241120140156-1c476cfe7c63 h1:j1RGGbbvCkW2X9VHRb4ItNozIEMJpBn5S0gGEgdPNQc= +github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241120140156-1c476cfe7c63/go.mod h1:PuXjq4bV3/mYo4OAD/4tTon0N7E9YYXZHWiZLeZFVek= github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241119161147-c38568cb3fb0 h1:YtC+hqGKx9M8B6fHgA1eFlq1yjEiOWwp1zZqyFtjSbA= github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241119161147-c38568cb3fb0/go.mod h1:ezxV+6xd12IRKespGaDlJCUQ301yxrBlQUCEbeYQgSA= github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241118112815-d52a058b34a8 h1:mmnunGX3tnIT4ErxFjYcKb38VLjnfe9JcIcU9LaW9rE= @@ -120,8 +120,8 @@ github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.1-0.202411140 github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.1-0.20241114091812-6dc9fd0961dc/go.mod h1:tfgBeLRqmlH/NQkLPe7396rj+t0whv2wPuMb8Ttvh8w= github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241117150431-21b7f58d9ddf h1:UsAefjZBqFl0dYMg/efe75ECm8cAwc/2FCEBPYjQfIY= github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241117150431-21b7f58d9ddf/go.mod h1:0/qgnjufYIqe439/3aUU/cwnjDwdUlNR3jnRubLTD5o= -github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241106141725-340c4d78fef0 h1:XrJID4tPlR1JCO7A7MPONGfVRmhgf6ktglmE1v7UlHM= -github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241106141725-340c4d78fef0/go.mod h1:348EPtAdpE2LxHAH4bHdCMNP7HyX6DevwEsF9DQ0S2k= +github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241120160542-4b457715f74e h1:id6qqUWUMo0h7LoIhjQlMIjy4iihoBCi7Pe/jWjKHcY= +github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241120160542-4b457715f74e/go.mod h1:348EPtAdpE2LxHAH4bHdCMNP7HyX6DevwEsF9DQ0S2k= github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241114104932-eae3f8cd032b h1:JMMPYDierS4YZdG9O/50kLihPQqmDz7p72btLy7Ibew= github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241114104932-eae3f8cd032b/go.mod h1:Kfuu3g4PSFpEowdWhbnTgSlDpsBGswQf/WU/kKQKK7s= github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241119125634-42b7b8417b48 h1:eCvn/lCMqWTvlN74nFr7nG2EvZdvJPdSR9Ts2eTaM6c= diff --git a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml index 7d630546c..2e422fae9 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -1828,9 +1828,6 @@ spec: type: string transportURLSecret: type: string - required: - - controlNetworkName - - storageRequest type: object designateCentral: properties: @@ -2313,7 +2310,6 @@ spec: - designateBackendbind9 - designateCentral - designateMdns - - designateNetworkAttachment - designateProducer - designateWorker - rabbitMqClusterName diff --git a/go.mod b/go.mod index 844659c47..f76eeba6a 100644 --- a/go.mod +++ b/go.mod @@ -13,11 +13,11 @@ require ( github.com/onsi/ginkgo/v2 v2.20.1 github.com/onsi/gomega v1.34.1 github.com/openshift/api v3.9.0+incompatible - github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241114094618-6febb2d8d6a4 - github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241114094619-8cd575ca0e60 - github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241114094900-9ce3c64786da - github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241114111414-1fdd7f486264 - github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241118124230-6202fa6a0fee + github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241120105734-37d5a9b81262 + github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241120063916-9e97663361d3 + github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241120164406-c06a12f2e42c + github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241120062804-89e9fe93e886 + github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241120140156-1c476cfe7c63 github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241119161147-c38568cb3fb0 github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241118112815-d52a058b34a8 github.com/openstack-k8s-operators/ironic-operator/api v0.5.1-0.20241114211630-5b4dcbed9b37 @@ -28,7 +28,7 @@ require ( github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.1-0.20241114091812-6dc9fd0961dc github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241114091812-6dc9fd0961dc github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241117150431-21b7f58d9ddf - github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241106141725-340c4d78fef0 + github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241120160542-4b457715f74e github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241114104932-eae3f8cd032b github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241119125634-42b7b8417b48 github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241115111947-2336829c2d73 diff --git a/go.sum b/go.sum index 6b68187e0..6c0922920 100644 --- a/go.sum +++ b/go.sum @@ -100,16 +100,16 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6Beb1gQ96Ptej9AE/BvwCBiRj1E= github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4= -github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241114094618-6febb2d8d6a4 h1:vMsxll0P87Gzght042PytRTx5c71hlQLhux/peHONmk= -github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241114094618-6febb2d8d6a4/go.mod h1:Xn5DqgDkAT61fI88mBHsMfyzD4xNh0dYcSI90B3Io08= -github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241114094619-8cd575ca0e60 h1:kpojOnJkO8mC962fidyCUDwayju8U9NPkmScYfQ9dxA= -github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241114094619-8cd575ca0e60/go.mod h1:3NvCHOoCyzcZm046XctbsU/Dx+en3l8jG3nHhZyWOAA= -github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241114094900-9ce3c64786da h1:f2jFQsWopZfBoiI4mIlO7RpGRJ+QYYlfQhy9X7f5Bns= -github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241114094900-9ce3c64786da/go.mod h1:JZSzHp6f07mYkRB71xamFIPlgbFKvzIbv68ttwsEt/o= -github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241114111414-1fdd7f486264 h1:gQXtUfjK1Nj2tSBwarVUlJXEWUiYgu2ovMWEtTBvC4Y= -github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241114111414-1fdd7f486264/go.mod h1:bRqpa/WUQ7D99SAOXEPItxBobRP1oVUo93PWQukChIs= -github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241118124230-6202fa6a0fee h1:bQzR5hdF/5KN/HVD73i0vrQSlsdBCg1eOXfKeJtXfTE= -github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241118124230-6202fa6a0fee/go.mod h1:PuXjq4bV3/mYo4OAD/4tTon0N7E9YYXZHWiZLeZFVek= +github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241120105734-37d5a9b81262 h1:mV28IEmhMfUa5SZuPrEu7mV7Z5AzkYHwyxn4oh+sqHg= +github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241120105734-37d5a9b81262/go.mod h1:Xn5DqgDkAT61fI88mBHsMfyzD4xNh0dYcSI90B3Io08= +github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241120063916-9e97663361d3 h1:oIlRFU4i2OTxUC3gH88KdwtihbQbSS6deNUpaqSSC6M= +github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241120063916-9e97663361d3/go.mod h1:3NvCHOoCyzcZm046XctbsU/Dx+en3l8jG3nHhZyWOAA= +github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241120164406-c06a12f2e42c h1:aGUTBPEVTMvmmdOMJRcd8Zh6lvqqb0HWNGy0mZ10BgM= +github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241120164406-c06a12f2e42c/go.mod h1:JZSzHp6f07mYkRB71xamFIPlgbFKvzIbv68ttwsEt/o= +github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241120062804-89e9fe93e886 h1:mlm90ig3R4iznmPFJ3ROgKNkWb3LNcf2lmIET1hEOdA= +github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241120062804-89e9fe93e886/go.mod h1:mzdn8Y/XF/4nP2/Il8fk0n8ZdwIS5EuZms+IbRkqJ4I= +github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241120140156-1c476cfe7c63 h1:j1RGGbbvCkW2X9VHRb4ItNozIEMJpBn5S0gGEgdPNQc= +github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241120140156-1c476cfe7c63/go.mod h1:PuXjq4bV3/mYo4OAD/4tTon0N7E9YYXZHWiZLeZFVek= github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241119161147-c38568cb3fb0 h1:YtC+hqGKx9M8B6fHgA1eFlq1yjEiOWwp1zZqyFtjSbA= github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241119161147-c38568cb3fb0/go.mod h1:ezxV+6xd12IRKespGaDlJCUQ301yxrBlQUCEbeYQgSA= github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241118112815-d52a058b34a8 h1:mmnunGX3tnIT4ErxFjYcKb38VLjnfe9JcIcU9LaW9rE= @@ -132,8 +132,8 @@ github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.202411140918 github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241114091812-6dc9fd0961dc/go.mod h1:LV0jo5etIsGyINpmB37i4oWR8zU6ApIuh7fsqGGA41o= github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241117150431-21b7f58d9ddf h1:UsAefjZBqFl0dYMg/efe75ECm8cAwc/2FCEBPYjQfIY= github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241117150431-21b7f58d9ddf/go.mod h1:0/qgnjufYIqe439/3aUU/cwnjDwdUlNR3jnRubLTD5o= -github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241106141725-340c4d78fef0 h1:XrJID4tPlR1JCO7A7MPONGfVRmhgf6ktglmE1v7UlHM= -github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241106141725-340c4d78fef0/go.mod h1:348EPtAdpE2LxHAH4bHdCMNP7HyX6DevwEsF9DQ0S2k= +github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241120160542-4b457715f74e h1:id6qqUWUMo0h7LoIhjQlMIjy4iihoBCi7Pe/jWjKHcY= +github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241120160542-4b457715f74e/go.mod h1:348EPtAdpE2LxHAH4bHdCMNP7HyX6DevwEsF9DQ0S2k= github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241114104932-eae3f8cd032b h1:JMMPYDierS4YZdG9O/50kLihPQqmDz7p72btLy7Ibew= github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241114104932-eae3f8cd032b/go.mod h1:Kfuu3g4PSFpEowdWhbnTgSlDpsBGswQf/WU/kKQKK7s= github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241119125634-42b7b8417b48 h1:eCvn/lCMqWTvlN74nFr7nG2EvZdvJPdSR9Ts2eTaM6c= diff --git a/pkg/openstack/barbican.go b/pkg/openstack/barbican.go index 319d09789..0a18e9556 100644 --- a/pkg/openstack/barbican.go +++ b/pkg/openstack/barbican.go @@ -102,6 +102,10 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr instance.Spec.Barbican.Template.BarbicanAPI.TLS.API.Internal.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal) } + if instance.Spec.Barbican.Template.NodeSelector == nil { + instance.Spec.Barbican.Template.NodeSelector = &instance.Spec.NodeSelector + } + helper.GetLogger().Info("Reconciling Barbican", "Barbican.Namespace", instance.Namespace, "Barbican.Name", "barbican") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), barbican, func() error { instance.Spec.Barbican.Template.BarbicanSpecBase.DeepCopyInto(&barbican.Spec.BarbicanSpecBase) @@ -120,9 +124,6 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr if barbican.Spec.Secret == "" { barbican.Spec.Secret = instance.Spec.Secret } - if barbican.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - barbican.Spec.NodeSelector = instance.Spec.NodeSelector - } if barbican.Spec.DatabaseInstance == "" { // barbican.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here barbican.Spec.DatabaseInstance = "openstack" // FIXME: see above diff --git a/pkg/openstack/cinder.go b/pkg/openstack/cinder.go index 561d9b854..bda037050 100644 --- a/pkg/openstack/cinder.go +++ b/pkg/openstack/cinder.go @@ -118,6 +118,10 @@ func ReconcileCinder(ctx context.Context, instance *corev1beta1.OpenStackControl instance.Spec.Cinder.Template.CinderAPI.TLS.API.Internal.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal) } + if instance.Spec.Cinder.Template.NodeSelector == nil { + instance.Spec.Cinder.Template.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling Cinder", "Cinder.Namespace", instance.Namespace, "Cinder.Name", cinderName) op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), cinder, func() error { instance.Spec.Cinder.Template.CinderSpecBase.DeepCopyInto(&cinder.Spec.CinderSpecBase) @@ -151,9 +155,6 @@ func ReconcileCinder(ctx context.Context, instance *corev1beta1.OpenStackControl if cinder.Spec.Secret == "" { cinder.Spec.Secret = instance.Spec.Secret } - if cinder.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - cinder.Spec.NodeSelector = instance.Spec.NodeSelector - } if cinder.Spec.DatabaseInstance == "" { //cinder.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here cinder.Spec.DatabaseInstance = "openstack" //FIXME: see above diff --git a/pkg/openstack/designate.go b/pkg/openstack/designate.go index 80cb83650..e138132f2 100644 --- a/pkg/openstack/designate.go +++ b/pkg/openstack/designate.go @@ -109,6 +109,10 @@ func ReconcileDesignate(ctx context.Context, instance *corev1beta1.OpenStackCont instance.Spec.Designate.Template.DesignateAPI.TLS.API.Internal.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal) } + if instance.Spec.Designate.Template.NodeSelector == nil { + instance.Spec.Designate.Template.NodeSelector = &instance.Spec.NodeSelector + } + helper.GetLogger().Info("Reconciling Designate", "Designate.Namespace", instance.Namespace, "Designate.Name", "designate") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), designate, func() error { // FIXME: the designate structs need some rework (images should be at the top level, not in the sub structs) @@ -143,9 +147,6 @@ func ReconcileDesignate(ctx context.Context, instance *corev1beta1.OpenStackCont if designate.Spec.Secret == "" { designate.Spec.Secret = instance.Spec.Secret } - if designate.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - designate.Spec.NodeSelector = instance.Spec.NodeSelector - } if designate.Spec.DatabaseInstance == "" { //designate.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here designate.Spec.DatabaseInstance = "openstack" //FIXME: see above diff --git a/pkg/openstack/galera.go b/pkg/openstack/galera.go index 7cea8a6d1..2e957063c 100644 --- a/pkg/openstack/galera.go +++ b/pkg/openstack/galera.go @@ -168,6 +168,10 @@ func reconcileGalera( return galeraReady, nil } + if spec.NodeSelector == nil { + spec.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling Galera", "Galera.Namespace", instance.Namespace, "Galera.Name", name) op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), galera, func() error { spec.DeepCopyInto(&galera.Spec.GaleraSpecCore) diff --git a/pkg/openstack/glance.go b/pkg/openstack/glance.go index 55f58f708..8d2b13b89 100644 --- a/pkg/openstack/glance.go +++ b/pkg/openstack/glance.go @@ -62,6 +62,10 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl instance.Spec.Glance.Template = &glancev1.GlanceSpecCore{} } + if instance.Spec.Glance.Template.NodeSelector == nil { + instance.Spec.Glance.Template.NodeSelector = &instance.Spec.NodeSelector + } + // When component services got created check if there is the need to create a route if err := helper.GetClient().Get(ctx, types.NamespacedName{Name: glanceName, Namespace: instance.Namespace}, glance); err != nil { if !k8s_errors.IsNotFound(err) { diff --git a/pkg/openstack/heat.go b/pkg/openstack/heat.go index 0b3084503..e20f30959 100644 --- a/pkg/openstack/heat.go +++ b/pkg/openstack/heat.go @@ -47,6 +47,10 @@ func ReconcileHeat(ctx context.Context, instance *corev1beta1.OpenStackControlPl instance.Spec.Heat.Template = &heatv1.HeatSpecCore{} } + if instance.Spec.Heat.Template.NodeSelector == nil { + instance.Spec.Heat.Template.NodeSelector = &instance.Spec.NodeSelector + } + // add selector to service overrides for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { if instance.Spec.Heat.Template.HeatAPI.Override.Service == nil { diff --git a/tests/functional/ctlplane/openstackoperator_controller_test.go b/tests/functional/ctlplane/openstackoperator_controller_test.go index 2c58391ef..d718b845b 100644 --- a/tests/functional/ctlplane/openstackoperator_controller_test.go +++ b/tests/functional/ctlplane/openstackoperator_controller_test.go @@ -1804,6 +1804,102 @@ var _ = Describe("OpenStackOperator controller", func() { }) }) + When("An OpenStackControlplane instance is created with nodeSelector", func() { + BeforeEach(func() { + spec := GetDefaultOpenStackControlPlaneSpec() + spec["tls"] = GetTLSPublicSpec() + nodeSelector := map[string]string{ + "foo": "bar", + } + spec["nodeSelector"] = nodeSelector + DeferCleanup( + th.DeleteInstance, + CreateOpenStackControlPlane(names.OpenStackControlplaneName, spec), + ) + }) + + It("should set the galera nodeSelector", func() { + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBName) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBCell1Name) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + }) + + It("should update the galera nodeSelector", func() { + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBName) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBCell1Name) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + + Eventually(func(g Gomega) { + OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName) + newNodeSelector := map[string]string{ + "foo2": "bar2", + } + OSCtlplane.Spec.NodeSelector = newNodeSelector + g.Expect(k8sClient.Update(ctx, OSCtlplane)).Should(Succeed()) + }, timeout, interval).Should(Succeed()) + + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBName) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo2": "bar2"})) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBCell1Name) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo2": "bar2"})) + }, timeout, interval).Should(Succeed()) + }) + + It("should allow the galera nodeSelector to be overridden", func() { + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBName) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBCell1Name) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + + Eventually(func(g Gomega) { + OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName) + + newNodeSelector := map[string]string{ + "foo2": "bar2", + } + galeraTemplates := *(OSCtlplane.Spec.Galera.Templates) + dbTemplate := galeraTemplates[names.DBName.Name] + dbTemplate.NodeSelector = &newNodeSelector + galeraTemplates[names.DBName.Name] = dbTemplate + + emptyNodeSelector := map[string]string{} + cell1Template := galeraTemplates[names.DBCell1Name.Name] + cell1Template.NodeSelector = &emptyNodeSelector + galeraTemplates[names.DBCell1Name.Name] = cell1Template + + OSCtlplane.Spec.Galera.Templates = &galeraTemplates + + g.Expect(k8sClient.Update(ctx, OSCtlplane)).Should(Succeed()) + }, timeout, interval).Should(Succeed()) + + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBName) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo2": "bar2"})) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBCell1Name) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{})) + }, timeout, interval).Should(Succeed()) + }) + }) + }) var _ = Describe("OpenStackOperator Webhook", func() {