@@ -233,6 +233,8 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul
233233 mariadbv1 .MariaDBAccountReadyMessage ,
234234 )
235235
236+ Log .Info ("" , ":" , "t-url-instance" , ":" , instance .Spec )
237+
236238 // There is a webhook validation that ensures that there is always cell0 in
237239 // the cellTemplates
238240 cell0Template := instance .Spec .CellTemplates [novav1 .Cell0Name ]
@@ -384,6 +386,50 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul
384386 return ctrl.Result {}, fmt .Errorf ("%w from for the API MQ: %d" , util .ErrInvalidStatus , apiMQStatus )
385387 }
386388
389+ // look at transport url state/condition - spec
390+ // from spec which rabbit mq, and state of that rabbitmq
391+ // if aboce ois good
392+ // debug ensureMQ
393+ //
394+
395+ // nova broadcaster rabbit
396+ notificationBusName := ""
397+ if instance .Spec .NotificationsBusInstance != nil {
398+ notificationBusName = * instance .Spec .NotificationsBusInstance
399+ }
400+
401+ notificationTransportURL , notificationMQStatus , notificationMQError := r .ensureMQ (
402+ ctx , h , instance , instance .Name + "-notification-transport" , notificationBusName )
403+
404+ // switch notificationMQStatus {
405+ // case nova.MQFailed:
406+ // instance.Status.Conditions.Set(condition.FalseCondition(
407+ // novav1.NovaNotificationMQReadyCondition,
408+ // condition.ErrorReason,
409+ // condition.SeverityError,
410+ // novav1.NovaNotificationMQReadyErrorMessage,
411+ // notificationMQError.Error(),
412+ // ))
413+ // case nova.MQCreating:
414+ // instance.Status.Conditions.Set(condition.FalseCondition(
415+ // novav1.NovaNotificationMQReadyCondition,
416+ // condition.ErrorReason,
417+ // condition.SeverityError,
418+ // novav1.NovaNotificationMQReadyCreatingMessage,
419+ // ))
420+ // case nova.MQCompleted:
421+ // instance.Status.Conditions.MarkTrue(
422+ // novav1.NovaNotificationMQReadyCondition, novav1.NovaNotificationMQReadyMessage)
423+ // default:
424+ // return ctrl.Result{}, fmt.Errorf("%w from for the Notification MQ: %d",
425+ // util.ErrInvalidStatus, notificationMQStatus)
426+ // }
427+
428+ Log .Info ("" , "t-url-url" , notificationTransportURL )
429+
430+ Log .Info ("" , "t-url-status" , notificationMQStatus )
431+ Log .Info ("" , "t-url-err" , notificationMQError )
432+
387433 cellMQs := map [string ]* nova.MessageBus {}
388434 var failedMQs []string
389435 var creatingMQs []string
@@ -1625,6 +1671,7 @@ func (r *NovaReconciler) ensureMQ(
16251671 })
16261672
16271673 if err != nil && ! k8s_errors .IsNotFound (err ) {
1674+ Log .Info ("" , ":" , "t-url-1" )
16281675 return "" , nova .MQFailed , util .WrapErrorForObject (
16291676 fmt .Sprintf ("Error create or update TransportURL object %s" , transportName ),
16301677 transportURL ,
@@ -1633,12 +1680,14 @@ func (r *NovaReconciler) ensureMQ(
16331680 }
16341681
16351682 if op != controllerutil .OperationResultNone {
1683+ Log .Info ("" , ":" , "t-url-2" )
16361684 Log .Info (fmt .Sprintf ("TransportURL object %s created or patched" , transportName ))
16371685 return "" , nova .MQCreating , nil
16381686 }
16391687
16401688 err = r .Client .Get (ctx , types.NamespacedName {Namespace : instance .Namespace , Name : transportName }, transportURL )
16411689 if err != nil && ! k8s_errors .IsNotFound (err ) {
1690+ Log .Info ("" , ":" , "t-url-3" )
16421691 return "" , nova .MQFailed , util .WrapErrorForObject (
16431692 fmt .Sprintf ("Error reading TransportURL object %s" , transportName ),
16441693 transportURL ,
@@ -1647,13 +1696,16 @@ func (r *NovaReconciler) ensureMQ(
16471696 }
16481697
16491698 if k8s_errors .IsNotFound (err ) || ! transportURL .IsReady () || transportURL .Status .SecretName == "" {
1699+ Log .Info ("" , ":" , "t-url-4" , "" , transportURL )
1700+ Log .Info ("" , ":" , "t-url-4" , "" , transportURL .Status )
16501701 return "" , nova .MQCreating , nil
16511702 }
16521703
16531704 secretName := types.NamespacedName {Namespace : instance .Namespace , Name : transportURL .Status .SecretName }
16541705 secret := & corev1.Secret {}
16551706 err = h .GetClient ().Get (ctx , secretName , secret )
16561707 if err != nil {
1708+ Log .Info ("" , ":" , "t-url-5" )
16571709 if k8s_errors .IsNotFound (err ) {
16581710 return "" , nova .MQCreating , nil
16591711 }
@@ -1662,6 +1714,7 @@ func (r *NovaReconciler) ensureMQ(
16621714
16631715 url , ok := secret .Data [TransportURLSelector ]
16641716 if ! ok {
1717+ Log .Info ("" , ":" , "t-url-6" )
16651718 return "" , nova .MQFailed , fmt .Errorf (
16661719 "%w: the TransportURL secret %s does not have 'transport_url' field" , util .ErrFieldNotFound , transportURL .Status .SecretName )
16671720 }
0 commit comments