You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2026/10/08 14:56:41 UTC

(camel-k) 07/19: Fix #5935: Simplify ArkMQ address lookup to direct metadata.name Get

This is an automated email from the ASF dual-hosted git repository.

squakez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 2345ff5fed78dcf906659768393974ef5bc24781
Author: Keerthan <po...@gmail.com>
AuthorDate: Thu Sep 24 17:32:03 2026 +0530

    Fix #5935: Simplify ArkMQ address lookup to direct metadata.name Get
---
 pkg/util/bindings/arkmq.go | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/pkg/util/bindings/arkmq.go b/pkg/util/bindings/arkmq.go
index 75193b90a..c68fad6fc 100644
--- a/pkg/util/bindings/arkmq.go
+++ b/pkg/util/bindings/arkmq.go
@@ -24,7 +24,6 @@ import (
 	arkmqv1beta1 "github.com/apache/camel-k/v2/pkg/apis/duck/arkmq/v1beta1"
 	"github.com/apache/camel-k/v2/pkg/util/kubernetes"
 	"github.com/apache/camel-k/v2/pkg/util/uri"
-	k8serrors "k8s.io/apimachinery/pkg/api/errors"
 	"k8s.io/apimachinery/pkg/runtime/schema"
 	ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 )
@@ -268,28 +267,11 @@ func (a ArkMQBindingProvider) lookupAddress(ctx BindingContext, endpoint camelv1
 		Namespace: namespace,
 		Name:      endpoint.Ref.Name,
 	}
-	// first check by ActiveMQArtemisAddress name
-	err := ctx.Client.Get(ctx.Ctx, key, &address)
-	if err != nil && !k8serrors.IsNotFound(err) {
+	if err := ctx.Client.Get(ctx.Ctx, key, &address); err != nil {
 		return nil, err
 	}
-	if err == nil {
-		return &address, nil
-	}
-
-	// if not found, then look at spec.queueName or spec.addressName
-	var addresses arkmqv1beta1.ActiveMQArtemisAddressList
-	if err := ctx.Client.List(ctx.Ctx, &addresses, ctrl.InNamespace(namespace)); err != nil {
-		return nil, fmt.Errorf("couldn't find any ActiveMQArtemisAddress with either name, queueName or addressName %s; error %w", endpoint.Ref.Name, err)
-	}
-	for i := range addresses.Items {
-		item := &addresses.Items[i]
-		if item.Spec.AddressName == endpoint.Ref.Name || item.Spec.QueueName == endpoint.Ref.Name {
-			return item, nil
-		}
-	}
 
-	return nil, fmt.Errorf("couldn't find any ActiveMQArtemisAddress with either name, queueName or addressName %s", endpoint.Ref.Name)
+	return &address, nil
 }
 
 func (a ArkMQBindingProvider) Order() int {