diff --git a/controllers/platform/services/properties.go b/controllers/platform/services/properties.go index 8b1fa2016..a29a7f503 100644 --- a/controllers/platform/services/properties.go +++ b/controllers/platform/services/properties.go @@ -24,9 +24,8 @@ 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/workflowproj" - "github.com/apache/incubator-kie-kogito-serverless-operator/log" "github.com/apache/incubator-kie-kogito-serverless-operator/utils" "k8s.io/klog/v2" @@ -163,7 +162,7 @@ func GenerateDataIndexWorkflowProperties(workflow *operatorapi.SonataFlow, platf props.Set(constants.KogitoProcessDefinitionsEventsEnabled, "false") props.Set(constants.KogitoProcessInstancesEventsEnabled, "false") di := NewDataIndexHandler(platform) - if workflow != nil && !workflowproj.IsDevProfile(workflow) && di.IsServiceEnabled() { + if workflow != nil && !profiles.IsDevProfile(workflow) && di.IsServiceEnabled() { props.Set(constants.KogitoProcessDefinitionsEventsEnabled, "true") props.Set(constants.KogitoProcessDefinitionsEventsErrorsEnabled, "true") props.Set(constants.KogitoProcessInstancesEventsEnabled, "true") @@ -189,7 +188,7 @@ 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 && !workflowproj.IsDevProfile(workflow) && js.IsServiceEnabled() { + if workflow != nil && !profiles.IsDevProfile(workflow) && js.IsServiceEnabled() { if workflowdef.HasTimeouts(workflow) { props.Set(constants.KogitoJobServiceHealthCheckEnabled, "true") } diff --git a/controllers/profiles/dev/object_creators_dev.go b/controllers/profiles/dev/object_creators_dev.go index 418ff9fad..c4cf92549 100644 --- a/controllers/profiles/dev/object_creators_dev.go +++ b/controllers/profiles/dev/object_creators_dev.go @@ -22,6 +22,7 @@ package dev import ( "path" + "github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -47,7 +48,7 @@ func serviceCreator(workflow *operatorapi.SonataFlow) (client.Object, error) { object, _ := common.ServiceCreator(workflow) service := object.(*corev1.Service) // Let's double-check that the workflow is using the Dev Profile we would like to expose it via NodePort - if workflowproj.IsDevProfile(workflow) { + if profiles.IsDevProfile(workflow) { service.Spec.Type = corev1.ServiceTypeNodePort } return service, nil diff --git a/controllers/profiles/profile.go b/controllers/profiles/profile.go index 33e06d755..794ca7a70 100644 --- a/controllers/profiles/profile.go +++ b/controllers/profiles/profile.go @@ -23,6 +23,7 @@ import ( "context" "github.com/apache/incubator-kie-kogito-serverless-operator/api/metadata" + "github.com/apache/incubator-kie-kogito-serverless-operator/workflowproj" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -72,3 +73,6 @@ type ReconciliationState interface { // PostReconcile performs the actions to perform after the reconciliation that are not mandatory PostReconcile(ctx context.Context, workflow *operatorapi.SonataFlow) error } + +// IsDevProfile is an alias for workflowproj.IsDevProfile +var IsDevProfile = workflowproj.IsDevProfile diff --git a/controllers/profiles/profile_test.go b/controllers/profiles/profile_test.go index aed86f99a..f2bc01390 100644 --- a/controllers/profiles/profile_test.go +++ b/controllers/profiles/profile_test.go @@ -22,7 +22,6 @@ package profiles import ( "testing" - "github.com/apache/incubator-kie-kogito-serverless-operator/workflowproj" "github.com/stretchr/testify/assert" "github.com/apache/incubator-kie-kogito-serverless-operator/test" @@ -30,11 +29,11 @@ import ( func Test_workflowIsDevProfile(t *testing.T) { workflowWithDevProfile := test.GetBaseSonataFlowWithDevProfile(t.Name()) - assert.True(t, workflowproj.IsDevProfile(workflowWithDevProfile)) + assert.True(t, IsDevProfile(workflowWithDevProfile)) workflowWithNoProfile := test.GetBaseSonataFlow(t.Name()) - assert.False(t, workflowproj.IsDevProfile(workflowWithNoProfile)) + assert.False(t, IsDevProfile(workflowWithNoProfile)) workflowWithProdProfile := test.GetBaseSonataFlowWithProdProfile(t.Name()) - assert.False(t, workflowproj.IsDevProfile(workflowWithProdProfile)) + assert.False(t, IsDevProfile(workflowWithProdProfile)) }