Skip to content
Merged
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
6 changes: 6 additions & 0 deletions internal/controller/nova_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,19 @@ func (r *NovaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resul
novav1.NovaNotificationMQReadyErrorMessage,
notificationMQError.Error(),
))
Log.Error(notificationMQError, "Notification MQ failed, aborting.")
return ctrl.Result{}, notificationMQError
case nova.MQCreating:
instance.Status.Conditions.Set(condition.FalseCondition(
novav1.NovaNotificationMQReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
novav1.NovaNotificationMQReadyCreatingMessage,
))
// return early - wait for notification MQ to be ready before continuing
// to avoid propagating empty transport_url to config generation
Log.Info("Notification MQ not ready yet, returning early.")
return ctrl.Result{}, nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels liek a bug
if the transport url is not read you should aboort reconsiliation
you should not continue to reconcile without it present
weare setting NovaNotificationMQReadyCondition to false meaning the overall ready status of the nova CR will be false as well

Copy link
Copy Markdown
Contributor Author

@auniyal61 auniyal61 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its ok to set nova condition false - yes notification is not directly affecting nova services so better not set whole nova condition false, but as user want to enable notifications but there is some issue (which should not come), so its a important messaging.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the transport url is not read you should aboort reconsiliation

This return statement basically aborts the current Reconciliation. As you noted the Nova CR status is set to not ready. We are not asking for a requeue or returning an error as we don't need to explicitly schedule a retry of the reconciliation here. When the TransportURL CR status changes Nova will automatically reconcile as we are owning that resource.

Comment thread
auniyal61 marked this conversation as resolved.
case nova.MQCompleted:
instance.Status.Conditions.MarkTrue(
novav1.NovaNotificationMQReadyCondition, novav1.NovaNotificationMQReadyMessage)
Expand Down
55 changes: 55 additions & 0 deletions test/functional/nova_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,61 @@ var _ = Describe("Nova controller - notifications", func() {

infra.AssertTransportURLDoesNotExist(notificationsBus.TransportURLName)
})

It("returns early when notification TransportURL becomes not ready", func() {
notificationsBus := GetNotificationsBusNames(novaNames.NovaName)
DeferCleanup(k8sClient.Delete, ctx, CreateNotificationTransportURLSecret(notificationsBus))

// add notification bus and simulate it ready
Eventually(func(g Gomega) {
nova := GetNova(novaNames.NovaName)
nova.Spec.NotificationsBus = &rabbitmqv1.RabbitMqConfig{
Cluster: notificationsBus.BusName,
}
g.Expect(k8sClient.Update(ctx, nova)).Should(Succeed())
}, timeout, interval).Should(Succeed())

infra.SimulateTransportURLReady(notificationsBus.TransportURLName)

// wait for notification MQ to be ready
th.ExpectCondition(
novaNames.NovaName,
ConditionGetterFunc(NovaConditionGetter),
novav1.NovaNotificationMQReadyCondition,
corev1.ConditionTrue,
)

// get config resourceVersion
initialConfigDataMap := th.GetSecret(novaNames.APIConfigDataName)
initialResourceVersion := initialConfigDataMap.ResourceVersion

// simulate rabbitmq pod deleted - transportURL becoming not ready
Eventually(func(g Gomega) {
transportURL := infra.GetTransportURL(notificationsBus.TransportURLName)

transportURL.Status.Conditions.MarkFalse(
"TransportURLReady",
condition.RequestedReason,
condition.SeverityInfo,
"RabbitMQ not ready",
)
g.Expect(k8sClient.Status().Update(ctx, transportURL)).Should(Succeed())
}, timeout, interval).Should(Succeed())

// condition should become false
th.ExpectCondition(
novaNames.NovaName,
ConditionGetterFunc(NovaConditionGetter),
novav1.NovaNotificationMQReadyCondition,
corev1.ConditionFalse,
)

// assert resourceVersion unchanged - config was not updated
Consistently(func(g Gomega) {
configDataMap := th.GetSecret(novaNames.APIConfigDataName)
g.Expect(configDataMap.ResourceVersion).To(Equal(initialResourceVersion))
}, consistencyTimeout, interval).Should(Succeed())
})
})

})
Expand Down