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

ricardozanini pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new e689243f6cf kie-issues#2842 [sonataflow-operator] SonataFlow Operator 
goes into CrashLoopBackOff when workflow is deployed with cluster platform 
referenced platform (#2841)
e689243f6cf is described below

commit e689243f6cf9b2af33de28b06b6fa7d55e5b3bf0
Author: Jianrong Zhang <jianrongzhan...@gmail.com>
AuthorDate: Fri Jan 10 10:20:50 2025 -0500

    kie-issues#2842 [sonataflow-operator] SonataFlow Operator goes into 
CrashLoopBackOff when workflow is deployed with cluster platform referenced 
platform (#2841)
---
 .../internal/controller/profiles/common/object_creators.go       | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/packages/sonataflow-operator/internal/controller/profiles/common/object_creators.go
 
b/packages/sonataflow-operator/internal/controller/profiles/common/object_creators.go
index 396c270fa68..2e133926c90 100644
--- 
a/packages/sonataflow-operator/internal/controller/profiles/common/object_creators.go
+++ 
b/packages/sonataflow-operator/internal/controller/profiles/common/object_creators.go
@@ -318,7 +318,7 @@ func SinkBindingCreator(workflow *operatorapi.SonataFlow, 
plf *operatorapi.Sonat
        return sinkBinding, nil
 }
 
-func getBrokerRefFromPlatform(plf *operatorapi.SonataFlowPlatform) 
(*duckv1.KReference, error) {
+func getBrokerRefFromPlatform(plf *operatorapi.SonataFlowPlatform, checkRemote 
bool) (*duckv1.KReference, error) {
        // check the local platform
        if plf.Spec.Eventing != nil && plf.Spec.Eventing.Broker != nil && 
plf.Spec.Eventing.Broker.Ref != nil {
                ref := plf.Spec.Eventing.Broker.Ref.DeepCopy()
@@ -328,7 +328,7 @@ func getBrokerRefFromPlatform(plf 
*operatorapi.SonataFlowPlatform) (*duckv1.KRef
                return ref, nil
        }
        // Check the cluster platform
-       if plf.Status.ClusterPlatformRef != nil && 
len(plf.Status.ClusterPlatformRef.PlatformRef.Name) > 0 {
+       if checkRemote && plf.Status.ClusterPlatformRef != nil && 
len(plf.Status.ClusterPlatformRef.PlatformRef.Name) > 0 {
                platform := &operatorapi.SonataFlowPlatform{}
                if err := utils.GetClient().Get(context.TODO(), 
types.NamespacedName{Namespace: 
plf.Status.ClusterPlatformRef.PlatformRef.Namespace, Name: 
plf.Status.ClusterPlatformRef.PlatformRef.Name}, platform); err != nil {
                        if errors.IsNotFound(err) {
@@ -336,8 +336,7 @@ func getBrokerRefFromPlatform(plf 
*operatorapi.SonataFlowPlatform) (*duckv1.KRef
                        }
                        return nil, err
                }
-               return getBrokerRefFromPlatform(platform)
-
+               return getBrokerRefFromPlatform(platform, false)
        }
        return nil, nil
 }
@@ -354,7 +353,7 @@ func getBrokerRefForEventType(eventType string, workflow 
*operatorapi.SonataFlow
                }
        }
        // get the broker from the local platform or cluster platform
-       return getBrokerRefFromPlatform(plf)
+       return getBrokerRefFromPlatform(plf, true)
 }
 
 // TriggersCreator is an ObjectsCreator for Triggers.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@kie.apache.org
For additional commands, e-mail: commits-h...@kie.apache.org

Reply via email to