ricardozanini commented on code in PR #311:
URL: 
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/311#discussion_r1415440374


##########
controllers/platform/services.go:
##########
@@ -99,27 +98,9 @@ func createDataIndexDeployment(ctx context.Context, client 
client.Client, platfo
        liveProbe := readyProbe.DeepCopy()
        liveProbe.ProbeHandler.HTTPGet.Path = common.QuarkusHealthPathLive
        dataDeployContainer := &corev1.Container{
-               Image: common.DataIndexImageBase + 
common.PersistenceTypeEphemeral,
-               Env: []corev1.EnvVar{
-                       {
-                               Name:  "KOGITO_DATA_INDEX_QUARKUS_PROFILE",
-                               Value: "http-events-support",
-                       },
-                       {
-                               Name:  "QUARKUS_HTTP_CORS",
-                               Value: "true",
-                       },
-                       {
-                               Name:  "QUARKUS_HTTP_CORS_ORIGINS",
-                               Value: "/.*/",
-                       },
-               },
-               Resources: corev1.ResourceRequirements{
-                       Limits: corev1.ResourceList{
-                               corev1.ResourceCPU:    
resource.MustParse("100m"),
-                               corev1.ResourceMemory: 
resource.MustParse("256Mi"),
-                       },
-               },
+               Image:          
svc.GetServiceImageName(common.PersistenceTypeEphemeral),
+               Env:            svc.GetEnvironmentVariables(),
+               Resources:      svc.GetPodResourceRequirements(),

Review Comment:
   `svc` is an alias for Kubernetes Services, can we change this since this 
context is different, please?



##########
controllers/profiles/common/app_properties.go:
##########
@@ -38,34 +43,313 @@ import (
 )
 
 const (
-       ConfigMapWorkflowPropsVolumeName = "workflow-properties"
-       kogitoServiceUrlProperty         = "kogito.service.url"
-       kogitoServiceUrlProtocol         = "http"
-       dataIndexServiceUrlProperty      = 
"mp.messaging.outgoing.kogito-processinstances-events.url"
-       kafkaSmallRyeHealthProperty      = 
"quarkus.smallrye-health.check.\"io.quarkus.kafka.client.health.KafkaHealthCheck\".enabled"
-       dataIndexServiceUrlProtocol      = "http"
-
-       DataIndexImageBase = "quay.io/kiegroup/kogito-data-index-"
-       DataIndexName      = "data-index-service"
-
-       PersistenceTypeEphemeral   = "ephemeral"
-       PersistenceTypePostgressql = "postgresql"
-
+       ConfigMapWorkflowPropsVolumeName        = "workflow-properties"
+       kogitoServiceUrlProperty                = "kogito.service.url"
+       kogitoServiceUrlProtocol                = "http"
+       dataIndexServiceUrlProperty             = 
"mp.messaging.outgoing.kogito-processinstances-events.url"
+       kafkaSmallRyeHealthProperty             = 
"quarkus.smallrye-health.check.\"io.quarkus.kafka.client.health.KafkaHealthCheck\".enabled"
+       dataIndexServiceUrlProtocol             = "http"
+       jobServiceURLProperty                   = 
"mp.messaging.outgoing.kogito-job-service-job-request-events.url"
+       jobServiceKafkaSinkInjectionHealthCheck = 
`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled`
+       jobServiceStatusChangeEventsProperty    = 
"kogito.jobs-service.http.job-status-change-events"
+       jobServiceStatusChangeEventsURL         = 
"mp.messaging.outgoing.kogito-job-service-job-status-events-http.url"
+       jobServiceURLProtocol                   = "http"
+       jobServiceDataSourceReactiveURLProperty = 
"quarkus.datasource.reactive.url"
+
+       imageNamePrefix                          = "quay.io/kiegroup/kogito"
+       DataIndexServiceName                     = "data-index-service"
+       DataIndexName                            = "data-index"
+       JobServiceName                           = "jobs-service"
+       PersistenceTypeEphemeral                 = "ephemeral"
+       PersistenceTypePostgressql               = "postgresql"
        microprofileServiceCatalogPropertyPrefix = 
"org.kie.kogito.addons.discovery."
        discoveryLikePropertyPattern             = 
"^\\${(kubernetes|knative|openshift):(.*)}$"
+
+       defaultDatabaseName   string = "sonataflow"
+       defaultPostgreSQLPort int    = 5432
+)
+
+var (
+       immutableApplicationProperties = "quarkus.http.port=" + 
DefaultHTTPWorkflowPortIntStr.String() + "\n" +
+               "quarkus.http.host=0.0.0.0\n" +
+               // We disable the Knative health checks to not block the dev 
pod to run if Knative objects are not available
+               // See: 
https://kiegroup.github.io/kogito-docs/serverlessworkflow/latest/eventing/consume-produce-events-with-knative-eventing.html#ref-knative-eventing-add-on-source-configuration
+               "org.kie.kogito.addons.knative.eventing.health-enabled=false\n" 
+
+               "quarkus.devservices.enabled=false\n" +
+               "quarkus.kogito.devservices.enabled=false\n"
+
+       discoveryLikePropertyExpr                    = 
regexp.MustCompile(discoveryLikePropertyPattern)
+       _                         AppPropertyHandler = &appPropertyHandler{}
 )
 
-var immutableApplicationProperties = "quarkus.http.port=" + 
DefaultHTTPWorkflowPortIntStr.String() + "\n" +
-       "quarkus.http.host=0.0.0.0\n" +
-       // We disable the Knative health checks to not block the dev pod to run 
if Knative objects are not available
-       // See: 
https://kiegroup.github.io/kogito-docs/serverlessworkflow/latest/eventing/consume-produce-events-with-knative-eventing.html#ref-knative-eventing-add-on-source-configuration
-       "org.kie.kogito.addons.knative.eventing.health-enabled=false\n" +
-       "quarkus.devservices.enabled=false\n" +
-       "quarkus.kogito.devservices.enabled=false\n"
+type PlatformService interface {

Review Comment:
   We are mixing Application properties with object creations in this file. 
This `PlatformService` must be within the package `platform` and not be 
exported.



##########
controllers/profiles/common/app_properties.go:
##########
@@ -38,34 +43,313 @@ import (
 )
 
 const (
-       ConfigMapWorkflowPropsVolumeName = "workflow-properties"
-       kogitoServiceUrlProperty         = "kogito.service.url"
-       kogitoServiceUrlProtocol         = "http"
-       dataIndexServiceUrlProperty      = 
"mp.messaging.outgoing.kogito-processinstances-events.url"
-       kafkaSmallRyeHealthProperty      = 
"quarkus.smallrye-health.check.\"io.quarkus.kafka.client.health.KafkaHealthCheck\".enabled"
-       dataIndexServiceUrlProtocol      = "http"
-
-       DataIndexImageBase = "quay.io/kiegroup/kogito-data-index-"
-       DataIndexName      = "data-index-service"
-
-       PersistenceTypeEphemeral   = "ephemeral"
-       PersistenceTypePostgressql = "postgresql"
-
+       ConfigMapWorkflowPropsVolumeName        = "workflow-properties"
+       kogitoServiceUrlProperty                = "kogito.service.url"
+       kogitoServiceUrlProtocol                = "http"
+       dataIndexServiceUrlProperty             = 
"mp.messaging.outgoing.kogito-processinstances-events.url"
+       kafkaSmallRyeHealthProperty             = 
"quarkus.smallrye-health.check.\"io.quarkus.kafka.client.health.KafkaHealthCheck\".enabled"
+       dataIndexServiceUrlProtocol             = "http"
+       jobServiceURLProperty                   = 
"mp.messaging.outgoing.kogito-job-service-job-request-events.url"
+       jobServiceKafkaSinkInjectionHealthCheck = 
`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled`
+       jobServiceStatusChangeEventsProperty    = 
"kogito.jobs-service.http.job-status-change-events"
+       jobServiceStatusChangeEventsURL         = 
"mp.messaging.outgoing.kogito-job-service-job-status-events-http.url"
+       jobServiceURLProtocol                   = "http"
+       jobServiceDataSourceReactiveURLProperty = 
"quarkus.datasource.reactive.url"
+
+       imageNamePrefix                          = "quay.io/kiegroup/kogito"
+       DataIndexServiceName                     = "data-index-service"
+       DataIndexName                            = "data-index"
+       JobServiceName                           = "jobs-service"
+       PersistenceTypeEphemeral                 = "ephemeral"
+       PersistenceTypePostgressql               = "postgresql"
        microprofileServiceCatalogPropertyPrefix = 
"org.kie.kogito.addons.discovery."
        discoveryLikePropertyPattern             = 
"^\\${(kubernetes|knative|openshift):(.*)}$"
+
+       defaultDatabaseName   string = "sonataflow"
+       defaultPostgreSQLPort int    = 5432
+)

Review Comment:
   There are too many properties here that belong to services. Can we please 
have an app properties handler for workflows and other for the services?
   
   `platform` -> handler for Services
   `profiles` -> handler for workflows
   
   We might have a common module that defines a strategy for handling 
properties, but each module should have its own responsibility accordingly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to