@@ -384,6 +384,45 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul
384384 return ctrl.Result {}, fmt .Errorf ("%w from for the API MQ: %d" , util .ErrInvalidStatus , apiMQStatus )
385385 }
386386
387+ // nova broadcaster rabbit
388+ notificationBusName := ""
389+ if instance .Spec .NotificationsBusInstance != nil {
390+ notificationBusName = * instance .Spec .NotificationsBusInstance
391+ }
392+
393+ var notificationTransportURL string
394+ var notificationMQStatus nova.MessageBusStatus
395+ var notificationMQError error
396+
397+ if notificationBusName != "" {
398+ notificationTransportURL , notificationMQStatus , notificationMQError = r .ensureMQ (
399+ ctx , h , instance , instance .Name + "-notification-transport" , notificationBusName )
400+
401+ switch notificationMQStatus {
402+ case nova .MQFailed :
403+ instance .Status .Conditions .Set (condition .FalseCondition (
404+ novav1 .NovaNotificationMQReadyCondition ,
405+ condition .ErrorReason ,
406+ condition .SeverityError ,
407+ novav1 .NovaNotificationMQReadyErrorMessage ,
408+ notificationMQError .Error (),
409+ ))
410+ case nova .MQCreating :
411+ instance .Status .Conditions .Set (condition .FalseCondition (
412+ novav1 .NovaNotificationMQReadyCondition ,
413+ condition .ErrorReason ,
414+ condition .SeverityError ,
415+ novav1 .NovaNotificationMQReadyCreatingMessage ,
416+ ))
417+ case nova .MQCompleted :
418+ instance .Status .Conditions .MarkTrue (
419+ novav1 .NovaNotificationMQReadyCondition , novav1 .NovaNotificationMQReadyMessage )
420+ default :
421+ return ctrl.Result {}, fmt .Errorf ("%w from for the Notification MQ: %d" ,
422+ util .ErrInvalidStatus , notificationMQStatus )
423+ }
424+ }
425+
387426 cellMQs := map [string ]* nova.MessageBus {}
388427 var failedMQs []string
389428 var creatingMQs []string
@@ -474,7 +513,7 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul
474513 }
475514 cell , status , err := r .ensureCell (
476515 ctx , h , instance , cellName , cellTemplate ,
477- cellDB .Database , apiDB , cellMQ .TransportURL ,
516+ cellDB .Database , apiDB , cellMQ .TransportURL , notificationTransportURL ,
478517 keystoneInternalAuthURL , secret ,
479518 )
480519 cells [cellName ] = cell
@@ -539,7 +578,11 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul
539578 return ctrl.Result {}, nil
540579 }
541580
542- topLevelSecretName , err := r .ensureTopLevelSecret (ctx , h , instance , apiTransportURL , secret )
581+ topLevelSecretName , err := r .ensureTopLevelSecret (
582+ ctx , h , instance ,
583+ apiTransportURL ,
584+ notificationTransportURL ,
585+ secret )
543586 if err != nil {
544587 return ctrl.Result {}, err
545588 }
@@ -1100,12 +1143,16 @@ func (r *NovaReconciler) ensureCell(
11001143 cellDB * mariadbv1.Database ,
11011144 apiDB * mariadbv1.Database ,
11021145 cellTransportURL string ,
1146+ notificationTransportURL string ,
11031147 keystoneAuthURL string ,
11041148 secret corev1.Secret ,
11051149) (* novav1.NovaCell , nova.CellDeploymentStatus , error ) {
11061150 Log := r .GetLogger (ctx )
11071151
1108- cellSecretName , err := r .ensureCellSecret (ctx , h , instance , cellName , cellTemplate , cellTransportURL , secret )
1152+ cellSecretName , err := r .ensureCellSecret (
1153+ ctx , h , instance , cellName , cellTemplate ,
1154+ cellTransportURL , notificationTransportURL ,
1155+ secret )
11091156 if err != nil {
11101157 return nil , nova .CellDeploying , err
11111158 }
@@ -1639,6 +1686,7 @@ func (r *NovaReconciler) ensureMQ(
16391686
16401687 err = r .Client .Get (ctx , types.NamespacedName {Namespace : instance .Namespace , Name : transportName }, transportURL )
16411688 if err != nil && ! k8s_errors .IsNotFound (err ) {
1689+ Log .Info ("" , ":" , "t-url-3" )
16421690 return "" , nova .MQFailed , util .WrapErrorForObject (
16431691 fmt .Sprintf ("Error reading TransportURL object %s" , transportName ),
16441692 transportURL ,
@@ -1651,6 +1699,7 @@ func (r *NovaReconciler) ensureMQ(
16511699 }
16521700
16531701 secretName := types.NamespacedName {Namespace : instance .Namespace , Name : transportURL .Status .SecretName }
1702+
16541703 secret := & corev1.Secret {}
16551704 err = h .GetClient ().Get (ctx , secretName , secret )
16561705 if err != nil {
@@ -1665,7 +1714,6 @@ func (r *NovaReconciler) ensureMQ(
16651714 return "" , nova .MQFailed , fmt .Errorf (
16661715 "%w: the TransportURL secret %s does not have 'transport_url' field" , util .ErrFieldNotFound , transportURL .Status .SecretName )
16671716 }
1668-
16691717 return string (url ), nova .MQCompleted , nil
16701718}
16711719
@@ -1869,13 +1917,15 @@ func (r *NovaReconciler) ensureCellSecret(
18691917 cellName string ,
18701918 cellTemplate novav1.NovaCellTemplate ,
18711919 cellTransportURL string ,
1920+ notificationTransportURL string ,
18721921 externalSecret corev1.Secret ,
18731922) (string , error ) {
18741923 // NOTE(gibi): We can move other sensitive data to the internal Secret from
18751924 // the NovaCellSpec fields, possibly hostnames or usernames.
18761925 data := map [string ]string {
1877- ServicePasswordSelector : string (externalSecret .Data [instance .Spec .PasswordSelectors .Service ]),
1878- TransportURLSelector : cellTransportURL ,
1926+ ServicePasswordSelector : string (externalSecret .Data [instance .Spec .PasswordSelectors .Service ]),
1927+ TransportURLSelector : cellTransportURL ,
1928+ NotificationTransportURLSelector : notificationTransportURL ,
18791929 }
18801930
18811931 // If metadata is enabled in the cell then the cell secret needs the
@@ -1919,14 +1969,16 @@ func (r *NovaReconciler) ensureTopLevelSecret(
19191969 h * helper.Helper ,
19201970 instance * novav1.Nova ,
19211971 apiTransportURL string ,
1972+ notificationTransportURL string ,
19221973 externalSecret corev1.Secret ,
19231974) (string , error ) {
19241975 // NOTE(gibi): We can move other sensitive data to the internal Secret from
19251976 // the subCR fields, possibly hostnames or usernames.
19261977 data := map [string ]string {
1927- ServicePasswordSelector : string (externalSecret .Data [instance .Spec .PasswordSelectors .Service ]),
1928- MetadataSecretSelector : string (externalSecret .Data [instance .Spec .PasswordSelectors .MetadataSecret ]),
1929- TransportURLSelector : apiTransportURL ,
1978+ ServicePasswordSelector : string (externalSecret .Data [instance .Spec .PasswordSelectors .Service ]),
1979+ MetadataSecretSelector : string (externalSecret .Data [instance .Spec .PasswordSelectors .MetadataSecret ]),
1980+ TransportURLSelector : apiTransportURL ,
1981+ NotificationTransportURLSelector : notificationTransportURL ,
19301982 }
19311983
19321984 // NOTE(gibi): When we switch to immutable secrets then we need to include
0 commit comments