Skip to content

Commit

Permalink
Merge pull request #116 from wmedvede/SRVLOGIC-517
Browse files Browse the repository at this point in the history
[9.102.x-prod] SRVLOGIC-517: Sonataflow Serverless Logic Operator 1.35 rc fails to install
  • Loading branch information
ricardozanini authored Jan 10, 2025
2 parents 1b86cfd + 99bc0f1 commit 0d678cb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/controller/profiles/common/object_creators.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}
Expand All @@ -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.
Expand Down

0 comments on commit 0d678cb

Please sign in to comment.