Skip to content

Commit 814b46d

Browse files
committed
Common Notifications bus interface for services
Add a top level field in OpenStackControlPlaneSpec field that holds a strusture with an enablement flag and a RabbitMQ cluster CR name ref to be used with notifications in the managed OpenStack instance. Allow overriding it in OpenStack services templates, or disabling notifications for all of them at the top level. Note about a special handling expected for an empty value by the services that will be supporting this interface. It should provide backwards compatibility during oscp and services CRDs upgrades. The proposed CRD design is expandable into supporting additional messaging backends (provided via direct transport_url secret refs, or the like). Assume openstack-operator controller should implement a basic inheritance mechanism from the top level field to the Nova service (as a 1st implementation step example) based on the following rules: if OpenStackControlPlaneSpec.NotificationsBus.RabbitMQCluster is not nil then NovaSpec.NotificationsBusInstance := \ OpenStackControlPlaneSpec.NotificationsBus.RabbitMQCluster if OpenStackControlPlaneSpec.NotificationsBus.RabbitMQCluster == "" then force disable notifications for services else NovaSpec.NotificationsBusInstance := \ NovaSpecScore.NotificationsBusInstance or nil We leave further handling of empty values for the services specific implementation. Assume a similar pattern to be applied later for KeystoneAPI.Spec.RabbitMqClusterName and other services that need to consume or publish notifications to keep things consistent accross the board.. Signed-off-by: Bohdan Dobrelia <bdobreli@redhat.com>
1 parent 1ec2176 commit 814b46d

5 files changed

Lines changed: 58 additions & 1 deletion

File tree

apis/bases/core.openstack.org_openstackcontrolplanes.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9015,6 +9015,11 @@ spec:
90159015
additionalProperties:
90169016
type: string
90179017
type: object
9018+
notificationsBus:
9019+
properties:
9020+
rabbitMqClusterName:
9021+
type: string
9022+
type: object
90189023
nova:
90199024
properties:
90209025
apiOverride:

apis/core/v1beta1/openstackcontrolplane_types.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ type OpenStackControlPlaneSpec struct {
126126
// Rabbitmq - Parameters related to the Rabbitmq service
127127
Rabbitmq RabbitmqSection `json:"rabbitmq,omitempty"`
128128

129+
// +kubebuilder:validation:Optional
130+
// +operator-sdk:csv:customresourcedefinitions:type=spec
131+
// NotificationsBusSection - Parameters related to the Notifications Bus services
132+
NotificationsBus NotificationsBusSection `json:"notificationsBus,omitempty"`
133+
129134
// +kubebuilder:validation:Optional
130135
// +operator-sdk:csv:customresourcedefinitions:type=spec
131136
// Memcached - Parameters related to the Memcached service
@@ -484,10 +489,26 @@ type RabbitmqSection struct {
484489

485490
// +kubebuilder:validation:Optional
486491
// +operator-sdk:csv:customresourcedefinitions:type=spec
487-
// Templates - Overrides to use when creating the Rabbitmq clusters
492+
// Templates - Overrides to use when creating the Rabbitmq clusters for RPC and (optionally) Notifications.
488493
Templates *map[string]rabbitmqv1.RabbitMqSpecCore `json:"templates"`
489494
}
490495

496+
// TODO(bogdando): keep this updated as the list of services that support this interface extends.
497+
498+
// NotificationsBusSection defines the desired state of AMQP messaging Bus Services for producers and consumers of notifications
499+
type NotificationsBusSection struct {
500+
// +kubebuilder:validation:Optional
501+
// The name of RabbitMQ Cluster CR to select a Messaging
502+
// Bus Service instance used by all services that produce or consume notifications.
503+
// Avoid colocating it with RabbitMQ services used for PRC.
504+
// That instance will be pushed down for services, unless overriden in templates.
505+
// An empty value disables notifications drivers, and makes the services emitting no notifications at all.
506+
// When undefined, no configuration will be pushed down for services, which provides backward compatibility during upgrades,
507+
// and leaves a possibility for services to override the configuration, stick with its default behavior, or disable notifications only for itself.
508+
// Services that support this global configuration interface include: Nova
509+
RabbitMqClusterName *string `json:"rabbitMqClusterName,omitempty"`
510+
}
511+
491512
// MemcachedSection defines the desired state of Memcached services
492513
type MemcachedSection struct {
493514
// +kubebuilder:validation:Optional

apis/core/v1beta1/zz_generated.deepcopy.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindata/crds/crds.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9179,6 +9179,11 @@ spec:
91799179
additionalProperties:
91809180
type: string
91819181
type: object
9182+
notificationsBus:
9183+
properties:
9184+
rabbitMqClusterName:
9185+
type: string
9186+
type: object
91829187
nova:
91839188
properties:
91849189
apiOverride:

config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9015,6 +9015,11 @@ spec:
90159015
additionalProperties:
90169016
type: string
90179017
type: object
9018+
notificationsBus:
9019+
properties:
9020+
rabbitMqClusterName:
9021+
type: string
9022+
type: object
90189023
nova:
90199024
properties:
90209025
apiOverride:

0 commit comments

Comments
 (0)