jordigilh commented on code in PR #372:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/372#discussion_r1478463453
##########
api/v1alpha08/sonataflowplatform_types.go:
##########
@@ -45,7 +45,23 @@ type SonataFlowPlatformSpec struct {
// Only workflows without the `sonataflow.org/profile: dev` annotation
will be configured to use these service(s).
// Setting this will override the use of any cluster-scoped services
that might be defined via `SonataFlowClusterPlatform`.
// +optional
- Services *ServicesPlatformSpec `json:"services,omitempty"`
+ Services ServicesPlatformSpec `json:"services,omitempty"`
+ // Persistence defines the platform persistence configuration. When
this field is set,
+ // the configuration is used as the persistence for platform services
and sonataflow instances
+ // that don't provide one of their own.
+ // +optional
+ Persistence *PersistencePlatformSpec `json:"persistence,omitempty"`
+}
+
+// PersistencePlatformSpec configures the DataBase support for both platform
services and workflows. For services, it allows
+// configuring a generic database connectivity if the service does not come
with its own configured. In case of workflows,
+// the operator will add the necessary JDBC properties to in the workflow's
application.properties so that it can communicate
+// with the persistence service based on the spec provided here.
+// +optional
+type PersistencePlatformSpec struct {
Review Comment:
Will rename
##########
controllers/platform/services/properties_services_test.go:
##########
@@ -173,9 +173,6 @@ func generatePlatform(opts ...plfmOptionFn)
*operatorapi.SonataFlowPlatform {
func setJobServiceEnabledValue(v *bool) plfmOptionFn {
return func(p *operatorapi.SonataFlowPlatform) {
- if p.Spec.Services == nil {
- p.Spec.Services = &operatorapi.ServicesPlatformSpec{}
- }
Review Comment:
ack
##########
api/v1alpha08/sonataflowplatform_types.go:
##########
@@ -45,7 +45,23 @@ type SonataFlowPlatformSpec struct {
// Only workflows without the `sonataflow.org/profile: dev` annotation
will be configured to use these service(s).
// Setting this will override the use of any cluster-scoped services
that might be defined via `SonataFlowClusterPlatform`.
// +optional
- Services *ServicesPlatformSpec `json:"services,omitempty"`
Review Comment:
Not sure how this came here, definitely something I did by mistake but not a
problem to revert it.
##########
controllers/profiles/common/object_creators.go:
##########
@@ -157,7 +159,13 @@ func defaultContainer(workflow *operatorapi.SonataFlow)
(*corev1.Container, erro
if err := mergo.Merge(defaultFlowContainer,
workflow.Spec.PodTemplate.Container.ToContainer(), mergo.WithOverride); err !=
nil {
return nil, err
}
- defaultFlowContainer = ConfigurePersistence(defaultFlowContainer,
workflow.Spec.Persistence, defaultSchemaName, workflow.Namespace)
+ if workflow.Spec.Persistence != nil {
Review Comment:
There are 3 scenarios managed here:
* Persistence field in the workflow spec is nil: If the persistence field is
nil, then the workflow will have no persistence at all.
* Persistence is empty (`{}`): Persistence will be pull from the platform if
it exists.
* Persistence is populated: Use the one in workflow.
Let me know if that makes sense in this case.
##########
controllers/platform/platformutils.go:
##########
@@ -111,15 +111,13 @@ func setPlatformDefaults(p
*operatorapi.SonataFlowPlatform, verbose bool) error
}
// When dataIndex object set, default to enabled if bool not set
- if p.Spec.Services != nil {
- var enable = true
- if p.Spec.Services.DataIndex != nil &&
p.Spec.Services.DataIndex.Enabled == nil {
- p.Spec.Services.DataIndex.Enabled = &enable
- }
- // When the JobService field has a value, default to enabled if
the `Enabled` field's value is nil
- if p.Spec.Services.JobService != nil &&
p.Spec.Services.JobService.Enabled == nil {
- p.Spec.Services.JobService.Enabled = &enable
- }
Review Comment:
ack
--
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]