Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rhkp committed Dec 5, 2024
1 parent 358ac35 commit fbe1b6b
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ import (

// ServicesPlatformSpec describes the desired service configuration for workflows without the `sonataflow.org/profile: dev` annotation.
type ServicesPlatformSpec struct {
// true = Use DB Migration Job with DB Migrator tool image
// false = Use built-in DB migration capability within services e.g. DI/JS
// +optional
// +default: false
JobBasedDbMigration bool `json:"jobBasedDbMigration,omitempty"`
// Deploys the Data Index service for use by workflows without the `sonataflow.org/profile: dev` annotation.
// +optional
DataIndex *DataIndexServiceSpec `json:"dataIndex,omitempty"`
Expand Down

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

2 changes: 2 additions & 0 deletions packages/sonataflow-operator/api/zz_generated.deepcopy.go

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type DBMigratorJob struct {
const (
dbMigrationJobName = "sonataflow-db-migrator-job"
dbMigrationContainerName = "db-migration-container"
dbMigratorToolImage = "quay.io/rhkp/incubator-kie-kogito-service-db-migration-postgresql:latest"
dbMigratorToolImage = "docker.io/apache/incubator-kie-kogito-db-migrator-tool:latest"
dbMigrationCmd = "./migration.sh"
)

Expand Down Expand Up @@ -89,17 +89,8 @@ func getDBSchemaName(persistencePostgreSQL *operatorapi.PersistencePostgreSQL, d
return defaultSchemaName
}

func getNewQuarkusDataSource(jdbcURL string, userName string, password string, schema string) *QuarkusDataSource {
return &QuarkusDataSource{
JdbcUrl: jdbcURL,
Username: userName,
Password: password,
Schema: schema,
}
}

func getQuarkusDataSourceFromPersistence(ctx context.Context, platform *operatorapi.SonataFlowPlatform, persistence *operatorapi.PersistenceOptionsSpec, defaultSchemaName string) *QuarkusDataSource {
quarkusDataSource := getNewQuarkusDataSource("", "", "", "")
quarkusDataSource := &QuarkusDataSource{}
if persistence != nil && persistence.PostgreSQL != nil {
quarkusDataSource.JdbcUrl = persistence.PostgreSQL.JdbcUrl
quarkusDataSource.Username, _ = services.GetSecretKeyValueString(ctx, persistence.PostgreSQL.SecretRef.Name, persistence.PostgreSQL.SecretRef.UserKey, platform.Namespace)
Expand All @@ -122,8 +113,8 @@ func NewDBMigratorJobData(ctx context.Context, client client.Client, platform *o
}

if (pshDI.IsServiceSetInSpec() && diJobsBasedDBMigration) || (pshJS.IsServiceSetInSpec() && jsJobsBasedDBMigration) {
quarkusDataSourceDataIndex := getNewQuarkusDataSource("", "", "", "")
quarkusDataSourceJobService := getNewQuarkusDataSource("", "", "", "")
quarkusDataSourceDataIndex := &QuarkusDataSource{}
quarkusDataSourceJobService := &QuarkusDataSource{}

if diJobsBasedDBMigration {
quarkusDataSourceDataIndex = getQuarkusDataSourceFromPersistence(ctx, platform, platform.Spec.Services.DataIndex.Persistence, "defaultDi")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ import (
func GetSecretKeyValueString(ctx context.Context, secretName string, secretKey string, nameSpace string) (string, error) {
secret := corev1.Secret{}
err := utils.GetClient().Get(ctx, ctrl.ObjectKey{Namespace: nameSpace, Name: secretName}, &secret)
if err != nil {
panic(err.Error())
}


if err != nil {
klog.V(log.E).InfoS("Error extracting secret: ", "namespace", nameSpace, "error", err)
return "", err
Expand Down
5 changes: 0 additions & 5 deletions packages/sonataflow-operator/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9239,11 +9239,6 @@ spec:
type: string
type: object
type: object
jobBasedDbMigration:
description: |-
true = Use DB Migration Job with DB Migrator tool image
false = Use built-in DB migration capability within services e.g. DI/JS
type: boolean
jobService:
description: "Deploys the Job service for use by workflows without
the `sonataflow.org/profile: dev` annotation."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ spec:
strategyOptions:
KanikoBuildCacheEnabled: "true"
services:
# jobBasedDbMigration: false
dataIndex:
enabled: true
persistence:
Expand Down

0 comments on commit fbe1b6b

Please sign in to comment.