Skip to content

Commit aa5c12c

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 bd5d835 commit aa5c12c

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
@@ -9855,6 +9855,8 @@ spec:
98559855
additionalProperties:
98569856
type: string
98579857
type: object
9858+
notificationsBusInstance:
9859+
type: string
98589860
nova:
98599861
properties:
98609862
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
@@ -10021,6 +10021,8 @@ spec:
1002110021
additionalProperties:
1002210022
type: string
1002310023
type: object
10024+
notificationsBusInstance:
10025+
type: string
1002410026
nova:
1002510027
properties:
1002610028
apiOverride:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9855,6 +9855,8 @@ spec:
98559855
additionalProperties:
98569856
type: string
98579857
type: object
9858+
notificationsBusInstance:
9859+
type: string
98589860
nova:
98599861
properties:
98609862
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)