diff --git a/api/bases/glance.openstack.org_glances.yaml b/api/bases/glance.openstack.org_glances.yaml index fe81bf60..cf6410f5 100644 --- a/api/bases/glance.openstack.org_glances.yaml +++ b/api/bases/glance.openstack.org_glances.yaml @@ -1560,7 +1560,7 @@ spec: description: NodeSelector to target subset of worker nodes running this service type: object - notificationBusInstance: + notificationsBusInstance: description: |- RabbitMQ instance name Needed to request a transportURL that is created and used for notification diff --git a/api/v1beta1/glance_types.go b/api/v1beta1/glance_types.go index 8b479e78..ca0018d3 100644 --- a/api/v1beta1/glance_types.go +++ b/api/v1beta1/glance_types.go @@ -138,7 +138,7 @@ type GlanceSpecCore struct { // RabbitMQ instance name // Needed to request a transportURL that is created and used for notification // purposes - NotificationBusInstance *string `json:"notificationBusInstance,omitempty"` + NotificationsBusInstance *string `json:"notificationsBusInstance,omitempty"` } // GlanceSpec defines the desired state of Glance diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index f7a0c84c..89c5f268 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -426,8 +426,8 @@ func (in *GlanceSpecCore) DeepCopyInto(out *GlanceSpecCore) { out.Quotas = in.Quotas out.ImageCache = in.ImageCache out.DBPurge = in.DBPurge - if in.NotificationBusInstance != nil { - in, out := &in.NotificationBusInstance, &out.NotificationBusInstance + if in.NotificationsBusInstance != nil { + in, out := &in.NotificationsBusInstance, &out.NotificationsBusInstance *out = new(string) **out = **in } diff --git a/config/crd/bases/glance.openstack.org_glances.yaml b/config/crd/bases/glance.openstack.org_glances.yaml index fe81bf60..cf6410f5 100644 --- a/config/crd/bases/glance.openstack.org_glances.yaml +++ b/config/crd/bases/glance.openstack.org_glances.yaml @@ -1560,7 +1560,7 @@ spec: description: NodeSelector to target subset of worker nodes running this service type: object - notificationBusInstance: + notificationsBusInstance: description: |- RabbitMQ instance name Needed to request a transportURL that is created and used for notification diff --git a/config/samples/layout/base/glance_v1beta1_glance.yaml b/config/samples/layout/base/glance_v1beta1_glance.yaml index 41dddb5e..50b2fa6c 100644 --- a/config/samples/layout/base/glance_v1beta1_glance.yaml +++ b/config/samples/layout/base/glance_v1beta1_glance.yaml @@ -4,7 +4,7 @@ metadata: name: glance spec: serviceUser: glance - notificationBusInstance: rabbitmq + notificationsBusInstance: rabbitmq customServiceConfig: | [DEFAULT] debug = true diff --git a/config/samples/notifications/README.md b/config/samples/notifications/README.md index 8d632ba4..b0c8eefb 100644 --- a/config/samples/notifications/README.md +++ b/config/samples/notifications/README.md @@ -20,14 +20,14 @@ documentation](https://docs.openstack.org/glance/latest/admin/notifications.html ## Enabling Notifications -The `glance-operator` exposes an API parameter called `notificationBusInstance` +The `glance-operator` exposes an API parameter called `notificationsBusInstance` that specifies the RabbitMQ instance name to use for requesting a `TransportURL`. This URL is then configured in the Glance service through a generated `Secret` object. ### Configuration via OpenStackControlPlane -Edit the `OpenStackControlPlane` specification and add the `notificationBusInstance` parameter to the `Glance` template section: +Edit the `OpenStackControlPlane` specification and add the `notificationsBusInstance` parameter to the `Glance` template section: ```yaml ... @@ -35,7 +35,7 @@ spec: ... glance: template: - notificationBusInstance: rabbitmq + notificationsBusInstance: rabbitmq ... ``` @@ -44,7 +44,7 @@ following command: ```bash OSCP=$(oc get oscp -o custom-columns=NAME:.metadata.name --no-headers) -oc -n openstack patch oscp $OSCP --type json -p='[{"op": "add", "path": "/spec/glance/template/notificationBusInstance", "value": "rabbitmq"}]' +oc -n openstack patch oscp $OSCP --type json -p='[{"op": "add", "path": "/spec/glance/template/notificationsBusInstance", "value": "rabbitmq"}]' ``` ### Verification @@ -63,7 +63,7 @@ transport_url = rabbit://:@rabbitmq.openstack.svc:5671/?ssl=1 ## Disabling Notifications When notifications are enabled, you can disable them by reverting the driver -back to `noop`. This is accomplished by removing the `notificationBusInstance` +back to `noop`. This is accomplished by removing the `notificationsBusInstance` parameter from the `Glance` template section in the `OpenStackControlPlane`. This action triggers a reconciliation loop that updates the `GlanceAPI` configuration and initiates a rolling update of the pods. @@ -73,7 +73,7 @@ configuration and initiates a rolling update of the pods. Use the following patch command to remove the notification configuration: ```bash -oc patch openstackcontrolplane openstack-galera -n openstack --type json -p='[{"op": "remove", "path": "/spec/glance/template/notificationBusInstance"}]' +oc patch openstackcontrolplane openstack-galera -n openstack --type json -p='[{"op": "remove", "path": "/spec/glance/template/notificationsBusInstance"}]' ``` This operation will trigger the reconciliation process, updating the diff --git a/config/samples/notifications/kustomization.yaml b/config/samples/notifications/kustomization.yaml index b82670cc..bfc320c8 100644 --- a/config/samples/notifications/kustomization.yaml +++ b/config/samples/notifications/kustomization.yaml @@ -6,7 +6,7 @@ patches: kind: OpenStackControlPlane patch: |- - op: add - path: /spec/glance/template/notificationBusInstance + path: /spec/glance/template/notificationsBusInstance value: rabbitmq apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization diff --git a/controllers/glance_controller.go b/controllers/glance_controller.go index dc6865dc..1feb7bee 100644 --- a/controllers/glance_controller.go +++ b/controllers/glance_controller.go @@ -204,7 +204,7 @@ func (r *GlanceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res instance.Status.GlanceAPIReadyCounts = map[string]int32{} } - if instance.Spec.NotificationBusInstance != nil { + if instance.Spec.NotificationsBusInstance != nil { c := condition.UnknownCondition( condition.NotificationBusInstanceReadyCondition, condition.InitReason, @@ -582,7 +582,7 @@ func (r *GlanceReconciler) reconcileNormal(ctx context.Context, instance *glance // // create RabbitMQ transportURL CR and get the actual URL from the associated secret that is created // - if instance.Spec.NotificationBusInstance != nil && *instance.Spec.NotificationBusInstance != "" { + if instance.Spec.NotificationsBusInstance != nil && *instance.Spec.NotificationsBusInstance != "" { notificationTransportURL, op, err := r.transportURLCreateOrUpdate(ctx, instance, serviceLabels) if err != nil { instance.Status.Conditions.Set(condition.FalseCondition( @@ -1380,7 +1380,7 @@ func (r *GlanceReconciler) transportURLCreateOrUpdate( } op, err := controllerutil.CreateOrUpdate(ctx, r.Client, transportURL, func() error { - transportURL.Spec.RabbitmqClusterName = *instance.Spec.NotificationBusInstance + transportURL.Spec.RabbitmqClusterName = *instance.Spec.NotificationsBusInstance err := controllerutil.SetControllerReference(instance, transportURL, r.Scheme) return err diff --git a/test/functional/base_test.go b/test/functional/base_test.go index ae3a8069..fc410396 100644 --- a/test/functional/base_test.go +++ b/test/functional/base_test.go @@ -91,10 +91,10 @@ func CreateDefaultGlance(name types.NamespacedName) client.Object { // Glance spec func GetGlanceEmptySpec() map[string]interface{} { return map[string]interface{}{ - "keystoneEndpoint": "default", - "notificationBusInstance": glanceTest.NotificationsBusInstance, - "secret": SecretName, - "databaseInstance": "openstack", + "keystoneEndpoint": "default", + "notificationsBusInstance": glanceTest.NotificationsBusInstance, + "secret": SecretName, + "databaseInstance": "openstack", "storage": map[string]interface{}{ "storageRequest": glanceTest.GlancePVCSize, }, @@ -104,13 +104,13 @@ func GetGlanceEmptySpec() map[string]interface{} { func GetGlanceDefaultSpec() map[string]interface{} { return map[string]interface{}{ - "keystoneEndpoint": "default", - "databaseInstance": "openstack", - "databaseAccount": glanceTest.GlanceDatabaseAccount.Name, - "serviceUser": glanceName.Name, - "secret": SecretName, - "notificationBusInstance": glanceTest.NotificationsBusInstance, - "glanceAPIs": GetAPIList(), + "keystoneEndpoint": "default", + "databaseInstance": "openstack", + "databaseAccount": glanceTest.GlanceDatabaseAccount.Name, + "serviceUser": glanceName.Name, + "secret": SecretName, + "notificationsBusInstance": glanceTest.NotificationsBusInstance, + "glanceAPIs": GetAPIList(), "storage": map[string]interface{}{ "storageRequest": glanceTest.GlancePVCSize, }, @@ -119,13 +119,13 @@ func GetGlanceDefaultSpec() map[string]interface{} { func GetGlanceDefaultSpecWithQuota() map[string]interface{} { return map[string]interface{}{ - "keystoneEndpoint": "default", - "databaseInstance": "openstack", - "databaseAccount": glanceTest.GlanceDatabaseAccount.Name, - "serviceUser": glanceName.Name, - "notificationBusInstance": glanceTest.NotificationsBusInstance, - "secret": SecretName, - "glanceAPIs": GetAPIList(), + "keystoneEndpoint": "default", + "databaseInstance": "openstack", + "databaseAccount": glanceTest.GlanceDatabaseAccount.Name, + "serviceUser": glanceName.Name, + "notificationsBusInstance": glanceTest.NotificationsBusInstance, + "secret": SecretName, + "glanceAPIs": GetAPIList(), "storage": map[string]interface{}{ "storageRequest": glanceTest.GlancePVCSize, }, @@ -195,12 +195,12 @@ func CreateGlanceSecret(namespace string, name string) *corev1.Secret { // GetDefaultGlanceSpec - It returns a default API built for testing purposes func GetDefaultGlanceSpec() map[string]interface{} { return map[string]interface{}{ - "databaseInstance": glanceTest.GlanceDatabaseName.Name, - "databaseAccount": glanceTest.GlanceDatabaseAccount.Name, - "secret": SecretName, - "customServiceConfig": GlanceDummyBackend, - "notificationBusInstance": glanceTest.NotificationsBusInstance, - "glanceAPIs": GetAPIList(), + "databaseInstance": glanceTest.GlanceDatabaseName.Name, + "databaseAccount": glanceTest.GlanceDatabaseAccount.Name, + "secret": SecretName, + "customServiceConfig": GlanceDummyBackend, + "notificationsBusInstance": glanceTest.NotificationsBusInstance, + "glanceAPIs": GetAPIList(), "storage": map[string]interface{}{ "storageRequest": glanceTest.GlancePVCSize, }, @@ -269,10 +269,10 @@ func GetDefaultGlanceAPISpec(apiType APIType) map[string]interface{} { func GetTLSGlanceAPISpec(apiType APIType) map[string]interface{} { spec := CreateGlanceAPISpec(apiType) maps.Copy(spec, map[string]interface{}{ - "databaseHostname": "openstack", - "databaseAccount": glanceTest.GlanceDatabaseAccount.Name, - "secret": SecretName, - "notificationBusInstance": glanceTest.NotificationsBusInstance, + "databaseHostname": "openstack", + "databaseAccount": glanceTest.GlanceDatabaseAccount.Name, + "secret": SecretName, + "notificationsBusInstance": glanceTest.NotificationsBusInstance, "tls": map[string]interface{}{ "api": map[string]interface{}{ "internal": map[string]interface{}{