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-kogito-serverless-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new adf68a1a add services to SonataFlow status (#415)
adf68a1a is described below

commit adf68a1a0d58a3e9a2464b62d9c6d910c166d14c
Author: Tommy Hughes IV <[email protected]>
AuthorDate: Mon Mar 18 13:34:41 2024 -0500

    add services to SonataFlow status (#415)
    
    Signed-off-by: Tommy Hughes <[email protected]>
---
 api/v1alpha08/sonataflow_types.go                  |  3 ++
 api/v1alpha08/sonataflowplatform_types.go          |  2 +-
 api/v1alpha08/zz_generated.deepcopy.go             |  5 ++
 .../sonataflow-operator.clusterserviceversion.yaml |  4 ++
 .../sonataflow.org_sonataflowplatforms.yaml        |  6 +--
 bundle/manifests/sonataflow.org_sonataflows.yaml   | 21 ++++++++
 .../bases/sonataflow.org_sonataflowplatforms.yaml  |  6 +--
 config/crd/bases/sonataflow.org_sonataflows.yaml   | 21 ++++++++
 .../sonataflow-operator.clusterserviceversion.yaml |  4 ++
 controllers/platform/services/properties.go        | 43 ++++++++--------
 controllers/platform/services/services.go          | 59 +++++++++++++---------
 .../profiles/common/properties/application_test.go | 16 ++++++
 controllers/profiles/common/reconciler.go          |  7 +++
 controllers/sonataflowplatform_controller.go       |  4 +-
 operator.yaml                                      | 27 ++++++++--
 test/e2e/clusterplatform_test.go                   | 32 ++++++++++--
 .../ephemeral/02-sonataflow_platform.yaml          |  0
 .../prod/ephemeral}/kustomization.yaml             |  1 +
 .../03-sonataflow_callbackstatetimeouts.sw.yaml    |  2 +-
 .../01-sonataflow_clusterplatform.yaml             |  0
 .../02-sonataflow_platform.yaml                    |  0
 .../cluster-wide-ephemeral/kustomization.yaml      |  0
 .../02-sonataflow_platform.yaml                    |  0
 .../ephemeral-data-index}/kustomization.yaml       |  2 +-
 .../03-sonataflow_callbackstatetimeouts.sw.yaml    |  2 +-
 .../02-sonataflow_platform.yaml                    |  0
 .../prod/ephemeral-job-service}/kustomization.yaml |  1 +
 .../03-sonataflow_callbackstatetimeouts.sw.yaml    |  2 +-
 .../02-sonataflow_platform.yaml                    |  4 --
 .../ephemeral-with-workflow}/kustomization.yaml    |  1 +
 .../03-sonataflow_callbackstatetimeouts.sw.yaml    |  2 +-
 31 files changed, 204 insertions(+), 73 deletions(-)

