Skip to content

Commit 104281a

Browse files
committed
Add Notfications message bus instance for Nova CRD
Extend CRDs to support a RabbitMqCluster reference as AMQP instance for notifications. To provide a way for human user to define the notifications bus for Nova CR via the OpenStackControlPlane CR's nova section, add a new field to the NovaSpecCore as that is the struct used when the OpenStackControlPlaneSpec struct is defined. At NovaSpec level having just "" or a name of the bus is OK as either we need a bus, or we don't need notifications at all. However, for empedded NovaSpecCore we might need the 3rd possibility to "inherit from somewhere higher", which we represent as: *string field where null means inherit, "" means disable notification, "foo" means send notification to bus foo. Extract common keys for both structures into a base structure in order to have a clean overloading for it in NovaSpec and NovaSpecCore. Note that overriding NotificationsBusInstance for cells is not supported as that implies that consumers of notifications can maintain simultanous AMQP connections via multiple transport_url endpoints, which is not a thing in Openstack. Assume that in the implementation the required information will be transferred via the existing internal secret via notifications specific transport_url key (as the transport_url key is already taken by the RPC bus value). Thus we do not modify other Nova services' CRDs. Signed-off-by: Bohdan Dobrelia <bdobreli@redhat.com>
1 parent 41e39c1 commit 104281a

5 files changed

Lines changed: 69 additions & 5 deletions

File tree

‎api/bases/nova.openstack.org_nova.yaml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,6 +1624,16 @@ spec:
16241624
NodeSelector here acts as a default value and can be overridden by service
16251625
specific NodeSelector Settings.
16261626
type: object
1627+
notificationsBusInstance:
1628+
default: ""
1629+
description: |-
1630+
NotificationsBusInstance is the name of the RabbitMqCluster CR to select
1631+
the Message Bus Service instance used by the Nova top level services and all cells to publish notifications.
1632+
Nil value means inherit it from a global OpenStackControlPlane field.
1633+
An empty value "" leaves the notification drivers unconfigured and emitting no notifications at all.
1634+
Avoid colocating it with APIMessageBusInstance or CellMessageBusInstance used for PRC.
1635+
For particular Nova cells, notifications cannot be disabled, nor configured differently.
1636+
type: string
16271637
novncproxyContainerImageURL:
16281638
description: NoVNCContainerImageURL
16291639
type: string

‎api/v1beta1/nova_types.go‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2021
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2122
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22-
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2323
)
2424

2525
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2626
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2727

28-
// NovaSpecCore defines the template for NovaSpec used in OpenStackControlPlane
29-
type NovaSpecCore struct {
28+
// NovaSpecBase defines common data fields of the same type
29+
// which may be submitted by the openstack-operator for us and also overriden by users.
30+
type NovaSpecBase struct {
3031
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
3132
// Important: Run "make" to regenerate code after modifying this file
3233

@@ -124,13 +125,35 @@ type NovaSpecCore struct {
124125
TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"`
125126
}
126127

128+
// NovaSpecCore defines the template for NovaSpec used in OpenStackControlPlane
129+
type NovaSpecCore struct {
130+
NovaSpecBase `json:",inline"`
131+
132+
// +kubebuilder:validation:Optional
133+
// NotificationsBusInstance is the name of the RabbitMqCluster CR to select
134+
// the Message Bus Service instance used by the Nova top level services and all cells to publish notifications.
135+
// Nil value means inherit it from a global OpenStackControlPlane field.
136+
// An empty value "" leaves the notification drivers unconfigured and emitting no notifications at all.
137+
// Avoid colocating it with APIMessageBusInstance or CellMessageBusInstance used for PRC.
138+
// For particular Nova cells, notifications cannot be disabled, nor configured differently.
139+
NotificationsBusInstance *string `json:"notificationsBusInstance"`
140+
}
141+
127142
// NovaSpec defines the desired state of Nova
128143
type NovaSpec struct {
129144
// +kubebuilder:validation:Required
145+
// Anything that is only submitted by opentack-operator should be in NovaSpec but not in NovaSpecCore.
130146
NovaSpecCore `json:",inline"`
131147

132148
// +kubebuilder:validation:Required
149+
// NovaImages data submitted by the opentack-operator.
133150
NovaImages `json:",inline"`
151+
152+
// +kubebuilder:validation:Optional
153+
// +kubebuilder:default=""
154+
// NotificationsBusInstance data submitted by the opentack-operator.
155+
// This either contains an inherited value, or an override value from NovaSpecCore.
156+
NotificationsBusInstance string `json:"notificationsBusInstance"`
134157
}
135158

136159
// NovaStatus defines the observed state of Nova

‎api/v1beta1/novacell_types.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2021
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2122
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
2223
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23-
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2424
)
2525

2626
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

‎api/v1beta1/zz_generated.deepcopy.go‎

Lines changed: 22 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎config/crd/bases/nova.openstack.org_nova.yaml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,6 +1624,16 @@ spec:
16241624
NodeSelector here acts as a default value and can be overridden by service
16251625
specific NodeSelector Settings.
16261626
type: object
1627+
notificationsBusInstance:
1628+
default: ""
1629+
description: |-
1630+
NotificationsBusInstance is the name of the RabbitMqCluster CR to select
1631+
the Message Bus Service instance used by the Nova top level services and all cells to publish notifications.
1632+
Nil value means inherit it from a global OpenStackControlPlane field.
1633+
An empty value "" leaves the notification drivers unconfigured and emitting no notifications at all.
1634+
Avoid colocating it with APIMessageBusInstance or CellMessageBusInstance used for PRC.
1635+
For particular Nova cells, notifications cannot be disabled, nor configured differently.
1636+
type: string
16271637
novncproxyContainerImageURL:
16281638
description: NoVNCContainerImageURL
16291639
type: string

0 commit comments

Comments
 (0)