Skip to content

Commit 029bd3e

Browse files
committed
Add NotificationsBusInstance API field
This patch introduces the notificationsBusInstance parameters at API level. When an override is not defined, it is propagated to the underlying storage components where this field is implemented. Signed-off-by: Francesco Pantano <[email protected]>
1 parent 8b12772 commit 029bd3e

File tree

8 files changed

+36
-0
lines changed

8 files changed

+36
-0
lines changed

apis/bases/core.openstack.org_openstackcontrolplanes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9584,6 +9584,8 @@ spec:
95849584
additionalProperties:
95859585
type: string
95869586
type: object
9587+
notificationsBusInstance:
9588+
type: string
95879589
nova:
95889590
properties:
95899591
apiOverride:

apis/core/v1beta1/openstackcontrolplane_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ type OpenStackControlPlaneSpec struct {
127127
// Rabbitmq - Parameters related to the Rabbitmq service
128128
Rabbitmq RabbitmqSection `json:"rabbitmq,omitempty"`
129129

130+
// +kubebuilder:validation:Optional
131+
// NotificationsBusInstance - the name of RabbitMQ Cluster CR to select a Messaging
132+
// Bus Service instance used by all services that produce or consume notifications.
133+
// Avoid colocating it with RabbitMQ services used for PRC.
134+
// That instance will be pushed down for services, unless overriden in templates.
135+
NotificationsBusInstance *string `json:"notificationsBusInstance,omitempty"`
136+
130137
// +kubebuilder:validation:Optional
131138
// +operator-sdk:csv:customresourcedefinitions:type=spec
132139
// Memcached - Parameters related to the Memcached service

apis/core/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9748,6 +9748,8 @@ spec:
97489748
additionalProperties:
97499749
type: string
97509750
type: object
9751+
notificationsBusInstance:
9752+
type: string
97519753
nova:
97529754
properties:
97539755
apiOverride:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9584,6 +9584,8 @@ spec:
95849584
additionalProperties:
95859585
type: string
95869586
type: object
9587+
notificationsBusInstance:
9588+
type: string
95879589
nova:
95889590
properties:
95899591
apiOverride:

pkg/openstack/cinder.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ func ReconcileCinder(ctx context.Context, instance *corev1beta1.OpenStackControl
130130
instance.Spec.Cinder.Template.TopologyRef = instance.Spec.TopologyRef
131131
}
132132

133+
// When no NotificationsBusInstance is referenced in the subCR (override)
134+
// try to inject the top-level one if defined
135+
if instance.Spec.Cinder.Template.NotificationsBusInstance == nil {
136+
instance.Spec.Cinder.Template.NotificationsBusInstance = instance.Spec.NotificationsBusInstance
137+
}
138+
133139
Log.Info("Reconciling Cinder", "Cinder.Namespace", instance.Namespace, "Cinder.Name", cinderName)
134140
op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), cinder, func() error {
135141
instance.Spec.Cinder.Template.CinderSpecBase.DeepCopyInto(&cinder.Spec.CinderSpecBase)

pkg/openstack/glance.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl
7474
instance.Spec.Glance.Template.TopologyRef = instance.Spec.TopologyRef
7575
}
7676

77+
// When no NotificationsBusInstance is referenced in the subCR (override)
78+
// try to inject the top-level one if defined
79+
if instance.Spec.Glance.Template.NotificationBusInstance == nil {
80+
instance.Spec.Glance.Template.NotificationBusInstance = instance.Spec.NotificationsBusInstance
81+
}
82+
7783
// When component services got created check if there is the need to create a route
7884
if err := helper.GetClient().Get(ctx, types.NamespacedName{Name: glanceName, Namespace: instance.Namespace}, glance); err != nil {
7985
if !k8s_errors.IsNotFound(err) {

pkg/openstack/manila.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ func ReconcileManila(ctx context.Context, instance *corev1beta1.OpenStackControl
118118
instance.Spec.Manila.Template.TopologyRef = instance.Spec.TopologyRef
119119
}
120120

121+
// When no NotificationsBusInstance is referenced in the subCR (override)
122+
// try to inject the top-level one if defined
123+
if instance.Spec.Manila.Template.NotificationsBusInstance == nil {
124+
instance.Spec.Manila.Template.NotificationsBusInstance = instance.Spec.NotificationsBusInstance
125+
}
126+
121127
Log.Info("Reconciling Manila", "Manila.Namespace", instance.Namespace, "Manila.Name", "manila")
122128
op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), manila, func() error {
123129
instance.Spec.Manila.Template.ManilaSpecBase.DeepCopyInto(&manila.Spec.ManilaSpecBase)

0 commit comments

Comments
 (0)