Skip to content

Commit d40bd87

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 RabbitMQCluster 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. Provide a special handling for an empty value, which provides 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.Enabled then if novaSpecScore.NotificationBusInstance == nil then NovaSpec.NotificationsBusInstance := \ OpenStackControlPlaneSpec.NotificationsBus.RabbitMQCluster else NovaSpec.NotificationsBusInstance := \ NovaSpecScore.NotificationsBusInstance else // not enabled NovaSpec.NotificationsBusInstance := "" 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 330f8ad commit d40bd87

5 files changed

Lines changed: 71 additions & 1 deletion

File tree

‎apis/bases/core.openstack.org_openstackcontrolplanes.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9015,6 +9015,15 @@ spec:
90159015
additionalProperties:
90169016
type: string
90179017
type: object
9018+
notificationsBus:
9019+
properties:
9020+
enabled:
9021+
default: true
9022+
type: boolean
9023+
rabbitMQCluster:
9024+
default: ""
9025+
type: string
9026+
type: object
90189027
nova:
90199028
properties:
90209029
apiOverride:

‎apis/core/v1beta1/openstackcontrolplane_types.go‎

Lines changed: 28 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,32 @@ 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+
// NotificationsBusSection defines the desired state of AMQP messaging Bus Services for producers and consumers of notifications
497+
type NotificationsBusSection struct {
498+
// +kubebuilder:validation:Optional
499+
// +kubebuilder:default=true
500+
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
501+
// Enabled - Whether Notifications Bus Service should be configured for all services that need it.
502+
// When enabled, leaves a possibility for each service to override the configuration, or disable notifications only for itself.
503+
// When disabled, leaves the notification drivers of all services unconfigured and emitting no notifications at all.
504+
// A Disabled value ignores any overrides provided in the services templates.
505+
Enabled bool `json:"enabled"`
506+
507+
// +kubebuilder:validation:Optional
508+
// +kubebuilder:default=""
509+
// RabbitMQCluster is the name of RabbitMQ Cluster CR to select a Messages
510+
// Bus Service instance used by all services that produce or consume notifications.
511+
// Avoid colocating it with RabbitMQ services used for PRC.
512+
// If empty, no configuration will be pushed down for services, which provides backward compatibility during upgrades.
513+
// When also unconfigured in the services templates, the services apply their default behavoir.
514+
// A regular value is pushed down for all services. Services may override it in templates.
515+
RabbitMQCluster string `json:"rabbitMQCluster"`
516+
}
517+
491518
// MemcachedSection defines the desired state of Memcached services
492519
type MemcachedSection struct {
493520
// +kubebuilder:validation:Optional

‎apis/core/v1beta1/zz_generated.deepcopy.go‎

Lines changed: 16 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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9179,6 +9179,15 @@ spec:
91799179
additionalProperties:
91809180
type: string
91819181
type: object
9182+
notificationsBus:
9183+
properties:
9184+
enabled:
9185+
default: true
9186+
type: boolean
9187+
rabbitMQCluster:
9188+
default: ""
9189+
type: string
9190+
type: object
91829191
nova:
91839192
properties:
91849193
apiOverride:

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9015,6 +9015,15 @@ spec:
90159015
additionalProperties:
90169016
type: string
90179017
type: object
9018+
notificationsBus:
9019+
properties:
9020+
enabled:
9021+
default: true
9022+
type: boolean
9023+
rabbitMQCluster:
9024+
default: ""
9025+
type: string
9026+
type: object
90189027
nova:
90199028
properties:
90209029
apiOverride:

0 commit comments

Comments
 (0)