Skip to content

Commit

Permalink
kie-issues#2842 [sonataflow-operator] SonataFlow Operator goes into C…
Browse files Browse the repository at this point in the history
…rashLoopBackOff when workflow is deployed with cluster platform referenced platform (#2841)
jianrongzhang89 authored Jan 10, 2025
1 parent bbb4e76 commit e689243
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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,16 +328,15 @@ 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) {
return nil, nil
}
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.

0 comments on commit e689243

Please sign in to comment.