Skip to content

Commit f4eee4f

Browse files
committed
Common Notifications bus interface for services
Add a top level field in OpenStackControlPlaneSpec field that holds a a RabbitMQ cluster CR name reference to be used for publishing and consuming of notifications in the managed OpenStack instance. Allow overriding it in OpenStack services templates. 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 not expandable into supporting additional messaging backends (provided via direct transport_url secret refs, or the like). For that, the structure should be used instead of a simple string value. Assume openstack-operator controller should implement a basic inheritance mechanism from the top level field to the service template based on the following rules: if OSCP.Spec.<service_name>.Template.NotificationsBusInstance == nil OSCP.Spec.<service_name>.Template.NotificationsBusInstance = \ OSCP.Spec.NotificationsBus.RabbitMqClusterName 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 across the board. Signed-off-by: Bohdan Dobrelia <bdobreli@redhat.com>
1 parent 7b57a2e commit f4eee4f

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
@@ -9498,6 +9498,11 @@ spec:
94989498
additionalProperties:
94999499
type: string
95009500
type: object
9501+
notificationsBus:
9502+
properties:
9503+
rabbitMqClusterName:
9504+
type: string
9505+
type: object
95019506
nova:
95029507
properties:
95039508
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
@@ -9662,6 +9662,11 @@ spec:
96629662
additionalProperties:
96639663
type: string
96649664
type: object
9665+
notificationsBus:
9666+
properties:
9667+
rabbitMqClusterName:
9668+
type: string
9669+
type: object
96659670
nova:
96669671
properties:
96679672
apiOverride:

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9498,6 +9498,11 @@ spec:
94989498
additionalProperties:
94999499
type: string
95009500
type: object
9501+
notificationsBus:
9502+
properties:
9503+
rabbitMqClusterName:
9504+
type: string
9505+
type: object
95019506
nova:
95029507
properties:
95039508
apiOverride:

0 commit comments

Comments
 (0)