ricardozanini commented on code in PR #372:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/372#discussion_r1474679904
##########
controllers/platform/services/services.go:
##########
@@ -276,14 +301,25 @@ func (j JobServiceHandler) GenerateServiceProperties()
(*properties.Properties,
props.Set(constants.KogitoServiceURLProperty,
generateServiceURL(constants.KogitoServiceURLProtocol, j.platform.Namespace,
j.GetServiceName()))
props.Set(constants.JobServiceKafkaSmallRyeHealthProperty, "false")
// add data source reactive URL
- jspec := j.platform.Spec.Services.JobService
- if jspec != nil && jspec.Persistence != nil &&
jspec.Persistence.PostgreSql != nil {
- dataSourceReactiveURL, err :=
generateReactiveURL(jspec.Persistence.PostgreSql, j.GetServiceName(),
j.platform.Namespace, constants.DefaultDatabaseName,
constants.DefaultPostgreSQLPort)
- if err != nil {
- return nil, err
+ if j.hasPostgreSQLConfigured() {
+ var dataSourceReactiveURL string
+ var err error
+ if j.platform.Spec.Services.JobService.Persistence != nil &&
j.platform.Spec.Services.JobService.Persistence.PostgreSQL != nil {
+ dataSourceReactiveURL, err =
generateReactiveURL(j.platform.Spec.Services.JobService.Persistence.PostgreSQL,
j.GetServiceName(), j.platform.Namespace, constants.DefaultDatabaseName,
constants.DefaultPostgreSQLPort)
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ p := j.platform.Spec.Persistence.PostgreSQL
+ var namespace string
+ if len(p.ServiceRef.Namespace) > 0 {
+ namespace = fmt.Sprintf(".%s",
p.ServiceRef.Namespace)
+ }
+ dataSourceReactiveURL =
fmt.Sprintf("%s://%s%s:%d/%s?search_path=%s",
constants.PersistenceTypePostgreSQL, p.ServiceRef.Name, namespace,
*p.ServiceRef.Port, p.ServiceRef.DatabaseName, j.GetServiceName())
Review Comment:
Maybe here we should also have a function to better communication like you
did with `generateReactiveURL`.
--
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]