Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/bases/glance.openstack.org_glances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/glance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/crd/bases/glance.openstack.org_glances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/samples/layout/base/glance_v1beta1_glance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: glance
spec:
serviceUser: glance
notificationBusInstance: rabbitmq
notificationsBusInstance: rabbitmq
customServiceConfig: |
[DEFAULT]
debug = true
Expand Down
12 changes: 6 additions & 6 deletions config/samples/notifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ 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
...
spec:
...
glance:
template:
notificationBusInstance: rabbitmq
notificationsBusInstance: rabbitmq
...
```

Expand All @@ -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
Expand All @@ -63,7 +63,7 @@ transport_url = rabbit://<user>:<pwd>@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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/samples/notifications/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions controllers/glance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
56 changes: 28 additions & 28 deletions test/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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{}{
Expand Down