diff --git a/api/v1alpha08/sonataflow_types.go 
b/api/v1alpha08/sonataflow_types.go
index ac32fe35..3237fc1f 100644
--- a/api/v1alpha08/sonataflow_types.go
+++ b/api/v1alpha08/sonataflow_types.go
@@ -680,6 +680,9 @@ type SonataFlowStatus struct {
        // Endpoint is an externally accessible URL of the workflow
        
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="endpoint"
        Endpoint *apis.URL `json:"endpoint,omitempty"`
+       // Services displays which platform services are being used by this 
workflow
+       
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="services"
+       Services *PlatformServicesStatus `json:"services,omitempty"`
 }
 
 func (s *SonataFlowStatus) GetTopLevelConditionType() api.ConditionType {
diff --git a/api/v1alpha08/sonataflowplatform_types.go 
b/api/v1alpha08/sonataflowplatform_types.go
index c702c149..9dfff7ce 100644
--- a/api/v1alpha08/sonataflowplatform_types.go
+++ b/api/v1alpha08/sonataflowplatform_types.go
@@ -113,7 +113,7 @@ type PlatformServicesStatus struct {
 // PlatformServiceRefStatus displays information on a cluster-wide service
 // +k8s:openapi-gen=true
 type PlatformServiceRefStatus struct {
-       // Url displays the base url of a cluster-wide service
+       // Url displays the base url of the service
        Url string `json:"url,omitempty"`
 }
 
diff --git a/api/v1alpha08/zz_generated.deepcopy.go 
b/api/v1alpha08/zz_generated.deepcopy.go
index fb2db187..b311b3a8 100644
--- a/api/v1alpha08/zz_generated.deepcopy.go
+++ b/api/v1alpha08/zz_generated.deepcopy.go
@@ -1203,6 +1203,11 @@ func (in *SonataFlowStatus) DeepCopyInto(out 
*SonataFlowStatus) {
                *out = new(apis.URL)
                (*in).DeepCopyInto(*out)
        }
+       if in.Services != nil {
+               in, out := &in.Services, &out.Services
+               *out = new(PlatformServicesStatus)
+               (*in).DeepCopyInto(*out)
+       }
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SonataFlowStatus.
diff --git a/bundle/manifests/sonataflow-operator.clusterserviceversion.yaml 
b/bundle/manifests/sonataflow-operator.clusterserviceversion.yaml
index 7597683f..a4ce43c4 100644
--- a/bundle/manifests/sonataflow-operator.clusterserviceversion.yaml
+++ b/bundle/manifests/sonataflow-operator.clusterserviceversion.yaml
@@ -329,6 +329,10 @@ spec:
           so far
         displayName: recoverFailureAttempts
         path: recoverFailureAttempts
+      - description: Services displays which platform services are being used 
by this
+          workflow
+        displayName: services
+        path: services
       version: v1alpha08
   description: |-
     SonataFlow Kubernetes Operator for deploying workflow applications
diff --git a/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml 
b/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml
index 1752ac7c..29791ec8 100644
--- a/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml
+++ b/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml
@@ -16270,8 +16270,7 @@ spec:
                           Data Index service
                         properties:
                           url:
-                            description: Url displays the base url of a 
cluster-wide
-                              service
+                            description: Url displays the base url of the 
service
                             type: string
                         type: object
                       jobServiceRef:
@@ -16279,8 +16278,7 @@ spec:
                           Job Service
                         properties:
                           url:
-                            description: Url displays the base url of a 
cluster-wide
-                              service
+                            description: Url displays the base url of the 
service
                             type: string
                         type: object
                     type: object
diff --git a/bundle/manifests/sonataflow.org_sonataflows.yaml 
b/bundle/manifests/sonataflow.org_sonataflows.yaml
index 6836cd49..eaf80c91 100644
--- a/bundle/manifests/sonataflow.org_sonataflows.yaml
+++ b/bundle/manifests/sonataflow.org_sonataflows.yaml
@@ -9456,6 +9456,27 @@ spec:
                 description: keeps track of how many failure recovers a given 
workflow
                   had so far
                 type: integer
+              services:
+                description: Services displays which platform services are 
being used
+                  by this workflow
+                properties:
+                  dataIndexRef:
+                    description: DataIndexRef displays information on the 
cluster-wide
+                      Data Index service
+                    properties:
+                      url:
+                        description: Url displays the base url of the service
+                        type: string
+                    type: object
+                  jobServiceRef:
+                    description: JobServiceRef displays information on the 
cluster-wide
+                      Job Service
+                    properties:
+                      url:
+                        description: Url displays the base url of the service
+                        type: string
+                    type: object
+                type: object
             type: object
         type: object
     served: true
diff --git a/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml 
b/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml
index a1cb0213..8d433833 100644
--- a/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml
+++ b/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml
@@ -16271,8 +16271,7 @@ spec:
                           Data Index service
                         properties:
                           url:
-                            description: Url displays the base url of a 
cluster-wide
-                              service
+                            description: Url displays the base url of the 
service
                             type: string
                         type: object
                       jobServiceRef:
@@ -16280,8 +16279,7 @@ spec:
                           Job Service
                         properties:
                           url:
-                            description: Url displays the base url of a 
cluster-wide
-                              service
+                            description: Url displays the base url of the 
service
                             type: string
                         type: object
                     type: object
diff --git a/config/crd/bases/sonataflow.org_sonataflows.yaml 
b/config/crd/bases/sonataflow.org_sonataflows.yaml
index a9df118f..1557c3b8 100644
--- a/config/crd/bases/sonataflow.org_sonataflows.yaml
+++ b/config/crd/bases/sonataflow.org_sonataflows.yaml
@@ -9457,6 +9457,27 @@ spec:
                 description: keeps track of how many failure recovers a given 
workflow
                   had so far
                 type: integer
+              services:
+                description: Services displays which platform services are 
being used
+                  by this workflow
+                properties:
+                  dataIndexRef:
+                    description: DataIndexRef displays information on the 
cluster-wide
+                      Data Index service
+                    properties:
+                      url:
+                        description: Url displays the base url of the service
+                        type: string
+                    type: object
+                  jobServiceRef:
+                    description: JobServiceRef displays information on the 
cluster-wide
+                      Job Service
+                    properties:
+                      url:
+                        description: Url displays the base url of the service
+                        type: string
+                    type: object
+                type: object
             type: object
         type: object
     served: true
diff --git 
a/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml 
b/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml
index 089ae24b..c61183d8 100644
--- a/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml
+++ b/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml
@@ -213,6 +213,10 @@ spec:
           so far
         displayName: recoverFailureAttempts
         path: recoverFailureAttempts
+      - description: Services displays which platform services are being used 
by this
+          workflow
+        displayName: services
+        path: services
       version: v1alpha08
   description: |-
     SonataFlow Kubernetes Operator for deploying workflow applications
diff --git a/controllers/platform/services/properties.go 
b/controllers/platform/services/properties.go
index 02fc6500..1d9e784e 100644
--- a/controllers/platform/services/properties.go
+++ b/controllers/platform/services/properties.go
@@ -24,14 +24,14 @@ import (
        "net/url"
        "strings"
 
-       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles"
-       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/workflowdef"
        "github.com/apache/incubator-kie-kogito-serverless-operator/log"
        "github.com/apache/incubator-kie-kogito-serverless-operator/utils"
        "k8s.io/klog/v2"
 
        operatorapi 
"github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08"
+       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles"
        
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles/common/constants"
+       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/workflowdef"
 
        "github.com/magiconair/properties"
 )
@@ -162,21 +162,21 @@ func GenerateDataIndexWorkflowProperties(workflow 
*operatorapi.SonataFlow, platf
        props.Set(constants.KogitoProcessDefinitionsEventsEnabled, "false")
        props.Set(constants.KogitoProcessInstancesEventsEnabled, "false")
        di := NewDataIndexHandler(platform)
-       if workflow != nil && !profiles.IsDevProfile(workflow) && 
di.IsServiceEnabled() {
-               props.Set(constants.KogitoProcessDefinitionsEventsEnabled, 
"true")
-               
props.Set(constants.KogitoProcessDefinitionsEventsErrorsEnabled, "true")
-               props.Set(constants.KogitoProcessInstancesEventsEnabled, "true")
-               props.Set(constants.KogitoDataIndexHealthCheckEnabled, "true")
-               di := NewDataIndexHandler(platform)
-               p, err := di.GenerateWorkflowProperties()
-               if err != nil {
-                       return nil, err
+       if !profiles.IsDevProfile(workflow) && workflow != nil && 
workflow.Status.Services != nil && workflow.Status.Services.DataIndexRef != nil 
{
+               serviceBaseUrl := workflow.Status.Services.DataIndexRef.Url
+               if di.IsServiceEnabled() && len(serviceBaseUrl) > 0 {
+                       
props.Set(constants.KogitoProcessDefinitionsEventsEnabled, "true")
+                       
props.Set(constants.KogitoProcessInstancesEventsEnabled, "true")
+                       
props.Set(constants.KogitoProcessDefinitionsEventsErrorsEnabled, "true")
+                       props.Set(constants.KogitoDataIndexHealthCheckEnabled, 
"true")
+                       props.Set(constants.KogitoDataIndexURL, serviceBaseUrl)
+                       props.Set(constants.KogitoProcessDefinitionsEventsURL, 
serviceBaseUrl+constants.KogitoProcessDefinitionsEventsPath)
+                       props.Set(constants.KogitoProcessInstancesEventsURL, 
serviceBaseUrl+constants.KogitoProcessInstancesEventsPath)
                }
-               props.Merge(p)
        }
        props.Sort()
-       return props, nil
 
+       return props, nil
 }
 
 // GenerateJobServiceWorkflowProperties returns the set of application 
properties required for the workflow to interact
@@ -188,16 +188,17 @@ func GenerateJobServiceWorkflowProperties(workflow 
*operatorapi.SonataFlow, plat
        props.Set(constants.JobServiceRequestEventsConnector, 
constants.QuarkusHTTP)
        props.Set(constants.JobServiceRequestEventsURL, 
fmt.Sprintf("%s://localhost/v2/jobs/events", constants.JobServiceURLProtocol))
        js := NewJobServiceHandler(platform)
-       if workflow != nil && !profiles.IsDevProfile(workflow) && 
js.IsServiceEnabled() {
-               if workflowdef.HasTimeouts(workflow) {
-                       props.Set(constants.KogitoJobServiceHealthCheckEnabled, 
"true")
-               }
-               p, err := js.GenerateWorkflowProperties()
-               if err != nil {
-                       return nil, err
+       if !profiles.IsDevProfile(workflow) && workflow != nil && 
workflow.Status.Services != nil && workflow.Status.Services.JobServiceRef != 
nil {
+               serviceBaseUrl := workflow.Status.Services.JobServiceRef.Url
+               if js.IsServiceEnabled() && len(serviceBaseUrl) > 0 {
+                       if workflowdef.HasTimeouts(workflow) {
+                               
props.Set(constants.KogitoJobServiceHealthCheckEnabled, "true")
+                       }
+                       props.Set(constants.KogitoJobServiceURL, serviceBaseUrl)
+                       props.Set(constants.JobServiceRequestEventsURL, 
serviceBaseUrl+constants.JobServiceJobEventsPath)
                }
-               props.Merge(p)
        }
        props.Sort()
+
        return props, nil
 }
diff --git a/controllers/platform/services/services.go 
b/controllers/platform/services/services.go
index 4b442c6a..55e7e72a 100644
--- a/controllers/platform/services/services.go
+++ b/controllers/platform/services/services.go
@@ -26,6 +26,7 @@ import (
        "k8s.io/apimachinery/pkg/api/resource"
 
        operatorapi 
"github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08"
+       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles"
        
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles/common/constants"
        
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles/common/persistence"
        "github.com/magiconair/properties"
@@ -68,8 +69,6 @@ type PlatformServiceHandler interface {
        // MergePodSpec performs a merge with override between the podSpec 
argument and the expected values based on the service's pod template 
specification. The returning
        // object is the result of the merge
        MergePodSpec(podSpec corev1.PodSpec) (corev1.PodSpec, error)
-       // GenerateWorkflowProperties returns a property object that contains 
the service's application properties required by workflows
-       GenerateWorkflowProperties() (*properties.Properties, error)
        // GenerateServiceProperties returns a property object that contains 
the application properties required by the service deployment
        GenerateServiceProperties() (*properties.Properties, error)
 
@@ -83,9 +82,11 @@ type PlatformServiceHandler interface {
        GetServiceBaseUrl() string
        // IsServiceEnabled returns true if the service is enabled in either 
the spec or the status.clusterPlatformRef.
        IsServiceEnabled() bool
-       // SetServiceUrlInStatus sets the service url in status. if reconciled 
instance does not have service set in spec AND
+       // SetServiceUrlInPlatformStatus sets the service url in the platform's 
status. if reconciled instance does not have service set in spec AND
        // if cluster referenced platform has said service enabled, use the 
cluster platform's service
-       SetServiceUrlInStatus(clusterRefPlatform 
*operatorapi.SonataFlowPlatform)
+       SetServiceUrlInPlatformStatus(clusterRefPlatform 
*operatorapi.SonataFlowPlatform)
+       // SetServiceUrlInWorkflowStatus sets the service url in a workflow's 
status.
+       SetServiceUrlInWorkflowStatus(workflow *operatorapi.SonataFlow)
 }
 
 type DataIndexHandler struct {
@@ -116,7 +117,7 @@ func (d DataIndexHandler) GetServiceName() string {
        return fmt.Sprintf("%s-%s", d.platform.Name, 
constants.DataIndexServiceName)
 }
 
-func (d DataIndexHandler) SetServiceUrlInStatus(clusterRefPlatform 
*operatorapi.SonataFlowPlatform) {
+func (d DataIndexHandler) SetServiceUrlInPlatformStatus(clusterRefPlatform 
*operatorapi.SonataFlowPlatform) {
        psDI := NewDataIndexHandler(clusterRefPlatform)
        if !isServicesSet(d.platform) && psDI.IsServiceEnabledInSpec() {
                if d.platform.Status.ClusterPlatformRef != nil {
@@ -130,6 +131,17 @@ func (d DataIndexHandler) 
SetServiceUrlInStatus(clusterRefPlatform *operatorapi.
        }
 }
 
+func (d DataIndexHandler) SetServiceUrlInWorkflowStatus(workflow 
*operatorapi.SonataFlow) {
+       if !profiles.IsDevProfile(workflow) && d.IsServiceEnabled() {
+               if workflow.Status.Services == nil {
+                       workflow.Status.Services = 
&operatorapi.PlatformServicesStatus{}
+               }
+               workflow.Status.Services.DataIndexRef = 
&operatorapi.PlatformServiceRefStatus{
+                       Url: d.GetServiceBaseUrl(),
+               }
+       }
+}
+
 func (d DataIndexHandler) IsServiceSetInSpec() bool {
        return isDataIndexSet(d.platform)
 }
@@ -235,16 +247,6 @@ func (d DataIndexHandler) GetServiceCmName() string {
        return fmt.Sprintf("%s-props", d.GetServiceName())
 }
 
-func (d DataIndexHandler) GenerateWorkflowProperties() 
(*properties.Properties, error) {
-       props := properties.NewProperties()
-       if d.IsServiceEnabled() {
-               props.Set(constants.KogitoDataIndexURL, d.GetServiceBaseUrl())
-               props.Set(constants.KogitoProcessDefinitionsEventsURL, 
d.GetServiceBaseUrl()+constants.KogitoProcessDefinitionsEventsPath)
-               props.Set(constants.KogitoProcessInstancesEventsURL, 
d.GetServiceBaseUrl()+constants.KogitoProcessInstancesEventsPath)
-       }
-       return props, nil
-}
-
 func (d DataIndexHandler) GenerateServiceProperties() (*properties.Properties, 
error) {
        props := properties.NewProperties()
        props.Set(constants.KogitoServiceURLProperty, 
d.GetLocalServiceBaseUrl())
@@ -284,7 +286,7 @@ func (j JobServiceHandler) GetServiceCmName() string {
        return fmt.Sprintf("%s-props", j.GetServiceName())
 }
 
-func (j JobServiceHandler) SetServiceUrlInStatus(clusterRefPlatform 
*operatorapi.SonataFlowPlatform) {
+func (j JobServiceHandler) SetServiceUrlInPlatformStatus(clusterRefPlatform 
*operatorapi.SonataFlowPlatform) {
        psJS := NewJobServiceHandler(clusterRefPlatform)
        if !isServicesSet(j.platform) && psJS.IsServiceEnabledInSpec() {
                if j.platform.Status.ClusterPlatformRef != nil {
@@ -298,6 +300,17 @@ func (j JobServiceHandler) 
SetServiceUrlInStatus(clusterRefPlatform *operatorapi
        }
 }
 
+func (j JobServiceHandler) SetServiceUrlInWorkflowStatus(workflow 
*operatorapi.SonataFlow) {
+       if !profiles.IsDevProfile(workflow) && j.IsServiceEnabled() {
+               if workflow.Status.Services == nil {
+                       workflow.Status.Services = 
&operatorapi.PlatformServicesStatus{}
+               }
+               workflow.Status.Services.JobServiceRef = 
&operatorapi.PlatformServiceRefStatus{
+                       Url: j.GetServiceBaseUrl(),
+               }
+       }
+}
+
 func (j JobServiceHandler) IsServiceSetInSpec() bool {
        return isJobServiceSet(j.platform)
 }
@@ -416,13 +429,13 @@ func (j JobServiceHandler) GenerateServiceProperties() 
(*properties.Properties,
        return props, nil
 }
 
-func (j JobServiceHandler) GenerateWorkflowProperties() 
(*properties.Properties, error) {
-       props := properties.NewProperties()
-       if j.IsServiceEnabled() {
-               props.Set(constants.KogitoJobServiceURL, j.GetServiceBaseUrl())
-               props.Set(constants.JobServiceRequestEventsURL, 
j.GetServiceBaseUrl()+constants.JobServiceJobEventsPath)
-       }
-       return props, nil
+func SetServiceUrlsInWorkflowStatus(pl *operatorapi.SonataFlowPlatform, 
workflow *operatorapi.SonataFlow) {
+       tpsDI := NewDataIndexHandler(pl)
+       tpsJS := NewJobServiceHandler(pl)
+
+       workflow.Status.Services = nil
+       tpsDI.SetServiceUrlInWorkflowStatus(workflow)
+       tpsJS.SetServiceUrlInWorkflowStatus(workflow)
 }
 
 func isDataIndexEnabled(platform *operatorapi.SonataFlowPlatform) bool {
diff --git a/controllers/profiles/common/properties/application_test.go 
b/controllers/profiles/common/properties/application_test.go
index 7133db17..686d6f9a 100644
--- a/controllers/profiles/common/properties/application_test.go
+++ b/controllers/profiles/common/properties/application_test.go
@@ -30,6 +30,7 @@ import (
        
"github.com/apache/incubator-kie-kogito-serverless-operator/api/metadata"
        operatorapi 
"github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08"
        
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/discovery"
+       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/platform/services"
        
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles/common/constants"
 
        "github.com/magiconair/properties"
@@ -211,6 +212,8 @@ func 
Test_appPropertyHandler_WithServicesWithUserOverrides(t *testing.T) {
                },
        }
 
+       services.SetServiceUrlsInWorkflowStatus(platform, workflow)
+       assert.Nil(t, workflow.Status.Services)
        props, err := NewAppPropertyHandler(workflow, platform)
        assert.NoError(t, err)
        generatedProps, propsErr := 
properties.LoadString(props.WithUserProperties(userProperties).Build())
@@ -236,6 +239,10 @@ func 
Test_appPropertyHandler_WithServicesWithUserOverrides(t *testing.T) {
 
        // prod profile enables config of outgoing events url
        workflow.SetAnnotations(map[string]string{metadata.Profile: 
string(metadata.ProdProfile)})
+       services.SetServiceUrlsInWorkflowStatus(platform, workflow)
+       assert.NotNil(t, workflow.Status.Services)
+       assert.NotNil(t, workflow.Status.Services.JobServiceRef)
+       assert.NotNil(t, workflow.Status.Services.DataIndexRef)
        props, err = NewAppPropertyHandler(workflow, platform)
        assert.NoError(t, err)
        generatedProps, propsErr = 
properties.LoadString(props.WithUserProperties(userProperties).Build())
@@ -259,6 +266,10 @@ func 
Test_appPropertyHandler_WithServicesWithUserOverrides(t *testing.T) {
 
        // disabling data index bypasses config of outgoing events url
        platform.Spec.Services.DataIndex.Enabled = nil
+       services.SetServiceUrlsInWorkflowStatus(platform, workflow)
+       assert.NotNil(t, workflow.Status.Services)
+       assert.NotNil(t, workflow.Status.Services.JobServiceRef)
+       assert.Nil(t, workflow.Status.Services.DataIndexRef)
        props, err = NewAppPropertyHandler(workflow, platform)
        assert.NoError(t, err)
        generatedProps, propsErr = 
properties.LoadString(props.WithUserProperties(userProperties).Build())
@@ -277,6 +288,8 @@ func 
Test_appPropertyHandler_WithServicesWithUserOverrides(t *testing.T) {
 
        // disabling job service bypasses config of outgoing events url
        platform.Spec.Services.JobService.Enabled = nil
+       services.SetServiceUrlsInWorkflowStatus(platform, workflow)
+       assert.Nil(t, workflow.Status.Services)
        props, err = NewAppPropertyHandler(workflow, platform)
        assert.NoError(t, err)
        generatedProps, propsErr = 
properties.LoadString(props.WithUserProperties(userProperties).Build())
@@ -303,6 +316,7 @@ var _ = Describe("Platform properties", func() {
 
                        DescribeTable("only job services when the spec",
                                func(wf *operatorapi.SonataFlow, plfm 
*operatorapi.SonataFlowPlatform, expectedProperties *properties.Properties) {
+                                       
services.SetServiceUrlsInWorkflowStatus(plfm, wf)
                                        handler, err := 
NewAppPropertyHandler(wf, plfm)
                                        Expect(err).NotTo(HaveOccurred())
                                        p, err := 
properties.LoadString(handler.Build())
@@ -350,6 +364,7 @@ var _ = Describe("Platform properties", func() {
 
                        DescribeTable("only data index service when the spec",
                                func(wf *operatorapi.SonataFlow, plfm 
*operatorapi.SonataFlowPlatform, expectedProperties *properties.Properties) {
+                                       
services.SetServiceUrlsInWorkflowStatus(plfm, wf)
                                        handler, err := 
NewAppPropertyHandler(wf, plfm)
                                        Expect(err).NotTo(HaveOccurred())
                                        p, err := 
properties.LoadString(handler.Build())
@@ -396,6 +411,7 @@ var _ = Describe("Platform properties", func() {
                        )
 
                        DescribeTable("both Data Index and Job Services are 
available and", func(wf *operatorapi.SonataFlow, plfm 
*operatorapi.SonataFlowPlatform, expectedProperties *properties.Properties) {
+                               services.SetServiceUrlsInWorkflowStatus(plfm, 
wf)
                                handler, err := NewAppPropertyHandler(wf, plfm)
                                Expect(err).NotTo(HaveOccurred())
                                p, err := properties.LoadString(handler.Build())
diff --git a/controllers/profiles/common/reconciler.go 
b/controllers/profiles/common/reconciler.go
index b2800005..8af93699 100644
--- a/controllers/profiles/common/reconciler.go
+++ b/controllers/profiles/common/reconciler.go
@@ -26,6 +26,8 @@ import (
        "k8s.io/client-go/rest"
 
        
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/discovery"
+       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/platform"
+       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/platform/services"
 
        "k8s.io/client-go/tools/record"
 
@@ -49,7 +51,12 @@ type StateSupport struct {
 // PerformStatusUpdate updates the SonataFlow Status conditions
 func (s *StateSupport) PerformStatusUpdate(ctx context.Context, workflow 
*operatorapi.SonataFlow) (bool, error) {
        var err error
+       pl, err := platform.GetActivePlatform(ctx, s.C, workflow.Namespace)
+       if err != nil {
+               return false, err
+       }
        workflow.Status.ObservedGeneration = workflow.Generation
+       services.SetServiceUrlsInWorkflowStatus(pl, workflow)
        if err = s.C.Status().Update(ctx, workflow); err != nil {
                klog.V(log.E).ErrorS(err, "Failed to update Workflow status")
                return false, err
diff --git a/controllers/sonataflowplatform_controller.go 
b/controllers/sonataflowplatform_controller.go
index a26db2fb..ff36a8ae 100644
--- a/controllers/sonataflowplatform_controller.go
+++ b/controllers/sonataflowplatform_controller.go
@@ -205,10 +205,10 @@ func (r *SonataFlowPlatformReconciler) 
SonataFlowPlatformUpdateStatus(ctx contex
 
                if sfcPlatform.Spec.Capabilities != nil && 
contains(sfcPlatform.Spec.Capabilities.Workflows, 
clusterplatform.PlatformServices) {
                        tpsDI := services.NewDataIndexHandler(target)
-                       tpsDI.SetServiceUrlInStatus(sfPlatform)
+                       tpsDI.SetServiceUrlInPlatformStatus(sfPlatform)
 
                        tpsJS := services.NewJobServiceHandler(target)
-                       tpsJS.SetServiceUrlInStatus(sfPlatform)
+                       tpsJS.SetServiceUrlInPlatformStatus(sfPlatform)
                }
        } else {
                target.Status.ClusterPlatformRef = nil
diff --git a/operator.yaml b/operator.yaml
index fb73c101..939c060a 100644
--- a/operator.yaml
+++ b/operator.yaml
@@ -16762,8 +16762,7 @@ spec:
                           Data Index service
                         properties:
                           url:
-                            description: Url displays the base url of a 
cluster-wide
-                              service
+                            description: Url displays the base url of the 
service
                             type: string
                         type: object
                       jobServiceRef:
@@ -16771,8 +16770,7 @@ spec:
                           Job Service
                         properties:
                           url:
-                            description: Url displays the base url of a 
cluster-wide
-                              service
+                            description: Url displays the base url of the 
service
                             type: string
                         type: object
                     type: object
@@ -26283,6 +26281,27 @@ spec:
                 description: keeps track of how many failure recovers a given 
workflow
                   had so far
                 type: integer
+              services:
+                description: Services displays which platform services are 
being used
+                  by this workflow
+                properties:
+                  dataIndexRef:
+                    description: DataIndexRef displays information on the 
cluster-wide
+                      Data Index service
+                    properties:
+                      url:
+                        description: Url displays the base url of the service
+                        type: string
+                    type: object
+                  jobServiceRef:
+                    description: JobServiceRef displays information on the 
cluster-wide
+                      Job Service
+                    properties:
+                      url:
+                        description: Url displays the base url of the service
+                        type: string
+                    type: object
+                type: object
             type: object
         type: object
     served: true
diff --git a/test/e2e/clusterplatform_test.go b/test/e2e/clusterplatform_test.go
index d0b545f6..e96699a3 100644
--- a/test/e2e/clusterplatform_test.go
+++ b/test/e2e/clusterplatform_test.go
@@ -74,7 +74,6 @@ var _ = Describe("Validate a clusterplatform", Ordered, 
func() {
                }
        })
        var _ = Context("with supporting services enabled", func() {
-
                DescribeTable("against a platform in a separate namespace", 
func(testcaseDir string, profile string, persistenceType string, withServices 
bool) {
                        By("Deploy the SonataFlowPlatform CR")
                        var manifests []byte
@@ -147,6 +146,19 @@ var _ = Describe("Validate a clusterplatform", Ordered, 
func() {
                                        returnedValue, _ := utils.Run(cmd)
                                        return returnedValue
                                }, 20*time.Minute, 
5).Should(Equal([]byte("''")))
+
+                               dataIndexServiceUrl := 
services.GenerateServiceURL(constants.KogitoServiceURLProtocol, 
targetNamespace2, "sonataflow-platform-"+constants.DataIndexServiceName)
+                               jobServiceUrl := 
services.GenerateServiceURL(constants.KogitoServiceURLProtocol, 
targetNamespace2, "sonataflow-platform-"+constants.JobServiceName)
+                               EventuallyWithOffset(1, func() []byte {
+                                       cmd = exec.Command("kubectl", "get", 
"sf", "-n", targetNamespace2, "callbackstatetimeouts", "-o", 
"jsonpath='{.status.services.dataIndexRef.url}'")
+                                       returnedValue, _ := utils.Run(cmd)
+                                       return returnedValue
+                               }, 20*time.Minute, 5).Should(Equal([]byte("'" + 
dataIndexServiceUrl + "'")))
+                               EventuallyWithOffset(1, func() []byte {
+                                       cmd = exec.Command("kubectl", "get", 
"sf", "-n", targetNamespace2, "callbackstatetimeouts", "-o", 
"jsonpath='{.status.services.jobServiceRef.url}'")
+                                       returnedValue, _ := utils.Run(cmd)
+                                       return returnedValue
+                               }, 20*time.Minute, 5).Should(Equal([]byte("'" + 
jobServiceUrl + "'")))
                        } else {
                                EventuallyWithOffset(1, func() error {
                                        var err error
@@ -180,13 +192,23 @@ var _ = Describe("Validate a clusterplatform", Ordered, 
func() {
                                        returnedValue, _ := utils.Run(cmd)
                                        return returnedValue
                                }, 20*time.Minute, 5).Should(Equal([]byte("'" + 
jobServiceUrl + "'")))
+                               EventuallyWithOffset(1, func() []byte {
+                                       cmd = exec.Command("kubectl", "get", 
"sf", "-n", targetNamespace2, "callbackstatetimeouts", "-o", 
"jsonpath='{.status.services.dataIndexRef.url}'")
+                                       returnedValue, _ := utils.Run(cmd)
+                                       return returnedValue
+                               }, 20*time.Minute, 5).Should(Equal([]byte("'" + 
dataIndexServiceUrl + "'")))
+                               EventuallyWithOffset(1, func() []byte {
+                                       cmd = exec.Command("kubectl", "get", 
"sf", "-n", targetNamespace2, "callbackstatetimeouts", "-o", 
"jsonpath='{.status.services.jobServiceRef.url}'")
+                                       returnedValue, _ := utils.Run(cmd)
+                                       return returnedValue
+                               }, 20*time.Minute, 5).Should(Equal([]byte("'" + 
jobServiceUrl + "'")))
                        }
                        cmd = exec.Command("kubectl", "delete", 
"SonataFlowClusterPlatform", "cluster", "--wait")
                        _, err = utils.Run(cmd)
                        Expect(err).NotTo(HaveOccurred())
                },
-                       Entry("without services configured", 
test.GetSonataFlowE2EPlatformNoServicesDirectory(), dev, ephemeral, false),
-                       Entry("with services configured", 
test.GetSonataFlowE2EPlatformServicesDirectory(), dev, ephemeral, true),
+                       Entry("without services configured", 
test.GetSonataFlowE2EPlatformNoServicesDirectory(), production, ephemeral, 
false),
+                       Entry("with services configured", 
test.GetSonataFlowE2EPlatformServicesDirectory(), production, 
"ephemeral-with-workflow", true),
                )
 
                DescribeTable("against a platform in a separate namespace", 
func(testcaseDir string, profile string, persistenceType string) {
@@ -264,8 +286,8 @@ var _ = Describe("Validate a clusterplatform", Ordered, 
func() {
                        _, err = utils.Run(cmd)
                        Expect(err).NotTo(HaveOccurred())
                },
-                       Entry("with only Data Index configured", 
test.GetSonataFlowE2EPlatformServicesDirectory(), dev, ephemeralDataIndex),
-                       Entry("with only Job Service configured", 
test.GetSonataFlowE2EPlatformServicesDirectory(), dev, ephemeralJobService),
+                       Entry("with only Data Index configured", 
test.GetSonataFlowE2EPlatformServicesDirectory(), production, 
ephemeralDataIndex),
+                       Entry("with only Job Service configured", 
test.GetSonataFlowE2EPlatformServicesDirectory(), production, 
ephemeralJobService),
                )
        })
 })
diff --git 
a/test/testdata/platform/noservices/dev/ephemeral/02-sonataflow_platform.yaml 
b/test/testdata/platform/noservices/prod/ephemeral/02-sonataflow_platform.yaml
similarity index 100%
rename from 
test/testdata/platform/noservices/dev/ephemeral/02-sonataflow_platform.yaml
rename to 
test/testdata/platform/noservices/prod/ephemeral/02-sonataflow_platform.yaml
diff --git 
a/test/testdata/platform/services/dev/ephemeral-job-service/kustomization.yaml 
b/test/testdata/platform/noservices/prod/ephemeral/kustomization.yaml
similarity index 92%
copy from 
test/testdata/platform/services/dev/ephemeral-job-service/kustomization.yaml
copy to test/testdata/platform/noservices/prod/ephemeral/kustomization.yaml
index 5441bfce..20286ada 100644
--- 
a/test/testdata/platform/services/dev/ephemeral-job-service/kustomization.yaml
+++ b/test/testdata/platform/noservices/prod/ephemeral/kustomization.yaml
@@ -14,6 +14,7 @@
 
 resources:
 - 02-sonataflow_platform.yaml
+- sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
 
 sortOptions:
   order: fifo
diff --git 
a/test/testdata/platform/noservices/dev/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
 
b/test/testdata/platform/noservices/prod/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
similarity index 98%
copy from 
test/testdata/platform/noservices/dev/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
copy to 
test/testdata/platform/noservices/prod/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
index 8bc8a77d..249ee2c1 100644
--- 
a/test/testdata/platform/noservices/dev/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
+++ 
b/test/testdata/platform/noservices/prod/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
@@ -19,7 +19,7 @@ metadata:
   annotations:
     sonataflow.org/description: Callback State Timeouts Example k8s
     sonataflow.org/version: 0.0.1
-    sonataflow.org/profile: dev
+    sonataflow.org/profile: prod
 spec:
   flow:
     start: PrintStartMessage
diff --git 
a/test/testdata/platform/services/dev/cluster-wide-ephemeral/01-sonataflow_clusterplatform.yaml
 
b/test/testdata/platform/services/prod/cluster-wide-ephemeral/01-sonataflow_clusterplatform.yaml
similarity index 100%
rename from 
test/testdata/platform/services/dev/cluster-wide-ephemeral/01-sonataflow_clusterplatform.yaml
rename to 
test/testdata/platform/services/prod/cluster-wide-ephemeral/01-sonataflow_clusterplatform.yaml
diff --git 
a/test/testdata/platform/services/dev/cluster-wide-ephemeral/02-sonataflow_platform.yaml
 
b/test/testdata/platform/services/prod/cluster-wide-ephemeral/02-sonataflow_platform.yaml
similarity index 100%
copy from 
test/testdata/platform/services/dev/cluster-wide-ephemeral/02-sonataflow_platform.yaml
copy to 
test/testdata/platform/services/prod/cluster-wide-ephemeral/02-sonataflow_platform.yaml
diff --git 
a/test/testdata/platform/services/dev/cluster-wide-ephemeral/kustomization.yaml 
b/test/testdata/platform/services/prod/cluster-wide-ephemeral/kustomization.yaml
similarity index 100%
rename from 
test/testdata/platform/services/dev/cluster-wide-ephemeral/kustomization.yaml
rename to 
test/testdata/platform/services/prod/cluster-wide-ephemeral/kustomization.yaml
diff --git 
a/test/testdata/platform/services/dev/ephemeral-data-index/02-sonataflow_platform.yaml
 
b/test/testdata/platform/services/prod/ephemeral-data-index/02-sonataflow_platform.yaml
similarity index 100%
rename from 
test/testdata/platform/services/dev/ephemeral-data-index/02-sonataflow_platform.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-data-index/02-sonataflow_platform.yaml
diff --git 
a/test/testdata/platform/services/dev/ephemeral-job-service/kustomization.yaml 
b/test/testdata/platform/services/prod/ephemeral-data-index/kustomization.yaml
similarity index 92%
rename from 
test/testdata/platform/services/dev/ephemeral-job-service/kustomization.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-data-index/kustomization.yaml
index 5441bfce..a6807fcf 100644
--- 
a/test/testdata/platform/services/dev/ephemeral-job-service/kustomization.yaml
+++ 
b/test/testdata/platform/services/prod/ephemeral-data-index/kustomization.yaml
@@ -14,7 +14,7 @@
 
 resources:
 - 02-sonataflow_platform.yaml
+- sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
 
 sortOptions:
   order: fifo
-
diff --git 
a/test/testdata/platform/services/dev/ephemeral-data-index/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
 
b/test/testdata/platform/services/prod/ephemeral-data-index/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
similarity index 98%
rename from 
test/testdata/platform/services/dev/ephemeral-data-index/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-data-index/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
index 8bc8a77d..249ee2c1 100644
--- 
a/test/testdata/platform/services/dev/ephemeral-data-index/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
+++ 
b/test/testdata/platform/services/prod/ephemeral-data-index/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
@@ -19,7 +19,7 @@ metadata:
   annotations:
     sonataflow.org/description: Callback State Timeouts Example k8s
     sonataflow.org/version: 0.0.1
-    sonataflow.org/profile: dev
+    sonataflow.org/profile: prod
 spec:
   flow:
     start: PrintStartMessage
diff --git 
a/test/testdata/platform/services/dev/ephemeral-job-service/02-sonataflow_platform.yaml
 
b/test/testdata/platform/services/prod/ephemeral-job-service/02-sonataflow_platform.yaml
similarity index 100%
rename from 
test/testdata/platform/services/dev/ephemeral-job-service/02-sonataflow_platform.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-job-service/02-sonataflow_platform.yaml
diff --git a/test/testdata/platform/noservices/dev/ephemeral/kustomization.yaml 
b/test/testdata/platform/services/prod/ephemeral-job-service/kustomization.yaml
similarity index 92%
rename from test/testdata/platform/noservices/dev/ephemeral/kustomization.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-job-service/kustomization.yaml
index 5441bfce..20286ada 100644
--- a/test/testdata/platform/noservices/dev/ephemeral/kustomization.yaml
+++ 
b/test/testdata/platform/services/prod/ephemeral-job-service/kustomization.yaml
@@ -14,6 +14,7 @@
 
 resources:
 - 02-sonataflow_platform.yaml
+- sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
 
 sortOptions:
   order: fifo
diff --git 
a/test/testdata/platform/services/dev/ephemeral-job-service/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
 
b/test/testdata/platform/services/prod/ephemeral-job-service/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
similarity index 98%
rename from 
test/testdata/platform/services/dev/ephemeral-job-service/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-job-service/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
index 8bc8a77d..249ee2c1 100644
--- 
a/test/testdata/platform/services/dev/ephemeral-job-service/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
+++ 
b/test/testdata/platform/services/prod/ephemeral-job-service/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
@@ -19,7 +19,7 @@ metadata:
   annotations:
     sonataflow.org/description: Callback State Timeouts Example k8s
     sonataflow.org/version: 0.0.1
-    sonataflow.org/profile: dev
+    sonataflow.org/profile: prod
 spec:
   flow:
     start: PrintStartMessage
diff --git 
a/test/testdata/platform/services/dev/cluster-wide-ephemeral/02-sonataflow_platform.yaml
 
b/test/testdata/platform/services/prod/ephemeral-with-workflow/02-sonataflow_platform.yaml
similarity index 85%
rename from 
test/testdata/platform/services/dev/cluster-wide-ephemeral/02-sonataflow_platform.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-with-workflow/02-sonataflow_platform.yaml
index c7048fff..52b7d11f 100644
--- 
a/test/testdata/platform/services/dev/cluster-wide-ephemeral/02-sonataflow_platform.yaml
+++ 
b/test/testdata/platform/services/prod/ephemeral-with-workflow/02-sonataflow_platform.yaml
@@ -18,10 +18,6 @@ metadata:
   name: sonataflow-platform
 spec:
   build:
-    template:
-      buildArgs:
-      - name: QUARKUS_EXTENSION
-        value: 
org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:999-SNAPSHOT
     config:
       strategyOptions:
         KanikoBuildCacheEnabled: "true"
diff --git 
a/test/testdata/platform/services/dev/ephemeral-data-index/kustomization.yaml 
b/test/testdata/platform/services/prod/ephemeral-with-workflow/kustomization.yaml
similarity index 92%
rename from 
test/testdata/platform/services/dev/ephemeral-data-index/kustomization.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-with-workflow/kustomization.yaml
index 5441bfce..20286ada 100644
--- 
a/test/testdata/platform/services/dev/ephemeral-data-index/kustomization.yaml
+++ 
b/test/testdata/platform/services/prod/ephemeral-with-workflow/kustomization.yaml
@@ -14,6 +14,7 @@
 
 resources:
 - 02-sonataflow_platform.yaml
+- sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
 
 sortOptions:
   order: fifo
diff --git 
a/test/testdata/platform/noservices/dev/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
 
b/test/testdata/platform/services/prod/ephemeral-with-workflow/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
similarity index 98%
rename from 
test/testdata/platform/noservices/dev/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
rename to 
test/testdata/platform/services/prod/ephemeral-with-workflow/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
index 8bc8a77d..249ee2c1 100644
--- 
a/test/testdata/platform/noservices/dev/ephemeral/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
+++ 
b/test/testdata/platform/services/prod/ephemeral-with-workflow/sonataflow/03-sonataflow_callbackstatetimeouts.sw.yaml
@@ -19,7 +19,7 @@ metadata:
   annotations:
     sonataflow.org/description: Callback State Timeouts Example k8s
     sonataflow.org/version: 0.0.1
-    sonataflow.org/profile: dev
+    sonataflow.org/profile: prod
 spec:
   flow:
     start: PrintStartMessage


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to