Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-issues#2842 [sonataflow-operator] SonataFlow Operator goes into CrashLoopBackOff when workflow is deployed with cluster platform referenced platform #2841

Merged
merged 1 commit into from
Jan 10, 2025
Merged
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
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
Loading