diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index 70828cfc9..024c4ab31 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -2128,9 +2128,6 @@ spec: type: string transportURLSecret: type: string - required: - - controlNetworkName - - storageRequest type: object designateCentral: properties: @@ -2613,7 +2610,6 @@ spec: - designateBackendbind9 - designateCentral - designateMdns - - designateNetworkAttachment - designateProducer - designateWorker - rabbitMqClusterName @@ -7286,6 +7282,14 @@ spec: format: int32 minimum: 1 type: integer + httpdCustomization: + properties: + processNumber: + default: 3 + format: int32 + minimum: 1 + type: integer + type: object memcachedInstance: default: memcached type: string @@ -12632,6 +12636,10 @@ spec: format: int32 minimum: 0 type: integer + nodeSelector: + additionalProperties: + type: string + type: object override: properties: service: @@ -16456,6 +16464,10 @@ spec: templates: additionalProperties: properties: + nodeSelector: + additionalProperties: + type: string + type: object replicas: default: 1 format: int32 @@ -16612,6 +16624,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object storageClass: default: "" type: string @@ -16634,6 +16650,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object override: properties: service: @@ -16739,6 +16759,10 @@ spec: format: int64 minimum: 1 type: integer + nodeSelector: + additionalProperties: + type: string + type: object partPower: default: 10 format: int64 @@ -16775,6 +16799,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object replicas: default: 1 format: int32 @@ -17215,6 +17243,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object override: properties: service: @@ -17366,6 +17398,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object passwordSelector: default: ceilometerService: CeilometerPassword @@ -18092,6 +18128,10 @@ spec: type: string type: object type: object + nodeSelector: + additionalProperties: + type: string + type: object type: object type: object tls: diff --git a/apis/client/v1beta1/openstackclient_types.go b/apis/client/v1beta1/openstackclient_types.go index 9c6a12fa9..f2e044574 100644 --- a/apis/client/v1beta1/openstackclient_types.go +++ b/apis/client/v1beta1/openstackclient_types.go @@ -49,8 +49,8 @@ type OpenStackClientSpecCore struct { OpenStackConfigSecret *string `json:"openStackConfigSecret"` // +kubebuilder:validation:Optional - // NodeSelector to target subset of worker nodes running control plane services (currently only applies to KeystoneAPI and PlacementAPI) - NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // NodeSelector to target subset of worker nodes + NodeSelector *map[string]string `json:"nodeSelector,omitempty"` // +kubebuilder:validation:Optional // +operator-sdk:csv:customresourcedefinitions:type=spec diff --git a/apis/client/v1beta1/zz_generated.deepcopy.go b/apis/client/v1beta1/zz_generated.deepcopy.go index 2cc8c40c9..010dfef40 100644 --- a/apis/client/v1beta1/zz_generated.deepcopy.go +++ b/apis/client/v1beta1/zz_generated.deepcopy.go @@ -131,9 +131,13 @@ func (in *OpenStackClientSpecCore) DeepCopyInto(out *OpenStackClientSpecCore) { } if in.NodeSelector != nil { in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val + *out = new(map[string]string) + if **in != nil { + in, out := *in, *out + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } } } out.Ca = in.Ca diff --git a/apis/core/v1beta1/openstackcontrolplane_types.go b/apis/core/v1beta1/openstackcontrolplane_types.go index 54db1050f..6add4f982 100644 --- a/apis/core/v1beta1/openstackcontrolplane_types.go +++ b/apis/core/v1beta1/openstackcontrolplane_types.go @@ -86,7 +86,7 @@ type OpenStackControlPlaneSpec struct { // +kubebuilder:validation:Optional // +operator-sdk:csv:customresourcedefinitions:type=spec - // NodeSelector to target subset of worker nodes running control plane services (currently only applies to KeystoneAPI and PlacementAPI) + // NodeSelector to target subset of worker nodes running control plane services NodeSelector map[string]string `json:"nodeSelector,omitempty"` // +kubebuilder:validation:Optional @@ -507,6 +507,10 @@ type RabbitmqTemplate struct { // +operator-sdk:csv:customresourcedefinitions:type=spec // Overrides to use when creating the Rabbitmq clusters rabbitmqv2.RabbitmqClusterSpecCore `json:",inline"` + // +kubebuilder:validation:Optional + // +operator-sdk:csv:customresourcedefinitions:type=spec + // NodeSelector to target subset of worker nodes running this service + NodeSelector *map[string]string `json:"nodeSelector,omitempty"` } // OvnSection defines the desired state of OVN services diff --git a/apis/core/v1beta1/zz_generated.deepcopy.go b/apis/core/v1beta1/zz_generated.deepcopy.go index 6b7938f14..9e3ebff7c 100644 --- a/apis/core/v1beta1/zz_generated.deepcopy.go +++ b/apis/core/v1beta1/zz_generated.deepcopy.go @@ -1470,6 +1470,17 @@ func (in *RabbitmqSection) DeepCopy() *RabbitmqSection { func (in *RabbitmqTemplate) DeepCopyInto(out *RabbitmqTemplate) { *out = *in in.RabbitmqClusterSpecCore.DeepCopyInto(&out.RabbitmqClusterSpecCore) + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = new(map[string]string) + if **in != nil { + in, out := *in, *out + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RabbitmqTemplate. diff --git a/apis/go.mod b/apis/go.mod index 7949d285f..51787fa7a 100644 --- a/apis/go.mod +++ b/apis/go.mod @@ -7,27 +7,27 @@ 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.20241114211344-1b231eb16c92 - github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241105155912-ff3f0d455309 - github.com/openstack-k8s-operators/designate-operator/api v0.5.0 - github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241119075400-402f7758bda3 - github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241028235411-eaf5b063654f - github.com/openstack-k8s-operators/horizon-operator/api v0.5.0 - github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241120213010-335e32b1dc65 - github.com/openstack-k8s-operators/ironic-operator/api v0.5.0 - github.com/openstack-k8s-operators/keystone-operator/api v0.5.0 + github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241122125559-6de316c14027 + github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241122125843-c716f59e13f9 + github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241122132349-a043c75b53ad + github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241122125600-ef3dc51eea99 + github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241122125317-93eece5fcfa0 + github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241122125601-2e200c1224ce + github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241122125042-ff0bda8161fe + github.com/openstack-k8s-operators/ironic-operator/api v0.5.1-0.20241122125317-56d6da8098be + github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20241122131229-de8969562e62 github.com/openstack-k8s-operators/lib-common/modules/common v0.5.0 github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0 - github.com/openstack-k8s-operators/manila-operator/api v0.5.0 - github.com/openstack-k8s-operators/mariadb-operator/api v0.5.0 - github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241112143215-294abc29ae85 - github.com/openstack-k8s-operators/nova-operator/api v0.5.0 - github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241119144914-248c7edb4442 + github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241122125316-c77565257def + github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241122125601-f248f6c7e2d1 + github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241122125044-affa1773a767 + github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241122111943-e2caf725b1be + github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241122124748-e27c3e9d95cd github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.5.1-0.20241120122537-78d219a20372 - github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241119133501-af147950fdbb - github.com/openstack-k8s-operators/placement-operator/api v0.5.0 - github.com/openstack-k8s-operators/swift-operator/api v0.5.0 - github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241120170327-df16dea2cae6 + github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241122125317-6ca662dca481 + github.com/openstack-k8s-operators/placement-operator/api v0.5.1-0.20241122125843-ad42d8c488ae + github.com/openstack-k8s-operators/swift-operator/api v0.5.1-0.20241122125042-e71e20768f68 + github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241122125043-2ef48ecf8aa7 github.com/rabbitmq/cluster-operator/v2 v2.11.0 github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.71.0-rhobs1 // indirect github.com/rhobs/observability-operator v0.3.1 // indirect diff --git a/apis/go.sum b/apis/go.sum index 5fef3ff86..1ba9a165a 100644 --- a/apis/go.sum +++ b/apis/go.sum @@ -94,52 +94,52 @@ 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.20241114211344-1b231eb16c92 h1:RSMSbsV2yTWUp88ziavE7c5HPoopXU/fnCFS8+63X30= -github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241114211344-1b231eb16c92/go.mod h1:D/O5qFJ3x8ViMkT0jAfaWNqo8/7FcOJt6zOYh5BDlvs= -github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241105155912-ff3f0d455309 h1:toTEZmyHvWJ3KoleDmF1zlEIcvJU21fBgB7d2vxrQaY= -github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241105155912-ff3f0d455309/go.mod h1:s9V6ai3rkIPwYhUJTNNEWzPDIO5hTcfbHC1tutKgUGw= -github.com/openstack-k8s-operators/designate-operator/api v0.5.0 h1:ut8t+VefBZy/Xp2rer7PKa7EtcU5bVNsvx7bRMzGszI= -github.com/openstack-k8s-operators/designate-operator/api v0.5.0/go.mod h1:aLc4dvPi5Bqb8FXnZ14YYRWFjZOmUdj+eJmaUPNZ5Qs= -github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241119075400-402f7758bda3 h1:xGjBviDEnnMu9HTBPwk0hmxcbZD+xikv6HKiolmr0Yg= -github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241119075400-402f7758bda3/go.mod h1:xRoM6j/L1yvUhghhF/OL5GExWlahTf64Z5svidliqsE= -github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241028235411-eaf5b063654f h1:DW9uj4+tgC/UEw1+7Wd7X5aAIt9vez0Neek9oNZs31I= -github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241028235411-eaf5b063654f/go.mod h1:mANVocVuc9ww98iuDBKA6fd7sULOr/Po9ks/fUgOIqA= -github.com/openstack-k8s-operators/horizon-operator/api v0.5.0 h1:tyzISHOmhmtOXAkzq1DFKED/s0IM2caHuR1A/m1Dk6U= -github.com/openstack-k8s-operators/horizon-operator/api v0.5.0/go.mod h1:6qGsJdObALYyH1G4mRLyRpmpTKsmTrKLGxx2hFUtU28= -github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241120213010-335e32b1dc65 h1:pNq8DhkdkFQFvK+Q80wBo3bxFZaCDYXwa86mIVf5few= -github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241120213010-335e32b1dc65/go.mod h1:J9oUh3eGBvAFfyUMiPxPRBSxAcO8rnwITN4RTh/It+8= -github.com/openstack-k8s-operators/ironic-operator/api v0.5.0 h1:vbuylOv7NOkpjCD1BS2Bhyg2fMxJyuagXmg8jr61UCk= -github.com/openstack-k8s-operators/ironic-operator/api v0.5.0/go.mod h1:qxdXTRt7kY6orSnFc/OTRHtqElNPuMV0W0KvMPHbE2s= -github.com/openstack-k8s-operators/keystone-operator/api v0.5.0 h1:h/Ce2OjdNrkDh/rJuZPdOsxrsm2uC+E57Mmf34oyWR0= -github.com/openstack-k8s-operators/keystone-operator/api v0.5.0/go.mod h1:saoorrsPo3DzDPGM6PJ8sQJBNuNRGCHjRHChRQmkoQ0= +github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241122125559-6de316c14027 h1:FAFDHhFdPYLckutMBSrO5wOVr0pENNHd1sJcxdEt1yI= +github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241122125559-6de316c14027/go.mod h1:D/O5qFJ3x8ViMkT0jAfaWNqo8/7FcOJt6zOYh5BDlvs= +github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241122125843-c716f59e13f9 h1:3F29orjZbAAd+D8wkx0U0CtixkN89qBHKSYm7iSyXhc= +github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241122125843-c716f59e13f9/go.mod h1:s9V6ai3rkIPwYhUJTNNEWzPDIO5hTcfbHC1tutKgUGw= +github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241122132349-a043c75b53ad h1:cwn3CMXEQKXgz9TiPeA6DONK+P4wLYkBZn4H9011TKk= +github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241122132349-a043c75b53ad/go.mod h1:aLc4dvPi5Bqb8FXnZ14YYRWFjZOmUdj+eJmaUPNZ5Qs= +github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241122125600-ef3dc51eea99 h1:/jr5T6oNIBwjU+LAgaAX0+9N77LZKl/gapmiBuZc3jE= +github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241122125600-ef3dc51eea99/go.mod h1:xRoM6j/L1yvUhghhF/OL5GExWlahTf64Z5svidliqsE= +github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241122125317-93eece5fcfa0 h1:uTTjp2S+U3uS5jyiggdw3jK5M1saB0NHRrh08kDdeIk= +github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241122125317-93eece5fcfa0/go.mod h1:mANVocVuc9ww98iuDBKA6fd7sULOr/Po9ks/fUgOIqA= +github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241122125601-2e200c1224ce h1:Sglm4ED/efLmnSMUYxCF4tDr/9Hhs1c4s5XvF2CmfOA= +github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241122125601-2e200c1224ce/go.mod h1:6qGsJdObALYyH1G4mRLyRpmpTKsmTrKLGxx2hFUtU28= +github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241122125042-ff0bda8161fe h1:NnrU4W0n117WGTaNroNivd3N1z5Si0n5UhB9v4z5WQ4= +github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241122125042-ff0bda8161fe/go.mod h1:nCCIj4rMVSj3Cwkwdc0snMhxOw/DmC42eWp8w+4WznU= +github.com/openstack-k8s-operators/ironic-operator/api v0.5.1-0.20241122125317-56d6da8098be h1:Tf7pIIvh3JWSpxKkUqIPSf+z6pGTOUA4/SE3xYYu/ew= +github.com/openstack-k8s-operators/ironic-operator/api v0.5.1-0.20241122125317-56d6da8098be/go.mod h1:qxdXTRt7kY6orSnFc/OTRHtqElNPuMV0W0KvMPHbE2s= +github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20241122131229-de8969562e62 h1:CIQGR9XLRj+kUPplJTWmKnp4EjeN0qzGrk5RdK1ZpfU= +github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20241122131229-de8969562e62/go.mod h1:saoorrsPo3DzDPGM6PJ8sQJBNuNRGCHjRHChRQmkoQ0= github.com/openstack-k8s-operators/lib-common/modules/common v0.5.0 h1:wto7Vprhr84z2LJzjbbw589MGkfjKtpHnhIhzgOa+BI= github.com/openstack-k8s-operators/lib-common/modules/common v0.5.0/go.mod h1:tNeup9Xl7j2eaeMslJ/rt59NNEAw7ATf6RuebS/YkSk= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.4.1-0.20241014140317-e5c35d28f3af h1:fevDUHmqcnI4wDTKupKe/CcgVdgNpZXWkJx8u0/xEXs= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.4.1-0.20241014140317-e5c35d28f3af/go.mod h1:djfljx3jfHqywhY3oDvPg/GLKwiFVkds6v7P7/Yg+8g= github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0 h1:iVGCAds5eVjKEoZS0KSBwYziLeLW3ZBs8PqPMrljPcg= github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0/go.mod h1:cGynoLGY9NfyIeWXI3zZ+hgZdHF3SUi8ht5ygZ8CmhI= -github.com/openstack-k8s-operators/manila-operator/api v0.5.0 h1:64SbDTNkZrJ4jd8OZf/3+/ftSd8rZDcPwDJ7GOBC0Ak= -github.com/openstack-k8s-operators/manila-operator/api v0.5.0/go.mod h1:Gi9t38UJU4opGJIS55qhunX2qC4oihlVdRhn7IJhQAg= -github.com/openstack-k8s-operators/mariadb-operator/api v0.5.0 h1:XBx1TuyKhgtWAigYVcdqTUzIwWRYHN63pfa0zxHB12M= -github.com/openstack-k8s-operators/mariadb-operator/api v0.5.0/go.mod h1:Uyc8m+72l3rVm6jKb8FRUrQbjMWyifc5m0K+Ge0QV80= -github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241112143215-294abc29ae85 h1:SOA+aOrNq3qqta4Hh6nwQACS5f5yHDunl4WczUkgA8I= -github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241112143215-294abc29ae85/go.mod h1:ARxoBFEgQUA+tM6Qu+TNDCArCN3kgG4WBI15pb2b1jc= -github.com/openstack-k8s-operators/nova-operator/api v0.5.0 h1:DQLiGBWYYp7aq1f8/JEb5Xds5oGP1SPuwGuZS+g3Za4= -github.com/openstack-k8s-operators/nova-operator/api v0.5.0/go.mod h1:E3DA4NEoTMqKDdgxEHut63BaHI0fSmRuVTMjGMqx1Z0= -github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241119144914-248c7edb4442 h1:pRY5uDsyG8grNGm2dKTVGtXIX4Bkhlx40CPuWgPPYkg= -github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241119144914-248c7edb4442/go.mod h1:6Z+1yna/RM9bCKkwd64pHxGrRpKFEhOtYUt1PDh6/xU= +github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241122125316-c77565257def h1:u+yFdIg3qa2Nl8tN1JWtDLwieXPZD3yI+MG1S9dohGE= +github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241122125316-c77565257def/go.mod h1:Gi9t38UJU4opGJIS55qhunX2qC4oihlVdRhn7IJhQAg= +github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241122125601-f248f6c7e2d1 h1:cOx8P1ssl6Iia+qK6IbmVqP6JHBhwrEM5WAqKJcd+9M= +github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241122125601-f248f6c7e2d1/go.mod h1:Uyc8m+72l3rVm6jKb8FRUrQbjMWyifc5m0K+Ge0QV80= +github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241122125044-affa1773a767 h1:XQ1184K8yLT8LC81Emm9MWVPviCD4mSapV3ZcK7IZy4= +github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241122125044-affa1773a767/go.mod h1:ARxoBFEgQUA+tM6Qu+TNDCArCN3kgG4WBI15pb2b1jc= +github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241122111943-e2caf725b1be h1:JogbffjFWunQI7s9sXcfUmL/1Of+PJjsOBy/gISTEbw= +github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241122111943-e2caf725b1be/go.mod h1:E3DA4NEoTMqKDdgxEHut63BaHI0fSmRuVTMjGMqx1Z0= +github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241122124748-e27c3e9d95cd h1:5s4XqlPye5WOrxo1cRlyHKFLUgNHi5SfGdHwGUkXOhg= +github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241122124748-e27c3e9d95cd/go.mod h1:6Z+1yna/RM9bCKkwd64pHxGrRpKFEhOtYUt1PDh6/xU= github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.5.1-0.20241120122537-78d219a20372 h1:MH2G7WNMhZZMDOyfv2a3M2XPEI+FRZPa8eCLiS9AHN4= github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.5.1-0.20241120122537-78d219a20372/go.mod h1:O9pAzpJo2CT+wZgchU/fERxNL23zPR6+KOccviKbSNY= -github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241119133501-af147950fdbb h1:2Q+0tHfTF+tyvOb0lvaeGi3Q7AkSxs7Ck1Cir+ziesY= -github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241119133501-af147950fdbb/go.mod h1:UNtD7SqSmflXUs8bzUu+azWxaFSEGPpprb9U86FaGTY= -github.com/openstack-k8s-operators/placement-operator/api v0.5.0 h1:N/09aDa+6xTkme3nbTpdbgLaCATifYcaHehsMCDuDT0= -github.com/openstack-k8s-operators/placement-operator/api v0.5.0/go.mod h1:4cleawzE+/WdVDo52BDbLyaeiOnIITAL2KqOhTlnQwM= +github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241122125317-6ca662dca481 h1:CwK2W1XNKQzwEYpOHiNFH+bI2HZuoAUwmGbkl7WACQA= +github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241122125317-6ca662dca481/go.mod h1:UNtD7SqSmflXUs8bzUu+azWxaFSEGPpprb9U86FaGTY= +github.com/openstack-k8s-operators/placement-operator/api v0.5.1-0.20241122125843-ad42d8c488ae h1:5N9TqZ++GPWBBGD4RJ3QABdiOxpY9SzOKAjehMNvRaA= +github.com/openstack-k8s-operators/placement-operator/api v0.5.1-0.20241122125843-ad42d8c488ae/go.mod h1:4cleawzE+/WdVDo52BDbLyaeiOnIITAL2KqOhTlnQwM= github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20241017142550-a3524acedd49 h1:/7SnnHfGCH/dwuZFNUx54zw4cnwv2w6hjONq16aoowM= github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20241017142550-a3524acedd49/go.mod h1:6Mq2N/KtNFW20L+PQC5qkeK8R8UGadmGBXL8HDY6lcg= -github.com/openstack-k8s-operators/swift-operator/api v0.5.0 h1:XYeze8mKxaZQ6keWO0qdSr1eDt3QEt0ef1D8Ic7w3pg= -github.com/openstack-k8s-operators/swift-operator/api v0.5.0/go.mod h1:jMHEP2K98nm4OwCW8b4i9Uqqv2GtUpU8PMYyHozsr/U= -github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241120170327-df16dea2cae6 h1:BwaOcN/rM9qmrJmA6jJonHymssfKtFOn6wJGghDexUE= -github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241120170327-df16dea2cae6/go.mod h1:1yPvSebSiduMJKNyIxTqOjgLoTlF+n4w+2d+9+Ofmu4= +github.com/openstack-k8s-operators/swift-operator/api v0.5.1-0.20241122125042-e71e20768f68 h1:z26u6ij/KbrupC4qJS2PvuPPyesev4twurIUksXuXO8= +github.com/openstack-k8s-operators/swift-operator/api v0.5.1-0.20241122125042-e71e20768f68/go.mod h1:jMHEP2K98nm4OwCW8b4i9Uqqv2GtUpU8PMYyHozsr/U= +github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241122125043-2ef48ecf8aa7 h1:MzVUCepc/0S+NJUEpq0mjpszL646+sqWijPtuYmGxeQ= +github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241122125043-2ef48ecf8aa7/go.mod h1:1yPvSebSiduMJKNyIxTqOjgLoTlF+n4w+2d+9+Ofmu4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml index 70828cfc9..024c4ab31 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -2128,9 +2128,6 @@ spec: type: string transportURLSecret: type: string - required: - - controlNetworkName - - storageRequest type: object designateCentral: properties: @@ -2613,7 +2610,6 @@ spec: - designateBackendbind9 - designateCentral - designateMdns - - designateNetworkAttachment - designateProducer - designateWorker - rabbitMqClusterName @@ -7286,6 +7282,14 @@ spec: format: int32 minimum: 1 type: integer + httpdCustomization: + properties: + processNumber: + default: 3 + format: int32 + minimum: 1 + type: integer + type: object memcachedInstance: default: memcached type: string @@ -12632,6 +12636,10 @@ spec: format: int32 minimum: 0 type: integer + nodeSelector: + additionalProperties: + type: string + type: object override: properties: service: @@ -16456,6 +16464,10 @@ spec: templates: additionalProperties: properties: + nodeSelector: + additionalProperties: + type: string + type: object replicas: default: 1 format: int32 @@ -16612,6 +16624,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object storageClass: default: "" type: string @@ -16634,6 +16650,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object override: properties: service: @@ -16739,6 +16759,10 @@ spec: format: int64 minimum: 1 type: integer + nodeSelector: + additionalProperties: + type: string + type: object partPower: default: 10 format: int64 @@ -16775,6 +16799,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object replicas: default: 1 format: int32 @@ -17215,6 +17243,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object override: properties: service: @@ -17366,6 +17398,10 @@ spec: items: type: string type: array + nodeSelector: + additionalProperties: + type: string + type: object passwordSelector: default: ceilometerService: CeilometerPassword @@ -18092,6 +18128,10 @@ spec: type: string type: object type: object + nodeSelector: + additionalProperties: + type: string + type: object type: object type: object tls: diff --git a/config/samples/nodeselectors/global/kustomization.yaml b/config/samples/nodeselectors/global/kustomization.yaml new file mode 100644 index 000000000..94aa1cafb --- /dev/null +++ b/config/samples/nodeselectors/global/kustomization.yaml @@ -0,0 +1,14 @@ +resources: +- ../../base/openstackcontrolplane + +patches: +- target: + kind: OpenStackControlPlane + name: .* + patch: |- + - op: replace + path: /metadata/name + value: openstack +- target: + kind: OpenStackControlPlane + path: patch.yaml diff --git a/config/samples/nodeselectors/global/patch.yaml b/config/samples/nodeselectors/global/patch.yaml new file mode 100644 index 000000000..5b9fde167 --- /dev/null +++ b/config/samples/nodeselectors/global/patch.yaml @@ -0,0 +1,7 @@ +apiVersion: core.openstack.org/v1beta1 +kind: OpenStackControlPlane +metadata: + name: openstack +spec: + nodeSelector: + node-role.kubernetes.io/worker: "" diff --git a/controllers/client/openstackclient_controller.go b/controllers/client/openstackclient_controller.go index db7ecdd15..d8d2eafc1 100644 --- a/controllers/client/openstackclient_controller.go +++ b/controllers/client/openstackclient_controller.go @@ -17,18 +17,15 @@ import ( "context" "errors" "fmt" - "reflect" "time" "github.com/go-logr/logr" - "golang.org/x/exp/slices" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" k8s_errors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/runtime" @@ -308,45 +305,16 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ }, } + spec := openstackclient.ClientPodSpec(ctx, instance, helper, configVarsHash) + op, err := controllerutil.CreateOrPatch(ctx, r.Client, osclient, func() error { isPodUpdate := !osclient.ObjectMeta.CreationTimestamp.IsZero() if !isPodUpdate { - osclient.Spec = openstackclient.ClientPodSpec(ctx, instance, helper, configVarsHash) + osclient.Spec = spec } else { - hashupdate := false - - f := func(e corev1.EnvVar) bool { - return e.Name == "CONFIG_HASH" - } - idx := slices.IndexFunc(osclient.Spec.Containers[0].Env, f) - - if idx >= 0 && osclient.Spec.Containers[0].Env[idx].Value != configVarsHash { - hashupdate = true - } - - switch { - case osclient.Spec.Containers[0].Image != instance.Spec.ContainerImage: - // if container image change force re-create by triggering NewForbidden - return k8s_errors.NewForbidden( - schema.GroupResource{Group: "", Resource: "pods"}, // Specify the group and resource type - osclient.Name, - errors.New("Cannot update Pod spec field - Spec.Containers[0].Image"), // Specify the error message - ) - case hashupdate: - // if config hash changed, recreate the pod to use new config - return k8s_errors.NewForbidden( - schema.GroupResource{Group: "", Resource: "pods"}, // Specify the group and resource type - osclient.Name, - errors.New("Config changed recreate pod"), // Specify the error message - ) - case !reflect.DeepEqual(osclient.Spec.NodeSelector, instance.Spec.NodeSelector): - // if NodeSelector change force re-create by triggering NewForbidden - return k8s_errors.NewForbidden( - schema.GroupResource{Group: "", Resource: "pods"}, // Specify the group and resource type - osclient.Name, - errors.New("Cannot update Pod spec field - Spec.NodeSelector"), // Specify the error message - ) - } + osclient.Spec.Containers[0].Env = spec.Containers[0].Env + osclient.Spec.NodeSelector = spec.NodeSelector + osclient.Spec.Containers[0].Image = instance.Spec.ContainerImage } osclient.Labels = util.MergeStringMaps(osclient.Labels, clientLabels) @@ -376,7 +344,7 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ } Log.Info(fmt.Sprintf("OpenStackClient pod deleted due to change %s", err.Error())) - return ctrl.Result{}, nil + return ctrl.Result{Requeue: true}, nil } return ctrl.Result{}, fmt.Errorf("Failed to create or update pod %s: %w", osclient.Name, err) diff --git a/go.mod b/go.mod index 97d0b8ab8..bd87d5ae6 100644 --- a/go.mod +++ b/go.mod @@ -12,31 +12,31 @@ 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.20241114211344-1b231eb16c92 - github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241105155912-ff3f0d455309 - github.com/openstack-k8s-operators/designate-operator/api v0.5.0 - github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241119075400-402f7758bda3 - github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241028235411-eaf5b063654f - github.com/openstack-k8s-operators/horizon-operator/api v0.5.0 - github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241120213010-335e32b1dc65 - github.com/openstack-k8s-operators/ironic-operator/api v0.5.0 - github.com/openstack-k8s-operators/keystone-operator/api v0.5.0 + github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241122125559-6de316c14027 + github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241122125843-c716f59e13f9 + github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241122132349-a043c75b53ad + github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241122125600-ef3dc51eea99 + github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241122125317-93eece5fcfa0 + github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241122125601-2e200c1224ce + github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241122125042-ff0bda8161fe + github.com/openstack-k8s-operators/ironic-operator/api v0.5.1-0.20241122125317-56d6da8098be + github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20241122131229-de8969562e62 github.com/openstack-k8s-operators/lib-common/modules/ansible v0.5.0 github.com/openstack-k8s-operators/lib-common/modules/certmanager v0.5.0 github.com/openstack-k8s-operators/lib-common/modules/common v0.5.0 github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0 github.com/openstack-k8s-operators/lib-common/modules/test v0.5.0 - github.com/openstack-k8s-operators/manila-operator/api v0.5.0 - github.com/openstack-k8s-operators/mariadb-operator/api v0.5.0 - github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241112143215-294abc29ae85 - github.com/openstack-k8s-operators/nova-operator/api v0.5.0 - github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241119144914-248c7edb4442 + github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241122125316-c77565257def + github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241122125601-f248f6c7e2d1 + github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241122125044-affa1773a767 + github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241122111943-e2caf725b1be + github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241122124748-e27c3e9d95cd github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.5.1-0.20241120122537-78d219a20372 github.com/openstack-k8s-operators/openstack-operator/apis v0.0.0-20240531084739-3b4c0451297c - github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241119133501-af147950fdbb - github.com/openstack-k8s-operators/placement-operator/api v0.5.0 - github.com/openstack-k8s-operators/swift-operator/api v0.5.0 - github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241120170327-df16dea2cae6 + github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241122125317-6ca662dca481 + github.com/openstack-k8s-operators/placement-operator/api v0.5.1-0.20241122125843-ad42d8c488ae + github.com/openstack-k8s-operators/swift-operator/api v0.5.1-0.20241122125042-e71e20768f68 + github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241122125043-2ef48ecf8aa7 github.com/openstack-k8s-operators/test-operator/api v0.5.1-0.20241120094846-34e4270601af github.com/rabbitmq/cluster-operator/v2 v2.11.0 go.uber.org/zap v1.27.0 diff --git a/go.sum b/go.sum index a3b249467..5dcf32658 100644 --- a/go.sum +++ b/go.sum @@ -100,24 +100,24 @@ 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.20241114211344-1b231eb16c92 h1:RSMSbsV2yTWUp88ziavE7c5HPoopXU/fnCFS8+63X30= -github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241114211344-1b231eb16c92/go.mod h1:D/O5qFJ3x8ViMkT0jAfaWNqo8/7FcOJt6zOYh5BDlvs= -github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241105155912-ff3f0d455309 h1:toTEZmyHvWJ3KoleDmF1zlEIcvJU21fBgB7d2vxrQaY= -github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241105155912-ff3f0d455309/go.mod h1:s9V6ai3rkIPwYhUJTNNEWzPDIO5hTcfbHC1tutKgUGw= -github.com/openstack-k8s-operators/designate-operator/api v0.5.0 h1:ut8t+VefBZy/Xp2rer7PKa7EtcU5bVNsvx7bRMzGszI= -github.com/openstack-k8s-operators/designate-operator/api v0.5.0/go.mod h1:aLc4dvPi5Bqb8FXnZ14YYRWFjZOmUdj+eJmaUPNZ5Qs= -github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241119075400-402f7758bda3 h1:xGjBviDEnnMu9HTBPwk0hmxcbZD+xikv6HKiolmr0Yg= -github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241119075400-402f7758bda3/go.mod h1:xRoM6j/L1yvUhghhF/OL5GExWlahTf64Z5svidliqsE= -github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241028235411-eaf5b063654f h1:DW9uj4+tgC/UEw1+7Wd7X5aAIt9vez0Neek9oNZs31I= -github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241028235411-eaf5b063654f/go.mod h1:mANVocVuc9ww98iuDBKA6fd7sULOr/Po9ks/fUgOIqA= -github.com/openstack-k8s-operators/horizon-operator/api v0.5.0 h1:tyzISHOmhmtOXAkzq1DFKED/s0IM2caHuR1A/m1Dk6U= -github.com/openstack-k8s-operators/horizon-operator/api v0.5.0/go.mod h1:6qGsJdObALYyH1G4mRLyRpmpTKsmTrKLGxx2hFUtU28= -github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241120213010-335e32b1dc65 h1:pNq8DhkdkFQFvK+Q80wBo3bxFZaCDYXwa86mIVf5few= -github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241120213010-335e32b1dc65/go.mod h1:J9oUh3eGBvAFfyUMiPxPRBSxAcO8rnwITN4RTh/It+8= -github.com/openstack-k8s-operators/ironic-operator/api v0.5.0 h1:vbuylOv7NOkpjCD1BS2Bhyg2fMxJyuagXmg8jr61UCk= -github.com/openstack-k8s-operators/ironic-operator/api v0.5.0/go.mod h1:qxdXTRt7kY6orSnFc/OTRHtqElNPuMV0W0KvMPHbE2s= -github.com/openstack-k8s-operators/keystone-operator/api v0.5.0 h1:h/Ce2OjdNrkDh/rJuZPdOsxrsm2uC+E57Mmf34oyWR0= -github.com/openstack-k8s-operators/keystone-operator/api v0.5.0/go.mod h1:saoorrsPo3DzDPGM6PJ8sQJBNuNRGCHjRHChRQmkoQ0= +github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241122125559-6de316c14027 h1:FAFDHhFdPYLckutMBSrO5wOVr0pENNHd1sJcxdEt1yI= +github.com/openstack-k8s-operators/barbican-operator/api v0.5.1-0.20241122125559-6de316c14027/go.mod h1:D/O5qFJ3x8ViMkT0jAfaWNqo8/7FcOJt6zOYh5BDlvs= +github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241122125843-c716f59e13f9 h1:3F29orjZbAAd+D8wkx0U0CtixkN89qBHKSYm7iSyXhc= +github.com/openstack-k8s-operators/cinder-operator/api v0.5.1-0.20241122125843-c716f59e13f9/go.mod h1:s9V6ai3rkIPwYhUJTNNEWzPDIO5hTcfbHC1tutKgUGw= +github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241122132349-a043c75b53ad h1:cwn3CMXEQKXgz9TiPeA6DONK+P4wLYkBZn4H9011TKk= +github.com/openstack-k8s-operators/designate-operator/api v0.5.1-0.20241122132349-a043c75b53ad/go.mod h1:aLc4dvPi5Bqb8FXnZ14YYRWFjZOmUdj+eJmaUPNZ5Qs= +github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241122125600-ef3dc51eea99 h1:/jr5T6oNIBwjU+LAgaAX0+9N77LZKl/gapmiBuZc3jE= +github.com/openstack-k8s-operators/glance-operator/api v0.5.1-0.20241122125600-ef3dc51eea99/go.mod h1:xRoM6j/L1yvUhghhF/OL5GExWlahTf64Z5svidliqsE= +github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241122125317-93eece5fcfa0 h1:uTTjp2S+U3uS5jyiggdw3jK5M1saB0NHRrh08kDdeIk= +github.com/openstack-k8s-operators/heat-operator/api v0.5.1-0.20241122125317-93eece5fcfa0/go.mod h1:mANVocVuc9ww98iuDBKA6fd7sULOr/Po9ks/fUgOIqA= +github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241122125601-2e200c1224ce h1:Sglm4ED/efLmnSMUYxCF4tDr/9Hhs1c4s5XvF2CmfOA= +github.com/openstack-k8s-operators/horizon-operator/api v0.5.1-0.20241122125601-2e200c1224ce/go.mod h1:6qGsJdObALYyH1G4mRLyRpmpTKsmTrKLGxx2hFUtU28= +github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241122125042-ff0bda8161fe h1:NnrU4W0n117WGTaNroNivd3N1z5Si0n5UhB9v4z5WQ4= +github.com/openstack-k8s-operators/infra-operator/apis v0.5.1-0.20241122125042-ff0bda8161fe/go.mod h1:nCCIj4rMVSj3Cwkwdc0snMhxOw/DmC42eWp8w+4WznU= +github.com/openstack-k8s-operators/ironic-operator/api v0.5.1-0.20241122125317-56d6da8098be h1:Tf7pIIvh3JWSpxKkUqIPSf+z6pGTOUA4/SE3xYYu/ew= +github.com/openstack-k8s-operators/ironic-operator/api v0.5.1-0.20241122125317-56d6da8098be/go.mod h1:qxdXTRt7kY6orSnFc/OTRHtqElNPuMV0W0KvMPHbE2s= +github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20241122131229-de8969562e62 h1:CIQGR9XLRj+kUPplJTWmKnp4EjeN0qzGrk5RdK1ZpfU= +github.com/openstack-k8s-operators/keystone-operator/api v0.5.1-0.20241122131229-de8969562e62/go.mod h1:saoorrsPo3DzDPGM6PJ8sQJBNuNRGCHjRHChRQmkoQ0= github.com/openstack-k8s-operators/lib-common/modules/ansible v0.5.0 h1:M6tou1UD+en6fcZtV64RPsDVdHH5up6oqtENDU8dRyE= github.com/openstack-k8s-operators/lib-common/modules/ansible v0.5.0/go.mod h1:FxA/2ChDnVKgbZAyiiRLDGZB7WMcrHlOMBZYUQGgRf0= github.com/openstack-k8s-operators/lib-common/modules/certmanager v0.5.0 h1:Y2wAPS3TBQrjSbTrbtCjJUYL2spltyyjfzQ3bF7DRZ8= @@ -130,28 +130,28 @@ github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0 h1:iVGCAds5 github.com/openstack-k8s-operators/lib-common/modules/storage v0.5.0/go.mod h1:cGynoLGY9NfyIeWXI3zZ+hgZdHF3SUi8ht5ygZ8CmhI= github.com/openstack-k8s-operators/lib-common/modules/test v0.5.0 h1:rUVJUKFWQuXYQ3LPNs7wIJdka5EqUmLMT3RRpWkuqRo= github.com/openstack-k8s-operators/lib-common/modules/test v0.5.0/go.mod h1:LV0jo5etIsGyINpmB37i4oWR8zU6ApIuh7fsqGGA41o= -github.com/openstack-k8s-operators/manila-operator/api v0.5.0 h1:64SbDTNkZrJ4jd8OZf/3+/ftSd8rZDcPwDJ7GOBC0Ak= -github.com/openstack-k8s-operators/manila-operator/api v0.5.0/go.mod h1:Gi9t38UJU4opGJIS55qhunX2qC4oihlVdRhn7IJhQAg= -github.com/openstack-k8s-operators/mariadb-operator/api v0.5.0 h1:XBx1TuyKhgtWAigYVcdqTUzIwWRYHN63pfa0zxHB12M= -github.com/openstack-k8s-operators/mariadb-operator/api v0.5.0/go.mod h1:Uyc8m+72l3rVm6jKb8FRUrQbjMWyifc5m0K+Ge0QV80= -github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241112143215-294abc29ae85 h1:SOA+aOrNq3qqta4Hh6nwQACS5f5yHDunl4WczUkgA8I= -github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241112143215-294abc29ae85/go.mod h1:ARxoBFEgQUA+tM6Qu+TNDCArCN3kgG4WBI15pb2b1jc= -github.com/openstack-k8s-operators/nova-operator/api v0.5.0 h1:DQLiGBWYYp7aq1f8/JEb5Xds5oGP1SPuwGuZS+g3Za4= -github.com/openstack-k8s-operators/nova-operator/api v0.5.0/go.mod h1:E3DA4NEoTMqKDdgxEHut63BaHI0fSmRuVTMjGMqx1Z0= -github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241119144914-248c7edb4442 h1:pRY5uDsyG8grNGm2dKTVGtXIX4Bkhlx40CPuWgPPYkg= -github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241119144914-248c7edb4442/go.mod h1:6Z+1yna/RM9bCKkwd64pHxGrRpKFEhOtYUt1PDh6/xU= +github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241122125316-c77565257def h1:u+yFdIg3qa2Nl8tN1JWtDLwieXPZD3yI+MG1S9dohGE= +github.com/openstack-k8s-operators/manila-operator/api v0.5.1-0.20241122125316-c77565257def/go.mod h1:Gi9t38UJU4opGJIS55qhunX2qC4oihlVdRhn7IJhQAg= +github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241122125601-f248f6c7e2d1 h1:cOx8P1ssl6Iia+qK6IbmVqP6JHBhwrEM5WAqKJcd+9M= +github.com/openstack-k8s-operators/mariadb-operator/api v0.5.1-0.20241122125601-f248f6c7e2d1/go.mod h1:Uyc8m+72l3rVm6jKb8FRUrQbjMWyifc5m0K+Ge0QV80= +github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241122125044-affa1773a767 h1:XQ1184K8yLT8LC81Emm9MWVPviCD4mSapV3ZcK7IZy4= +github.com/openstack-k8s-operators/neutron-operator/api v0.5.1-0.20241122125044-affa1773a767/go.mod h1:ARxoBFEgQUA+tM6Qu+TNDCArCN3kgG4WBI15pb2b1jc= +github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241122111943-e2caf725b1be h1:JogbffjFWunQI7s9sXcfUmL/1Of+PJjsOBy/gISTEbw= +github.com/openstack-k8s-operators/nova-operator/api v0.5.1-0.20241122111943-e2caf725b1be/go.mod h1:E3DA4NEoTMqKDdgxEHut63BaHI0fSmRuVTMjGMqx1Z0= +github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241122124748-e27c3e9d95cd h1:5s4XqlPye5WOrxo1cRlyHKFLUgNHi5SfGdHwGUkXOhg= +github.com/openstack-k8s-operators/octavia-operator/api v0.5.1-0.20241122124748-e27c3e9d95cd/go.mod h1:6Z+1yna/RM9bCKkwd64pHxGrRpKFEhOtYUt1PDh6/xU= github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.5.1-0.20241120122537-78d219a20372 h1:MH2G7WNMhZZMDOyfv2a3M2XPEI+FRZPa8eCLiS9AHN4= github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.5.1-0.20241120122537-78d219a20372/go.mod h1:O9pAzpJo2CT+wZgchU/fERxNL23zPR6+KOccviKbSNY= -github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241119133501-af147950fdbb h1:2Q+0tHfTF+tyvOb0lvaeGi3Q7AkSxs7Ck1Cir+ziesY= -github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241119133501-af147950fdbb/go.mod h1:UNtD7SqSmflXUs8bzUu+azWxaFSEGPpprb9U86FaGTY= -github.com/openstack-k8s-operators/placement-operator/api v0.5.0 h1:N/09aDa+6xTkme3nbTpdbgLaCATifYcaHehsMCDuDT0= -github.com/openstack-k8s-operators/placement-operator/api v0.5.0/go.mod h1:4cleawzE+/WdVDo52BDbLyaeiOnIITAL2KqOhTlnQwM= +github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241122125317-6ca662dca481 h1:CwK2W1XNKQzwEYpOHiNFH+bI2HZuoAUwmGbkl7WACQA= +github.com/openstack-k8s-operators/ovn-operator/api v0.5.1-0.20241122125317-6ca662dca481/go.mod h1:UNtD7SqSmflXUs8bzUu+azWxaFSEGPpprb9U86FaGTY= +github.com/openstack-k8s-operators/placement-operator/api v0.5.1-0.20241122125843-ad42d8c488ae h1:5N9TqZ++GPWBBGD4RJ3QABdiOxpY9SzOKAjehMNvRaA= +github.com/openstack-k8s-operators/placement-operator/api v0.5.1-0.20241122125843-ad42d8c488ae/go.mod h1:4cleawzE+/WdVDo52BDbLyaeiOnIITAL2KqOhTlnQwM= github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20241017142550-a3524acedd49 h1:/7SnnHfGCH/dwuZFNUx54zw4cnwv2w6hjONq16aoowM= github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20241017142550-a3524acedd49/go.mod h1:6Mq2N/KtNFW20L+PQC5qkeK8R8UGadmGBXL8HDY6lcg= -github.com/openstack-k8s-operators/swift-operator/api v0.5.0 h1:XYeze8mKxaZQ6keWO0qdSr1eDt3QEt0ef1D8Ic7w3pg= -github.com/openstack-k8s-operators/swift-operator/api v0.5.0/go.mod h1:jMHEP2K98nm4OwCW8b4i9Uqqv2GtUpU8PMYyHozsr/U= -github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241120170327-df16dea2cae6 h1:BwaOcN/rM9qmrJmA6jJonHymssfKtFOn6wJGghDexUE= -github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241120170327-df16dea2cae6/go.mod h1:1yPvSebSiduMJKNyIxTqOjgLoTlF+n4w+2d+9+Ofmu4= +github.com/openstack-k8s-operators/swift-operator/api v0.5.1-0.20241122125042-e71e20768f68 h1:z26u6ij/KbrupC4qJS2PvuPPyesev4twurIUksXuXO8= +github.com/openstack-k8s-operators/swift-operator/api v0.5.1-0.20241122125042-e71e20768f68/go.mod h1:jMHEP2K98nm4OwCW8b4i9Uqqv2GtUpU8PMYyHozsr/U= +github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241122125043-2ef48ecf8aa7 h1:MzVUCepc/0S+NJUEpq0mjpszL646+sqWijPtuYmGxeQ= +github.com/openstack-k8s-operators/telemetry-operator/api v0.5.1-0.20241122125043-2ef48ecf8aa7/go.mod h1:1yPvSebSiduMJKNyIxTqOjgLoTlF+n4w+2d+9+Ofmu4= github.com/openstack-k8s-operators/test-operator/api v0.5.1-0.20241120094846-34e4270601af h1:b3F4rmK7GsZ5meZHIMI0H7NUHcHV1d049m82SsEFOKc= github.com/openstack-k8s-operators/test-operator/api v0.5.1-0.20241120094846-34e4270601af/go.mod h1:8M321WSJuyKnKupMmMYdqlrs9WD6lmuuwQMiO8gTJLU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 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/dnsmasq.go b/pkg/openstack/dnsmasq.go index cae7a8a06..7dc5e16d7 100644 --- a/pkg/openstack/dnsmasq.go +++ b/pkg/openstack/dnsmasq.go @@ -40,13 +40,14 @@ func ReconcileDNSMasqs(ctx context.Context, instance *corev1beta1.OpenStackContr instance.Spec.DNS.Template = &networkv1.DNSMasqSpec{} } + if instance.Spec.DNS.Template.NodeSelector == nil { + instance.Spec.DNS.Template.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling DNSMasq", "DNSMasq.Namespace", instance.Namespace, "DNSMasq.Name", "dnsmasq") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), dnsmasq, func() error { instance.Spec.DNS.Template.DeepCopyInto(&dnsmasq.Spec) dnsmasq.Spec.ContainerImage = *version.Status.ContainerImages.InfraDnsmasqImage - if dnsmasq.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - dnsmasq.Spec.NodeSelector = instance.Spec.NodeSelector - } err := controllerutil.SetControllerReference(helper.GetBeforeObject(), dnsmasq, helper.GetScheme()) if err != nil { return err 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/pkg/openstack/horizon.go b/pkg/openstack/horizon.go index ff0b288e5..0a433254d 100644 --- a/pkg/openstack/horizon.go +++ b/pkg/openstack/horizon.go @@ -50,6 +50,10 @@ func ReconcileHorizon(ctx context.Context, instance *corev1beta1.OpenStackContro instance.Spec.Horizon.Template = &horizonv1.HorizonSpecCore{} } + if instance.Spec.Horizon.Template.NodeSelector == nil { + instance.Spec.Horizon.Template.NodeSelector = &instance.Spec.NodeSelector + } + // add selector to service overrides serviceOverrides := map[service.Endpoint]service.RoutedOverrideSpec{} if instance.Spec.Horizon.Template.Override.Service != nil { diff --git a/pkg/openstack/ironic.go b/pkg/openstack/ironic.go index 1c71e81c6..95c202615 100644 --- a/pkg/openstack/ironic.go +++ b/pkg/openstack/ironic.go @@ -47,6 +47,10 @@ func ReconcileIronic(ctx context.Context, instance *corev1beta1.OpenStackControl instance.Spec.Ironic.Template = &ironicv1.IronicSpecCore{} } + if instance.Spec.Ironic.Template.NodeSelector == nil { + instance.Spec.Ironic.Template.NodeSelector = &instance.Spec.NodeSelector + } + // add selector to service overrides for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { if instance.Spec.Ironic.Template.IronicAPI.Override.Service == nil { diff --git a/pkg/openstack/keystone.go b/pkg/openstack/keystone.go index b74223e36..8b10b103f 100644 --- a/pkg/openstack/keystone.go +++ b/pkg/openstack/keystone.go @@ -103,6 +103,10 @@ func ReconcileKeystoneAPI(ctx context.Context, instance *corev1beta1.OpenStackCo instance.Spec.Keystone.Template.TLS.API.Internal.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal) } + if instance.Spec.Keystone.Template.NodeSelector == nil { + instance.Spec.Keystone.Template.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling KeystoneAPI", "KeystoneAPI.Namespace", instance.Namespace, "KeystoneAPI.Name", "keystone") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), keystoneAPI, func() error { instance.Spec.Keystone.Template.DeepCopyInto(&keystoneAPI.Spec.KeystoneAPISpecCore) @@ -111,9 +115,6 @@ func ReconcileKeystoneAPI(ctx context.Context, instance *corev1beta1.OpenStackCo if keystoneAPI.Spec.Secret == "" { keystoneAPI.Spec.Secret = instance.Spec.Secret } - if keystoneAPI.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - keystoneAPI.Spec.NodeSelector = instance.Spec.NodeSelector - } if keystoneAPI.Spec.DatabaseInstance == "" { //keystoneAPI.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here keystoneAPI.Spec.DatabaseInstance = "openstack" //FIXME: see above diff --git a/pkg/openstack/manila.go b/pkg/openstack/manila.go index 3f526429c..468ee64d0 100644 --- a/pkg/openstack/manila.go +++ b/pkg/openstack/manila.go @@ -106,11 +106,16 @@ func ReconcileManila(ctx context.Context, instance *corev1beta1.OpenStackControl instance.Spec.Manila.Template.ManilaAPI.TLS.API.Internal.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal) } + if instance.Spec.Manila.Template.NodeSelector == nil { + instance.Spec.Manila.Template.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling Manila", "Manila.Namespace", instance.Namespace, "Manila.Name", "manila") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), manila, func() error { instance.Spec.Manila.Template.ManilaSpecBase.DeepCopyInto(&manila.Spec.ManilaSpecBase) instance.Spec.Manila.Template.ManilaAPI.DeepCopyInto(&manila.Spec.ManilaAPI.ManilaAPITemplateCore) instance.Spec.Manila.Template.ManilaScheduler.DeepCopyInto(&manila.Spec.ManilaScheduler.ManilaSchedulerTemplateCore) + manila.Spec.NodeSelector = instance.Spec.Manila.Template.NodeSelector manila.Spec.ManilaAPI.ContainerImage = *version.Status.ContainerImages.ManilaAPIImage manila.Spec.ManilaScheduler.ContainerImage = *version.Status.ContainerImages.ManilaSchedulerImage @@ -137,9 +142,6 @@ func ReconcileManila(ctx context.Context, instance *corev1beta1.OpenStackControl if manila.Spec.Secret == "" { manila.Spec.Secret = instance.Spec.Secret } - if manila.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - manila.Spec.NodeSelector = instance.Spec.NodeSelector - } if manila.Spec.DatabaseInstance == "" { //manila.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here manila.Spec.DatabaseInstance = "openstack" //FIXME: see above diff --git a/pkg/openstack/memcached.go b/pkg/openstack/memcached.go index 92cf63b50..8bd701566 100644 --- a/pkg/openstack/memcached.go +++ b/pkg/openstack/memcached.go @@ -199,6 +199,10 @@ func reconcileMemcached( tlsCert = certSecret.Name } + if spec.NodeSelector == nil { + spec.NodeSelector = &instance.Spec.NodeSelector + } + op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), memcached, func() error { spec.DeepCopyInto(&memcached.Spec.MemcachedSpecCore) diff --git a/pkg/openstack/neutron.go b/pkg/openstack/neutron.go index 211f3642f..425c7ac9a 100644 --- a/pkg/openstack/neutron.go +++ b/pkg/openstack/neutron.go @@ -141,6 +141,10 @@ func ReconcileNeutron(ctx context.Context, instance *corev1beta1.OpenStackContro instance.Spec.Neutron.Template.TLS.API.Internal.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal) } + if instance.Spec.Neutron.Template.NodeSelector == nil { + instance.Spec.Neutron.Template.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling NeutronAPI", "NeutronAPI.Namespace", instance.Namespace, "NeutronAPI.Name", "neutron") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), neutronAPI, func() error { instance.Spec.Neutron.Template.DeepCopyInto(&neutronAPI.Spec.NeutronAPISpecCore) @@ -148,9 +152,6 @@ func ReconcileNeutron(ctx context.Context, instance *corev1beta1.OpenStackContro if neutronAPI.Spec.Secret == "" { neutronAPI.Spec.Secret = instance.Spec.Secret } - if neutronAPI.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - neutronAPI.Spec.NodeSelector = instance.Spec.NodeSelector - } if neutronAPI.Spec.DatabaseInstance == "" { neutronAPI.Spec.DatabaseInstance = "openstack" } diff --git a/pkg/openstack/nova.go b/pkg/openstack/nova.go index 7f147ed42..7c738d37a 100644 --- a/pkg/openstack/nova.go +++ b/pkg/openstack/nova.go @@ -67,6 +67,10 @@ func ReconcileNova(ctx context.Context, instance *corev1beta1.OpenStackControlPl instance.Spec.Nova.Template = &novav1.NovaSpec{} } + if instance.Spec.Nova.Template.NodeSelector == nil { + instance.Spec.Nova.Template.NodeSelector = &instance.Spec.NodeSelector + } + // When component services got created check if there is the need to create routes and certificates if err := helper.GetClient().Get(ctx, types.NamespacedName{Name: "nova", Namespace: instance.Namespace}, nova); err != nil { if !k8s_errors.IsNotFound(err) { diff --git a/pkg/openstack/octavia.go b/pkg/openstack/octavia.go index c3b2803c9..8a59cff54 100644 --- a/pkg/openstack/octavia.go +++ b/pkg/openstack/octavia.go @@ -64,6 +64,10 @@ func ReconcileOctavia(ctx context.Context, instance *corev1beta1.OpenStackContro instance.Spec.Octavia.Template = &octaviav1.OctaviaSpecCore{} } + if instance.Spec.Octavia.Template.NodeSelector == nil { + instance.Spec.Octavia.Template.NodeSelector = &instance.Spec.NodeSelector + } + // add selector to service overrides for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { if instance.Spec.Octavia.Template.OctaviaAPI.Override.Service == nil { diff --git a/pkg/openstack/openstackclient.go b/pkg/openstack/openstackclient.go index 4f49f0870..efc7fd520 100644 --- a/pkg/openstack/openstackclient.go +++ b/pkg/openstack/openstackclient.go @@ -47,6 +47,10 @@ func ReconcileOpenStackClient(ctx context.Context, instance *corev1.OpenStackCon return ctrl.Result{}, nil } + if instance.Spec.OpenStackClient.Template.NodeSelector == nil { + instance.Spec.OpenStackClient.Template.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling OpenStackClient", "OpenStackClient.Namespace", instance.Namespace, "OpenStackClient.Name", openstackclient.Name) op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), openstackclient, func() error { instance.Spec.OpenStackClient.Template.DeepCopyInto(&openstackclient.Spec.OpenStackClientSpecCore) diff --git a/pkg/openstack/ovn.go b/pkg/openstack/ovn.go index 25997af7a..32569abfc 100644 --- a/pkg/openstack/ovn.go +++ b/pkg/openstack/ovn.go @@ -142,6 +142,10 @@ func ReconcileOVNDbClusters(ctx context.Context, instance *corev1beta1.OpenStack dbcluster.TLS.SecretName = &certSecret.Name } + if dbcluster.NodeSelector == nil { + dbcluster.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling OVNDBCluster", "OVNDBCluster.Namespace", instance.Namespace, "OVNDBCluster.Name", name) op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), OVNDBCluster, func() error { @@ -154,9 +158,6 @@ func ReconcileOVNDbClusters(ctx context.Context, instance *corev1beta1.OpenStack OVNDBCluster.Spec.ContainerImage = *version.Status.ContainerImages.OvnSbDbclusterImage } - if OVNDBCluster.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - OVNDBCluster.Spec.NodeSelector = instance.Spec.NodeSelector - } if OVNDBCluster.Spec.StorageClass == "" { OVNDBCluster.Spec.StorageClass = instance.Spec.StorageClass } @@ -256,6 +257,10 @@ func ReconcileOVNNorthd(ctx context.Context, instance *corev1beta1.OpenStackCont } ovnNorthdSpec.TLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName + if ovnNorthdSpec.NodeSelector == nil { + ovnNorthdSpec.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling OVNNorthd", "OVNNorthd.Namespace", instance.Namespace, "OVNNorthd.Name", "ovnnorthd") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), OVNNorthd, func() error { @@ -263,10 +268,6 @@ func ReconcileOVNNorthd(ctx context.Context, instance *corev1beta1.OpenStackCont OVNNorthd.Spec.ContainerImage = *version.Status.ContainerImages.OvnNorthdImage - if OVNNorthd.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - OVNNorthd.Spec.NodeSelector = instance.Spec.NodeSelector - } - err := controllerutil.SetControllerReference(helper.GetBeforeObject(), OVNNorthd, helper.GetScheme()) if err != nil { return err @@ -373,6 +374,10 @@ func ReconcileOVNController(ctx context.Context, instance *corev1beta1.OpenStack } ovnControllerSpec.TLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName + if ovnControllerSpec.NodeSelector == nil { + ovnControllerSpec.NodeSelector = &instance.Spec.NodeSelector + } + Log.Info("Reconciling OVNController", "OVNController.Namespace", instance.Namespace, "OVNController.Name", "ovncontroller") op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), OVNController, func() error { @@ -381,10 +386,6 @@ func ReconcileOVNController(ctx context.Context, instance *corev1beta1.OpenStack OVNController.Spec.OvnContainerImage = *version.Status.ContainerImages.OvnControllerImage OVNController.Spec.OvsContainerImage = *version.Status.ContainerImages.OvnControllerOvsImage - if OVNController.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - OVNController.Spec.NodeSelector = instance.Spec.NodeSelector - } - err := controllerutil.SetControllerReference(helper.GetBeforeObject(), OVNController, helper.GetScheme()) if err != nil { return err diff --git a/pkg/openstack/placement.go b/pkg/openstack/placement.go index db0848fa8..6c6381227 100644 --- a/pkg/openstack/placement.go +++ b/pkg/openstack/placement.go @@ -41,6 +41,10 @@ func ReconcilePlacementAPI(ctx context.Context, instance *corev1beta1.OpenStackC instance.Spec.Placement.Template = &placementv1.PlacementAPISpecCore{} } + if instance.Spec.Placement.Template.NodeSelector == nil { + instance.Spec.Placement.Template.NodeSelector = &instance.Spec.NodeSelector + } + // add selector to service overrides for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { if instance.Spec.Placement.Template.Override.Service == nil { @@ -108,9 +112,6 @@ func ReconcilePlacementAPI(ctx context.Context, instance *corev1beta1.OpenStackC if placementAPI.Spec.Secret == "" { placementAPI.Spec.Secret = instance.Spec.Secret } - if placementAPI.Spec.NodeSelector == nil && instance.Spec.NodeSelector != nil { - placementAPI.Spec.NodeSelector = instance.Spec.NodeSelector - } if placementAPI.Spec.DatabaseInstance == "" { placementAPI.Spec.DatabaseInstance = "openstack" } diff --git a/pkg/openstack/rabbitmq.go b/pkg/openstack/rabbitmq.go index cbe7c21f9..c1f3ef979 100644 --- a/pkg/openstack/rabbitmq.go +++ b/pkg/openstack/rabbitmq.go @@ -310,6 +310,18 @@ func reconcileRabbitMQ( tlsCert = certSecret.Name } + if spec.Override.StatefulSet == nil { + spec.Override.StatefulSet = &defaultStatefulSet + } + + if spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector == nil { + if spec.NodeSelector != nil { + spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector = *spec.NodeSelector + } else { + spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector = instance.Spec.NodeSelector + } + } + op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), rabbitmq, func() error { rabbitmq.Spec.Image = *version.Status.ContainerImages.RabbitmqImage @@ -362,11 +374,6 @@ func reconcileRabbitMQ( rabbitmq.Spec.Persistence.StorageClassName = &instance.Spec.StorageClass } - if rabbitmq.Spec.Override.StatefulSet == nil { - Log.Info("Setting StatefulSet") - rabbitmq.Spec.Override.StatefulSet = &defaultStatefulSet - } - if rabbitmq.Spec.Override.Service != nil && rabbitmq.Spec.Override.Service.Spec != nil && rabbitmq.Spec.Override.Service.Spec.Type == corev1.ServiceTypeLoadBalancer { diff --git a/pkg/openstack/redis.go b/pkg/openstack/redis.go index 28b2881e7..33b161572 100644 --- a/pkg/openstack/redis.go +++ b/pkg/openstack/redis.go @@ -219,6 +219,10 @@ func reconcileRedis( tlsCert = certSecret.Name } + if spec.NodeSelector == nil { + spec.NodeSelector = &instance.Spec.NodeSelector + } + op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), redis, func() error { spec.DeepCopyInto(&redis.Spec.RedisSpecCore) if tlsCert != "" { diff --git a/pkg/openstack/swift.go b/pkg/openstack/swift.go index afcc04c77..700e51315 100644 --- a/pkg/openstack/swift.go +++ b/pkg/openstack/swift.go @@ -46,6 +46,10 @@ func ReconcileSwift(ctx context.Context, instance *corev1beta1.OpenStackControlP instance.Spec.Swift.Template = &swiftv1.SwiftSpecCore{} } + if instance.Spec.Swift.Template.NodeSelector == nil { + instance.Spec.Swift.Template.NodeSelector = &instance.Spec.NodeSelector + } + // add selector to service overrides for _, endpointType := range []service.Endpoint{service.EndpointPublic, service.EndpointInternal} { if instance.Spec.Swift.Template.SwiftProxy.Override.Service == nil { diff --git a/pkg/openstack/telemetry.go b/pkg/openstack/telemetry.go index b9e08f9d7..9c72e91dc 100644 --- a/pkg/openstack/telemetry.go +++ b/pkg/openstack/telemetry.go @@ -58,6 +58,10 @@ func ReconcileTelemetry(ctx context.Context, instance *corev1beta1.OpenStackCont instance.Spec.Telemetry.Template = &telemetryv1.TelemetrySpecCore{} } + if instance.Spec.Telemetry.Template.NodeSelector == nil { + instance.Spec.Telemetry.Template.NodeSelector = &instance.Spec.NodeSelector + } + if err := helper.GetClient().Get(ctx, types.NamespacedName{Name: "telemetry", Namespace: instance.Namespace}, telemetry); err != nil { if !k8s_errors.IsNotFound(err) { return ctrl.Result{}, err diff --git a/pkg/openstackclient/funcs.go b/pkg/openstackclient/funcs.go index 661ce4302..c3975efea 100644 --- a/pkg/openstackclient/funcs.go +++ b/pkg/openstackclient/funcs.go @@ -87,8 +87,8 @@ func ClientPodSpec( }, } - if instance.Spec.NodeSelector != nil && len(instance.Spec.NodeSelector) > 0 { - podSpec.NodeSelector = instance.Spec.NodeSelector + if instance.Spec.NodeSelector != nil { + podSpec.NodeSelector = *instance.Spec.NodeSelector } return podSpec diff --git a/tests/functional/ctlplane/openstackoperator_controller_test.go b/tests/functional/ctlplane/openstackoperator_controller_test.go index a9a772281..176103433 100644 --- a/tests/functional/ctlplane/openstackoperator_controller_test.go +++ b/tests/functional/ctlplane/openstackoperator_controller_test.go @@ -1798,6 +1798,203 @@ 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), + ) + + Eventually(func(g Gomega) { + keystoneAPI := keystone.GetKeystoneAPI(names.KeystoneAPIName) + g.Expect(keystoneAPI).Should(Not(BeNil())) + }, timeout, interval).Should(Succeed()) + keystone.SimulateKeystoneAPIReady(names.KeystoneAPIName) + + Eventually(func(g Gomega) { + osversion := GetOpenStackVersion(names.OpenStackControlplaneName) + g.Expect(osversion).Should(Not(BeNil())) + + th.ExpectCondition( + names.OpenStackVersionName, + ConditionGetterFunc(OpenStackVersionConditionGetter), + corev1.OpenStackVersionInitialized, + k8s_corev1.ConditionTrue, + ) + }, timeout, interval).Should(Succeed()) + + th.CreateSecret(types.NamespacedName{Name: "openstack-config-secret", Namespace: namespace}, map[string][]byte{"secure.yaml": []byte("foo")}) + th.CreateConfigMap(types.NamespacedName{Name: "openstack-config", Namespace: namespace}, map[string]interface{}{"clouds.yaml": string("foo"), "OS_CLOUD": "default"}) + }) + + It("sets nodeSelector in resource specs", func() { + Eventually(func(g Gomega) { + osc := th.GetPod(names.OpenStackClientName) + g.Expect(osc.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + 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) { + rmq := GetRabbitMQCluster(names.RabbitMQName) + g.Expect(rmq.Spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + + }) + + It("updates nodeSelector in resource specs when changed", func() { + Eventually(func(g Gomega) { + osc := th.GetPod(names.OpenStackClientName) + g.Expect(osc.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + 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) { + rmq := GetRabbitMQCluster(names.RabbitMQName) + g.Expect(rmq.Spec.Override.StatefulSet.Spec.Template.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) { + osc := th.GetPod(names.OpenStackClientName) + g.Expect(osc.Spec.NodeSelector).To(Equal(map[string]string{"foo2": "bar2"})) + }, 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) { + rmq := GetRabbitMQCluster(names.RabbitMQName) + g.Expect(rmq.Spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector).To(Equal(map[string]string{"foo2": "bar2"})) + }, timeout, interval).Should(Succeed()) + }) + + It("allows nodeSelector service override", func() { + Eventually(func(g Gomega) { + osc := th.GetPod(names.OpenStackClientName) + g.Expect(osc.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + 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) { + rmq := GetRabbitMQCluster(names.RabbitMQName) + g.Expect(rmq.Spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + + Eventually(func(g Gomega) { + OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName) + + oscNodeSelector := map[string]string{ + "foo": "osc", + } + OSCtlplane.Spec.OpenStackClient.Template.NodeSelector = &oscNodeSelector + + galeraNodeSelector := map[string]string{ + "foo": "galera", + } + galeraTemplates := *(OSCtlplane.Spec.Galera.Templates) + dbTemplate := galeraTemplates[names.DBName.Name] + dbTemplate.NodeSelector = &galeraNodeSelector + galeraTemplates[names.DBName.Name] = dbTemplate + OSCtlplane.Spec.Galera.Templates = &galeraTemplates + + rmqNodeSelector := map[string]string{ + "foo": "rmq", + } + rmqTemplates := *OSCtlplane.Spec.Rabbitmq.Templates + rmqTemplate := rmqTemplates[names.RabbitMQName.Name] + rmqTemplate.NodeSelector = &rmqNodeSelector + rmqTemplates[names.RabbitMQName.Name] = rmqTemplate + OSCtlplane.Spec.Rabbitmq.Templates = &rmqTemplates + + g.Expect(k8sClient.Update(ctx, OSCtlplane)).Should(Succeed()) + }, timeout, interval).Should(Succeed()) + + Eventually(func(g Gomega) { + osc := th.GetPod(names.OpenStackClientName) + g.Expect(osc.Spec.NodeSelector).To(Equal(map[string]string{"foo": "osc"})) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBName) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{"foo": "galera"})) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + rmq := GetRabbitMQCluster(names.RabbitMQName) + g.Expect(rmq.Spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector).To(Equal(map[string]string{"foo": "rmq"})) + }, timeout, interval).Should(Succeed()) + }) + + It("allows nodeSelector service override to empty", func() { + Eventually(func(g Gomega) { + osc := th.GetPod(names.OpenStackClientName) + g.Expect(osc.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + 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) { + rmq := GetRabbitMQCluster(names.RabbitMQName) + g.Expect(rmq.Spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector).To(Equal(map[string]string{"foo": "bar"})) + }, timeout, interval).Should(Succeed()) + + Eventually(func(g Gomega) { + OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName) + + oscNodeSelector := map[string]string{} + OSCtlplane.Spec.OpenStackClient.Template.NodeSelector = &oscNodeSelector + + galeraNodeSelector := map[string]string{} + galeraTemplates := *(OSCtlplane.Spec.Galera.Templates) + dbTemplate := galeraTemplates[names.DBName.Name] + dbTemplate.NodeSelector = &galeraNodeSelector + galeraTemplates[names.DBName.Name] = dbTemplate + OSCtlplane.Spec.Galera.Templates = &galeraTemplates + + rmqNodeSelector := map[string]string{} + rmqTemplates := *OSCtlplane.Spec.Rabbitmq.Templates + rmqTemplate := rmqTemplates[names.RabbitMQName.Name] + rmqTemplate.NodeSelector = &rmqNodeSelector + rmqTemplates[names.RabbitMQName.Name] = rmqTemplate + OSCtlplane.Spec.Rabbitmq.Templates = &rmqTemplates + + g.Expect(k8sClient.Update(ctx, OSCtlplane)).Should(Succeed()) + }, timeout, interval).Should(Succeed()) + + Eventually(func(g Gomega) { + osc := th.GetPod(names.OpenStackClientName) + g.Expect(osc.Spec.NodeSelector).To(BeNil()) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + db := mariadb.GetGalera(names.DBName) + g.Expect(*db.Spec.NodeSelector).To(Equal(map[string]string{})) + }, timeout, interval).Should(Succeed()) + Eventually(func(g Gomega) { + rmq := GetRabbitMQCluster(names.RabbitMQName) + g.Expect(rmq.Spec.Override.StatefulSet.Spec.Template.Spec.NodeSelector).To(BeNil()) + }, timeout, interval).Should(Succeed()) + }) + }) + }) var _ = Describe("OpenStackOperator Webhook", func() { diff --git a/tests/kuttl/tests/ctlplane-nodeselectors/01-assert-deploy-openstack.yaml b/tests/kuttl/tests/ctlplane-nodeselectors/01-assert-deploy-openstack.yaml new file mode 120000 index 000000000..762a8cf31 --- /dev/null +++ b/tests/kuttl/tests/ctlplane-nodeselectors/01-assert-deploy-openstack.yaml @@ -0,0 +1 @@ +../../common/assert-sample-deployment.yaml \ No newline at end of file diff --git a/tests/kuttl/tests/ctlplane-nodeselectors/01-deploy-openstack.yaml b/tests/kuttl/tests/ctlplane-nodeselectors/01-deploy-openstack.yaml new file mode 100644 index 000000000..bfffa10c8 --- /dev/null +++ b/tests/kuttl/tests/ctlplane-nodeselectors/01-deploy-openstack.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc kustomize ../../../../config/samples/nodeselectors/global | oc apply -n $NAMESPACE -f - diff --git a/tests/kuttl/tests/ctlplane-nodeselectors/02-assert-nodeselector.yaml b/tests/kuttl/tests/ctlplane-nodeselectors/02-assert-nodeselector.yaml new file mode 100644 index 000000000..dfb3f117a --- /dev/null +++ b/tests/kuttl/tests/ctlplane-nodeselectors/02-assert-nodeselector.yaml @@ -0,0 +1,23 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: | + echo "Checking all pods have expected nodeselector" + EXPECTED_NODE_SELECTOR="node-role.kubernetes.io/worker:" + BAD_OR_MISSING_NODE_SELECTOR=$(oc get pods -n $NAMESPACE -l service!=dnsmasq -o=go-template --template='{{ range .items }}{{ .metadata.name}}: {{ .spec.nodeSelector }}{{"\n"}}{{ end }}' | grep -v 'ovn-controller-.*-config' | sed -e '\!map\['"$EXPECTED_NODE_SELECTOR"'\]$!d') + BAD_OR_MISSING_NODE_SELECTOR_COUNT=$(echo -n "$BAD_OR_MISSING_NODE_SELECTOR" | wc -l) + if [ $BAD_OR_MISSING_NODE_SELECTOR_COUNT -ne 0 ]; then + echo "Found $BAD_OR_MISSING_NODE_SELECTOR_COUNT pods with bad or missing nodeselector:" + echo "$BAD_OR_MISSING_NODE_SELECTOR" + exit 1 + fi + - script: | + echo "Checking all cronjobs have expected nodeselector" + EXPECTED_NODE_SELECTOR="node-role.kubernetes.io/worker:" + BAD_OR_MISSING_NODE_SELECTOR=$(oc get cronjobs -n $NAMESPACE -o=go-template --template='{{ range .items }}{{ .metadata.name}}: {{ .spec.jobTemplate.spec.template.spec.nodeSelector }}{{"\n"}}{{ end }}' | grep -v 'ovn-controller-.*-config' | sed -e '\!map\['"$EXPECTED_NODE_SELECTOR"'\]$!d') + BAD_OR_MISSING_NODE_SELECTOR_COUNT=$(echo -n "$BAD_OR_MISSING_NODE_SELECTOR" | wc -l) + if [ $BAD_OR_MISSING_NODE_SELECTOR_COUNT -ne 0 ]; then + echo "Found $BAD_OR_MISSING_NODE_SELECTOR_COUNT cronjobs with bad or missing nodeselector:" + echo "$BAD_OR_MISSING_NODE_SELECTOR" + exit 1 + fi diff --git a/tests/kuttl/tests/ctlplane-nodeselectors/03-assert-deploy-openstack.yaml b/tests/kuttl/tests/ctlplane-nodeselectors/03-assert-deploy-openstack.yaml new file mode 120000 index 000000000..762a8cf31 --- /dev/null +++ b/tests/kuttl/tests/ctlplane-nodeselectors/03-assert-deploy-openstack.yaml @@ -0,0 +1 @@ +../../common/assert-sample-deployment.yaml \ No newline at end of file diff --git a/tests/kuttl/tests/ctlplane-nodeselectors/03-update-nodeselector.yaml b/tests/kuttl/tests/ctlplane-nodeselectors/03-update-nodeselector.yaml new file mode 100644 index 000000000..2d50bda2e --- /dev/null +++ b/tests/kuttl/tests/ctlplane-nodeselectors/03-update-nodeselector.yaml @@ -0,0 +1,16 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +timeout: 60 +commands: + - script: | + oc patch dnsmasq -n $NAMESPACE dnsmasq --type='json' -p='[{ + "op": "replace", + "path": "/spec/nodeSelector", + "value": {"kubernetes.io/os":"linux"} + }]' + - script: | + oc patch openstackcontrolplane -n $NAMESPACE openstack --type='json' -p='[{ + "op": "replace", + "path": "/spec/nodeSelector", + "value": {"kubernetes.io/os":"linux"} + }]' diff --git a/tests/kuttl/tests/ctlplane-nodeselectors/04-assert-nodeselector.yaml b/tests/kuttl/tests/ctlplane-nodeselectors/04-assert-nodeselector.yaml new file mode 100644 index 000000000..031ccccc3 --- /dev/null +++ b/tests/kuttl/tests/ctlplane-nodeselectors/04-assert-nodeselector.yaml @@ -0,0 +1,23 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: | + echo "Checking all running pods have new nodeselector" + EXPECTED_NODE_SELECTOR="kubernetes.io/os:linux" + BAD_OR_MISSING_NODE_SELECTOR=$(oc get pods -n $NAMESPACE -l service!=dnsmasq --field-selector=status.phase=Running -o=go-template --template='{{ range .items }}{{ .metadata.name}}: {{ .spec.nodeSelector }}{{"\n"}}{{ end }}' | grep -v 'ovn-controller-.*-config' | sed -e '\!map\['"$EXPECTED_NODE_SELECTOR"'\]$!d') + BAD_OR_MISSING_NODE_SELECTOR_COUNT=$(echo -n "$BAD_OR_MISSING_NODE_SELECTOR" | wc -l) + if [ $BAD_OR_MISSING_NODE_SELECTOR_COUNT -ne 0 ]; then + echo "Found $BAD_OR_MISSING_NODE_SELECTOR_COUNT pods with bad or missing nodeselector:" + echo "$BAD_OR_MISSING_NODE_SELECTOR" + exit 1 + fi + - script: | + echo "Checking all cronjobs have expected nodeselector" + EXPECTED_NODE_SELECTOR="kubernetes.io/os:linux" + BAD_OR_MISSING_NODE_SELECTOR=$(oc get cronjobs -n $NAMESPACE -o=go-template --template='{{ range .items }}{{ .metadata.name}}: {{ .spec.jobTemplate.spec.template.spec.nodeSelector }}{{"\n"}}{{ end }}' | grep -v 'ovn-controller-.*-config' | sed -e '\!map\['"$EXPECTED_NODE_SELECTOR"'\]$!d') + BAD_OR_MISSING_NODE_SELECTOR_COUNT=$(echo -n "$BAD_OR_MISSING_NODE_SELECTOR" | wc -l) + if [ $BAD_OR_MISSING_NODE_SELECTOR_COUNT -ne 0 ]; then + echo "Found $BAD_OR_MISSING_NODE_SELECTOR_COUNT cronjobs with bad or missing nodeselector:" + echo "$BAD_OR_MISSING_NODE_SELECTOR" + exit 1 + fi diff --git a/tests/kuttl/tests/ctlplane-nodeselectors/05-cleanup.yaml b/tests/kuttl/tests/ctlplane-nodeselectors/05-cleanup.yaml new file mode 100644 index 000000000..6b4992512 --- /dev/null +++ b/tests/kuttl/tests/ctlplane-nodeselectors/05-cleanup.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +delete: +- apiVersion: core.openstack.org/v1beta1 + kind: OpenStackControlPlane + name: openstack +commands: +- script: | + oc delete --ignore-not-found=true -n $NAMESPACE pvc \ + srv-swift-storage-0 + oc delete secret --ignore-not-found=true combined-ca-bundle -n $NAMESPACE + oc delete secret -l service-cert -n $NAMESPACE + oc delete secret -l ca-cert -n $NAMESPACE diff --git a/tests/kuttl/tests/ctlplane-nodeselectors/05-errors-cleanup.yaml b/tests/kuttl/tests/ctlplane-nodeselectors/05-errors-cleanup.yaml new file mode 120000 index 000000000..4d7b8362e --- /dev/null +++ b/tests/kuttl/tests/ctlplane-nodeselectors/05-errors-cleanup.yaml @@ -0,0 +1 @@ +../../common/errors_cleanup_openstack.yaml \ No newline at end of file