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


##########
api/v1alpha08/sonataflowplatform_services_types.go:
##########
@@ -0,0 +1,93 @@
+// Copyright 2023 Red Hat, Inc. and/or its affiliates
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package v1alpha08
+
+// ServicesPlatformSpec describes the desired service configuration for "prod" 
workflows.
+type ServicesPlatformSpec struct {
+       // Deploys the Data Index service for use by "prod" profile workflows.
+       // +optional
+       DataIndex *ServicesPodTemplateSpec `json:"dataIndex,omitempty"`
+       // Persists service(s) to a datasource of choice. Ephemeral by default.
+       // +optional
+       Persistence *PersistenceOptions `json:"persistence,omitempty"`
+}
+
+// ServicesPodTemplateSpec describes the desired custom Kubernetes PodTemplate 
definition for the deployed flow.
+//
+// The ContainerSpec describes the container where the actual service is 
running. It will override any default definitions.
+// For example, to override the image one can use 
`.spec.services.dataIndex.container.image = my/image:tag`.
+type ServicesPodTemplateSpec struct {
+       // Container is the Kubernetes container where the service should run.
+       // One can change this attribute in order to override the defaults 
provided by the operator.
+       // +optional
+       Container *ContainerSpec `json:"container,omitempty"`
+       // +optional
+       PodSpec `json:",inline"`
+       // +optional
+       Replicas *int32 `json:"replicas,omitempty"`
+       // Determines whether "prod" profile workflows should be configured to 
use this service
+       // +optional
+       Enabled *bool `json:"enabled,omitempty"`
+}
+
+// PersistenceOptions configure the services to persist to a datasource of 
choice
+// +kubebuilder:validation:MaxProperties=1
+type PersistenceOptions struct {
+       // Connect configured services to a postgresql database.
+       // +optional
+       PostgreSql *PersistencePostgreSql `json:"postgresql,omitempty"`
+}
+
+// PersistencePostgreSql configure postgresql connection for service(s).
+// +kubebuilder:validation:MinProperties=2
+// +kubebuilder:validation:MaxProperties=2
+type PersistencePostgreSql struct {
+       // Secret reference to the database user credentials
+       SecretRef PostgreSqlSecretOptions `json:"secretRef"`
+       // Service reference to postgresql datasource. Mutually exclusive to 
jdbcUrl.
+       // +optional
+       ServiceRef PostgreSqlServiceOptions `json:"serviceRef,omitempty"`
+       // PostgreSql JDBC URL. Mutually exclusive to serviceRef.
+       // e.g. 
"jdbc:postgresql://host:port/database?currentSchema=data-index-service"
+       // +optional
+       JdbcUrl string `json:"jdbcUrl,omitempty"`
+}
+
+// PostgreSqlSecretOptions use credential secret for postgresql connection.
+type PostgreSqlSecretOptions struct {
+       // Name of the postgresql credentials secret.
+       Name string `json:"name"`
+       // Defaults to POSTGRESQL_USER
+       // +optional
+       UserKey string `json:"userKey,omitempty"`
+       // Defaults to POSTGRESQL_PASSWORD
+       // +optional
+       PasswordKey string `json:"passwordKey,omitempty"`
+}
+
+// PostgreSqlServiceOptions use k8s service to configure postgresql jdbc url.
+type PostgreSqlServiceOptions struct {
+       // Name of the postgresql k8s service.
+       Name string `json:"name"`
+       // Namespace of the postgresql k8s service. Defaults to the 
SonataFlowPlatform's local namespace.
+       // +optional
+       Namespace string `json:"namespace,omitempty"`
+       // Port to use when connecting to the postgresql k8s service. Defaults 
to 5432.
+       // +optional
+       Port *int `json:"port,omitempty"`
+       // Name of postgresql database to be used. Defaults to "sonataflow"
+       // +optional
+       DatabaseName string `json:"databaseName,omitempty"`

Review Comment:
   @tchughesiv yes, indeed. We can either:
   - Keep the persistence config here and add a `persistence.schema` in the 
data index object or
   - Move the persistence config to data index, as stated.
   
   Scenarios:
   - Users wanna have two different instances, so all good they keep them 
separated in each structure
   - Users wanna have one instance, two schemas, then have to duplicate info in 
both services
   
   I think I'd rather move to data index, and later have one in jobs services. 
Users can duplicate info, it's less error prune. 
   
   wdyt guys?



-- 
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