Skip to content

Commit

Permalink
Changes based on latest feedback from Ricardo
Browse files Browse the repository at this point in the history
Signed-off-by: Jordi Gil <[email protected]>
  • Loading branch information
jordigilh committed Jan 29, 2024
1 parent 577f9f0 commit 7b43534
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 40 deletions.
20 changes: 4 additions & 16 deletions api/v1alpha08/sonataflowplatform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ type SonataFlowPlatformSpec struct {
}

// PlatformPersistenceSpec 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 the workflow
// the configuration is defined by the image name of the supported database. When the workflow is configured to require
// a database backend type supported by the platform (that is, the platform CR contains an image name for that database type)
// , the workflow pod is configured to contain a sidecar container running the database image defined here, and the workflow
// JDBC connectivity is setup to point to the DB container.
// 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 PlatformPersistenceSpec struct {
// Connect configured services to a postgresql database.
Expand All @@ -69,7 +67,7 @@ type PlatformPersistenceSpec struct {
// PostgreSQLPlatformSpec provides the generic configuration details to configure the JDBC URL and establish a connection for each managed services when they don't provide their own configuration.
type PostgreSQLPlatformSpec struct {
// SecretRef contains the database user credentials
SecretRef SecretReference `json:"secretRef"`
SecretRef PostgreSqlSecretOptions `json:"secretRef"`
// ServiceRef contains the K8s service name and namespace location of the PostgreSQL service.
ServiceRef ServiceReference `json:"serviceRef,omitempty"`
// Name of postgresql database to be used. Defaults to "sonataflow"
Expand All @@ -89,16 +87,6 @@ type ServiceReference struct {
Port int `json:"port,omitempty"`
}

// SecretReference use of a secret to store the credentials to authenticate in the JDBC connection.
type SecretReference struct {
// Name of the postgresql credentials secret. This field is mandatory.
Name string `json:"name"`
// +optional
UserKey string `json:"userKey,omitempty"`
// +optional
PasswordKey string `json:"passwordKey,omitempty"`
}

// PlatformCluster is the kind of orchestration cluster the platform is installed into
// +kubebuilder:validation:Enum=kubernetes;openshift
type PlatformCluster string
Expand Down
15 changes: 0 additions & 15 deletions api/v1alpha08/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion bundle/manifests/sonataflow.org_sonataflowplatforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,12 @@ spec:
properties:
name:
description: Name of the postgresql credentials secret.
This field is mandatory.
type: string
passwordKey:
description: Defaults to POSTGRESQL_PASSWORD
type: string
userKey:
description: Defaults to POSTGRESQL_USER
type: string
required:
- name
Expand Down
3 changes: 2 additions & 1 deletion config/crd/bases/sonataflow.org_sonataflowplatforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,12 @@ spec:
properties:
name:
description: Name of the postgresql credentials secret.
This field is mandatory.
type: string
passwordKey:
description: Defaults to POSTGRESQL_PASSWORD
type: string
userKey:
description: Defaults to POSTGRESQL_USER
type: string
required:
- name
Expand Down
2 changes: 1 addition & 1 deletion controllers/platform/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (d DataIndexHandler) ConfigurePersistence(containerSpec *corev1.Container)
c.Env = append(c.Env, persistence.ConfigurePostgreSQLEnvFromPlatformSpec(d.platform.Spec.Persistence.PostgreSQL, d.GetServiceName())...)
}
// specific to DataIndex
c.Env = append(c.Env, corev1.EnvVar{Name: "QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION", Value: "update"}, corev1.EnvVar{Name: "QUARKUS_FLYWAY_MIGRATE_AT_START", Value: "true"})
c.Env = append(c.Env, corev1.EnvVar{Name: quarkusHibernateORMDatabaseGeneration, Value: "update"}, corev1.EnvVar{Name: quarkusFlywayMigrateAtStart, Value: "true"})
return c
}
return containerSpec
Expand Down
6 changes: 3 additions & 3 deletions controllers/profiles/common/object_creators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func TestMergePodSpec_WithServicedPostgreSQL_In_Platform_CR_And_Worflow_Requesti
&v1alpha08.PlatformPersistenceSpec{
PostgreSQL: &v1alpha08.PostgreSQLPlatformSpec{
DatabaseName: "foo",
SecretRef: v1alpha08.SecretReference{
SecretRef: v1alpha08.PostgreSqlSecretOptions{
Name: "foo_secret",
UserKey: "username",
PasswordKey: "password",
Expand Down Expand Up @@ -439,7 +439,7 @@ func TestMergePodSpec_WithServicedPostgreSQL_In_Platform_And_In_Workflow_CR(t *t
&v1alpha08.PlatformPersistenceSpec{
PostgreSQL: &v1alpha08.PostgreSQLPlatformSpec{
DatabaseName: "foo",
SecretRef: v1alpha08.SecretReference{
SecretRef: v1alpha08.PostgreSqlSecretOptions{
Name: "foo_secret",
UserKey: "username",
PasswordKey: "password",
Expand Down Expand Up @@ -537,7 +537,7 @@ func TestMergePodSpec_WithServicedPostgreSQL_In_Platform_But_Workflow_CR_Not_Req
&v1alpha08.PlatformPersistenceSpec{
PostgreSQL: &v1alpha08.PostgreSQLPlatformSpec{
DatabaseName: "foo",
SecretRef: v1alpha08.SecretReference{
SecretRef: v1alpha08.PostgreSqlSecretOptions{
Name: "foo_secret",
UserKey: "username",
PasswordKey: "password",
Expand Down
4 changes: 2 additions & 2 deletions controllers/sonataflowplatform_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func TestSonataFlowPlatformController(t *testing.T) {
},
Persistence: &v1alpha08.PlatformPersistenceSpec{
PostgreSQL: &v1alpha08.PostgreSQLPlatformSpec{
SecretRef: v1alpha08.SecretReference{Name: "generic", UserKey: "POSTGRESQL_USER", PasswordKey: "POSTGRESQL_PASSWORD"},
SecretRef: v1alpha08.PostgreSqlSecretOptions{Name: "generic", UserKey: "POSTGRESQL_USER", PasswordKey: "POSTGRESQL_PASSWORD"},
ServiceRef: v1alpha08.ServiceReference{Name: "postgresql", Namespace: "default", Port: 5432},
DatabaseName: "sonataflow",
},
Expand Down Expand Up @@ -369,7 +369,7 @@ func TestSonataFlowPlatformController(t *testing.T) {
},
Persistence: &v1alpha08.PlatformPersistenceSpec{
PostgreSQL: &v1alpha08.PostgreSQLPlatformSpec{
SecretRef: v1alpha08.SecretReference{Name: "generic", UserKey: "POSTGRESQL_USER", PasswordKey: "POSTGRESQL_PASSWORD"},
SecretRef: v1alpha08.PostgreSqlSecretOptions{Name: "generic", UserKey: "POSTGRESQL_USER", PasswordKey: "POSTGRESQL_PASSWORD"},
ServiceRef: v1alpha08.ServiceReference{Name: "postgresql", Namespace: "default", Port: 5432},
DatabaseName: "sonataflow",
},
Expand Down
3 changes: 2 additions & 1 deletion operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -803,11 +803,12 @@ spec:
properties:
name:
description: Name of the postgresql credentials secret.
This field is mandatory.
type: string
passwordKey:
description: Defaults to POSTGRESQL_PASSWORD
type: string
userKey:
description: Defaults to POSTGRESQL_USER
type: string
required:
- name
Expand Down

0 comments on commit 7b43534

Please sign in to comment.