diff --git a/api/v1alpha08/sonataflowplatform_types.go b/api/v1alpha08/sonataflowplatform_types.go index faba215f4..91f23d14f 100644 --- a/api/v1alpha08/sonataflowplatform_types.go +++ b/api/v1alpha08/sonataflowplatform_types.go @@ -111,7 +111,7 @@ const ( ReasonDBMigrationStatusFailed string = "The database may be unreachable, invalid credentials supplied or flyway migration failed. Please check logs for further details." ) -type SonataFlowPlatformDBMigrationStatus struct { +type SonataFlowPlatformDBMigrationPhase struct { Status DBMigrationStatus `json:"dbMigrationStatus,omitempty"` Message string `json:"message,omitempty"` Reason string `json:"reason,omitempty"` @@ -137,7 +137,7 @@ type SonataFlowPlatformStatus struct { //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="triggers" Triggers []SonataFlowPlatformTriggerRef `json:"triggers,omitempty"` //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="dbMigrationStatus" - SonataFlowPlatformDBMigrationStatus *SonataFlowPlatformDBMigrationStatus `json:"sonataFlowPlatformDBMigrationStatus,omitempty"` + SonataFlowPlatformDBMigrationPhase *SonataFlowPlatformDBMigrationPhase `json:"sonataFlowPlatformDBMigrationPhase,omitempty"` } // SonataFlowPlatformTriggerRef defines a trigger created for the SonataFlowPlatform. @@ -148,8 +148,6 @@ type SonataFlowPlatformTriggerRef struct { // Namespace of the Trigger //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Trigger_NS" Namespace string `json:"namespace"` - //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="dbMigrationStatus" - SonataFlowPlatformDBMigrationStatus *SonataFlowPlatformDBMigrationStatus `json:"sonataFlowPlatformDBMigrationStatus,omitempty"` } // SonataFlowClusterPlatformRefStatus information related to the (optional) active SonataFlowClusterPlatform diff --git a/api/v1alpha08/zz_generated.deepcopy.go b/api/v1alpha08/zz_generated.deepcopy.go index 5bc699807..925067cc3 100644 --- a/api/v1alpha08/zz_generated.deepcopy.go +++ b/api/v1alpha08/zz_generated.deepcopy.go @@ -1218,16 +1218,16 @@ func (in *SonataFlowPlatform) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SonataFlowPlatformDBMigrationStatus) DeepCopyInto(out *SonataFlowPlatformDBMigrationStatus) { +func (in *SonataFlowPlatformDBMigrationPhase) DeepCopyInto(out *SonataFlowPlatformDBMigrationPhase) { *out = *in } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SonataFlowPlatformDBMigrationStatus. -func (in *SonataFlowPlatformDBMigrationStatus) DeepCopy() *SonataFlowPlatformDBMigrationStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SonataFlowPlatformDBMigrationPhase. +func (in *SonataFlowPlatformDBMigrationPhase) DeepCopy() *SonataFlowPlatformDBMigrationPhase { if in == nil { return nil } - out := new(SonataFlowPlatformDBMigrationStatus) + out := new(SonataFlowPlatformDBMigrationPhase) in.DeepCopyInto(out) return out } @@ -1335,13 +1335,11 @@ func (in *SonataFlowPlatformStatus) DeepCopyInto(out *SonataFlowPlatformStatus) if in.Triggers != nil { in, out := &in.Triggers, &out.Triggers *out = make([]SonataFlowPlatformTriggerRef, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + copy(*out, *in) } - if in.SonataFlowPlatformDBMigrationStatus != nil { - in, out := &in.SonataFlowPlatformDBMigrationStatus, &out.SonataFlowPlatformDBMigrationStatus - *out = new(SonataFlowPlatformDBMigrationStatus) + if in.SonataFlowPlatformDBMigrationPhase != nil { + in, out := &in.SonataFlowPlatformDBMigrationPhase, &out.SonataFlowPlatformDBMigrationPhase + *out = new(SonataFlowPlatformDBMigrationPhase) **out = **in } } @@ -1359,11 +1357,6 @@ func (in *SonataFlowPlatformStatus) DeepCopy() *SonataFlowPlatformStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SonataFlowPlatformTriggerRef) DeepCopyInto(out *SonataFlowPlatformTriggerRef) { *out = *in - if in.SonataFlowPlatformDBMigrationStatus != nil { - in, out := &in.SonataFlowPlatformDBMigrationStatus, &out.SonataFlowPlatformDBMigrationStatus - *out = new(SonataFlowPlatformDBMigrationStatus) - **out = **in - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SonataFlowPlatformTriggerRef. diff --git a/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml b/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml index 1f15688c6..b4542fb30 100644 --- a/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml +++ b/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml @@ -16896,7 +16896,7 @@ spec: description: The generation observed by the deployment controller. format: int64 type: integer - sonataFlowPlatformDBMigrationStatus: + sonataFlowPlatformDBMigrationPhase: properties: dbMigrationStatus: type: string @@ -16917,15 +16917,6 @@ spec: namespace: description: Namespace of the Trigger type: string - sonataFlowPlatformDBMigrationStatus: - properties: - dbMigrationStatus: - type: string - message: - type: string - reason: - type: string - type: object required: - name - namespace diff --git a/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml b/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml index 3bc4ec629..69f5651f4 100644 --- a/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml +++ b/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml @@ -16896,7 +16896,7 @@ spec: description: The generation observed by the deployment controller. format: int64 type: integer - sonataFlowPlatformDBMigrationStatus: + sonataFlowPlatformDBMigrationPhase: properties: dbMigrationStatus: type: string @@ -16917,15 +16917,6 @@ spec: namespace: description: Namespace of the Trigger type: string - sonataFlowPlatformDBMigrationStatus: - properties: - dbMigrationStatus: - type: string - message: - type: string - reason: - type: string - type: object required: - name - namespace diff --git a/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml b/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml index d57fc1a64..4c88d685c 100644 --- a/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/sonataflow-operator.clusterserviceversion.yaml @@ -165,12 +165,10 @@ spec: displayName: info path: info - displayName: dbMigrationStatus - path: sonataFlowPlatformDBMigrationStatus + path: sonataFlowPlatformDBMigrationPhase - description: Triggers list of triggers created for the SonataFlowPlatform displayName: triggers path: triggers - - displayName: dbMigrationStatus - path: triggers[0].sonataFlowPlatformDBMigrationStatus - description: Version the operator version controlling this Platform displayName: version path: version diff --git a/internal/controller/cfg/controllers_cfg.go b/internal/controller/cfg/controllers_cfg.go index bffbf7355..26d69f6a4 100644 --- a/internal/controller/cfg/controllers_cfg.go +++ b/internal/controller/cfg/controllers_cfg.go @@ -31,20 +31,6 @@ const ( defaultConfigMountPath = "/config/controllers_cfg.yaml" ) -const ( - dbMigrationJobName = "sonataflow-db-migrator-job" - dbMigrationContainerName = "db-migration-container" - dbMigratorToolImage = "quay.io/rhkp/incubator-kie-kogito-service-db-migration-postgresql:latest" - dbMigrationCmd = "./migration.sh" -) - -type DBMigrationJobCfg struct { - JobName string `yaml:"jobName,omitempty"` - ContainerName string `yaml:"containerName,omitempty"` - ToolImageName string `yaml:"toolImageName,omitempty"` - MigrationCmd string `yaml:"migrationCmd,omitempty"` -} - var controllersCfg *ControllersCfg var defaultControllersCfg = &ControllersCfg{ @@ -123,12 +109,3 @@ func GetCfg() *ControllersCfg { } return controllersCfg } - -func GetDBMigrationJobCfg() *DBMigrationJobCfg { - return &DBMigrationJobCfg{ - JobName: dbMigrationJobName, - ContainerName: dbMigrationContainerName, - ToolImageName: dbMigratorToolImage, - MigrationCmd: dbMigrationCmd, - } -} diff --git a/internal/controller/platform/dbMigratorJob.go b/internal/controller/platform/dbMigratorJob.go index e154cbe0a..861c1a3d1 100644 --- a/internal/controller/platform/dbMigratorJob.go +++ b/internal/controller/platform/dbMigratorJob.go @@ -29,7 +29,6 @@ import ( "github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08" operatorapi "github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08" "github.com/apache/incubator-kie-kogito-serverless-operator/container-builder/client" - "github.com/apache/incubator-kie-kogito-serverless-operator/internal/controller/cfg" "github.com/apache/incubator-kie-kogito-serverless-operator/internal/controller/platform/services" "github.com/apache/incubator-kie-kogito-serverless-operator/log" @@ -54,6 +53,20 @@ type DBMigratorJob struct { JobsServiceDataSource *QuarkusDataSource } +const ( + dbMigrationJobName = "sonataflow-db-migrator-job" + dbMigrationContainerName = "db-migration-container" + dbMigratorToolImage = "quay.io/rhkp/incubator-kie-kogito-service-db-migration-postgresql:latest" + dbMigrationCmd = "./migration.sh" +) + +type DBMigrationJobCfg struct { + JobName string + ContainerName string + ToolImageName string + MigrationCmd string +} + func getDBSchemaName(persistencePostgreSQL *operatorapi.PersistencePostgreSQL, defaultSchemaName string) string { jdbcURL := persistencePostgreSQL.JdbcUrl @@ -99,24 +112,33 @@ func getQuarkusDataSourceFromPersistence(ctx context.Context, platform *operator } func NewDBMigratorJobData(ctx context.Context, client client.Client, platform *operatorapi.SonataFlowPlatform, pshDI services.PlatformServiceHandler, pshJS services.PlatformServiceHandler) (*DBMigratorJob, error) { - if (pshDI.IsServiceSetInSpec() && pshDI.IsJobsBasedDBMigration()) || (pshJS.IsServiceSetInSpec() && pshJS.IsJobsBasedDBMigration()) { + + diJobsBasedDBMigration := false + jsJobsBasedDBMigration := false + + if pshDI.IsPersistenceEnabledtInSpec() { + diJobsBasedDBMigration = services.IsJobsBasedDBMigration(platform.Spec.Services.DataIndex.Persistence) + } + if pshJS.IsPersistenceEnabledtInSpec() { + jsJobsBasedDBMigration = services.IsJobsBasedDBMigration(platform.Spec.Services.JobService.Persistence) + } + + if (pshDI.IsServiceSetInSpec() && diJobsBasedDBMigration) || (pshJS.IsServiceSetInSpec() && jsJobsBasedDBMigration) { quarkusDataSourceDataIndex := getNewQuarkusDataSource("", "", "", "") quarkusDataSourceJobService := getNewQuarkusDataSource("", "", "", "") - migrateDbDataindex := pshDI.IsJobsBasedDBMigration() - if migrateDbDataindex { + if diJobsBasedDBMigration { quarkusDataSourceDataIndex = getQuarkusDataSourceFromPersistence(ctx, platform, platform.Spec.Services.DataIndex.Persistence, "defaultDi") } - migrateDbJobsservice := pshJS.IsJobsBasedDBMigration() - if migrateDbJobsservice { + if jsJobsBasedDBMigration { quarkusDataSourceJobService = getQuarkusDataSourceFromPersistence(ctx, platform, platform.Spec.Services.JobService.Persistence, "defaultJs") } return &DBMigratorJob{ - MigrateDBDataIndex: migrateDbDataindex, + MigrateDBDataIndex: diJobsBasedDBMigration, DataIndexDataSource: quarkusDataSourceDataIndex, - MigrateDBJobsService: migrateDbJobsservice, + MigrateDBJobsService: jsJobsBasedDBMigration, JobsServiceDataSource: quarkusDataSourceJobService, }, nil } @@ -124,7 +146,7 @@ func NewDBMigratorJobData(ctx context.Context, client client.Client, platform *o } func (dbmj DBMigratorJob) CreateJobDBMigration(platform *operatorapi.SonataFlowPlatform) *batchv1.Job { - dbMigrationJobCfg := cfg.GetDBMigrationJobCfg() + dbMigrationJobCfg := getDBMigrationJobCfg() job := &batchv1.Job{ ObjectMeta: metav1.ObjectMeta{ Name: dbMigrationJobCfg.JobName, @@ -193,15 +215,15 @@ func (dbmj DBMigratorJob) CreateJobDBMigration(platform *operatorapi.SonataFlowP return job } -func NewSonataFlowPlatformDBMigrationStatus(status v1alpha08.DBMigrationStatus, message string, reason string) *operatorapi.SonataFlowPlatformDBMigrationStatus { - return &operatorapi.SonataFlowPlatformDBMigrationStatus{ +func NewSonataFlowPlatformDBMigrationPhase(status v1alpha08.DBMigrationStatus, message string, reason string) *operatorapi.SonataFlowPlatformDBMigrationPhase { + return &operatorapi.SonataFlowPlatformDBMigrationPhase{ Status: status, Message: message, Reason: reason, } } -func UpdateSonataFlowPlatformDBMigrationStatus(dbMigrationStatus *operatorapi.SonataFlowPlatformDBMigrationStatus, status v1alpha08.DBMigrationStatus, message string, reason string) *operatorapi.SonataFlowPlatformDBMigrationStatus { +func UpdateSonataFlowPlatformDBMigrationPhase(dbMigrationStatus *operatorapi.SonataFlowPlatformDBMigrationPhase, status v1alpha08.DBMigrationStatus, message string, reason string) *operatorapi.SonataFlowPlatformDBMigrationPhase { if dbMigrationStatus != nil { dbMigrationStatus.Status = status dbMigrationStatus.Message = message @@ -211,26 +233,35 @@ func UpdateSonataFlowPlatformDBMigrationStatus(dbMigrationStatus *operatorapi.So return nil } +func getDBMigrationJobCfg() *DBMigrationJobCfg { + return &DBMigrationJobCfg{ + JobName: dbMigrationJobName, + ContainerName: dbMigrationContainerName, + ToolImageName: dbMigratorToolImage, + MigrationCmd: dbMigrationCmd, + } +} + func (dbmj DBMigratorJob) ReconcileMigratorJob(ctx context.Context, client client.Client, platform *operatorapi.SonataFlowPlatform) error { - platform.Status.SonataFlowPlatformDBMigrationStatus = NewSonataFlowPlatformDBMigrationStatus(operatorapi.DBMigrationStatusStarted, operatorapi.MessageDBMigrationStatusStarted, operatorapi.ReasonDBMigrationStatusStarted) + platform.Status.SonataFlowPlatformDBMigrationPhase = NewSonataFlowPlatformDBMigrationPhase(operatorapi.DBMigrationStatusStarted, operatorapi.MessageDBMigrationStatusStarted, operatorapi.ReasonDBMigrationStatusStarted) for { - job, err := client.BatchV1().Jobs(platform.Namespace).Get(ctx, cfg.GetDBMigrationJobCfg().JobName, metav1.GetOptions{}) + job, err := client.BatchV1().Jobs(platform.Namespace).Get(ctx, dbMigrationJobName, metav1.GetOptions{}) if err != nil { klog.V(log.E).InfoS("Error getting DB migrator job while monitoring completion: ", "error", err) return err } klog.V(log.I).InfoS("Started to monitor the db migration job: ", "error", err) - platform.Status.SonataFlowPlatformDBMigrationStatus = UpdateSonataFlowPlatformDBMigrationStatus(platform.Status.SonataFlowPlatformDBMigrationStatus, operatorapi.DBMigrationStatusInProgress, operatorapi.MessageDBMigrationStatusInProgress, operatorapi.ReasonDBMigrationStatusInProgress) + platform.Status.SonataFlowPlatformDBMigrationPhase = UpdateSonataFlowPlatformDBMigrationPhase(platform.Status.SonataFlowPlatformDBMigrationPhase, operatorapi.DBMigrationStatusInProgress, operatorapi.MessageDBMigrationStatusInProgress, operatorapi.ReasonDBMigrationStatusInProgress) klog.V(log.I).InfoS("Db migration job status: ", "active", job.Status.Active, "ready", job.Status.Ready, "failed", job.Status.Failed, "success", job.Status.Succeeded, "CompletedIndexes", job.Status.CompletedIndexes, "terminatedPods", job.Status.UncountedTerminatedPods) if job.Status.Failed > 0 { - platform.Status.SonataFlowPlatformDBMigrationStatus = UpdateSonataFlowPlatformDBMigrationStatus(platform.Status.SonataFlowPlatformDBMigrationStatus, operatorapi.DBMigrationStatusFailed, operatorapi.MessageDBMigrationStatusFailed, operatorapi.ReasonDBMigrationStatusFailed) + platform.Status.SonataFlowPlatformDBMigrationPhase = UpdateSonataFlowPlatformDBMigrationPhase(platform.Status.SonataFlowPlatformDBMigrationPhase, operatorapi.DBMigrationStatusFailed, operatorapi.MessageDBMigrationStatusFailed, operatorapi.ReasonDBMigrationStatusFailed) klog.V(log.E).InfoS("DB migrator job failed") return errors.New("DB migrator job failed and could not complete") } else if job.Status.Succeeded > 0 { - platform.Status.SonataFlowPlatformDBMigrationStatus = UpdateSonataFlowPlatformDBMigrationStatus(platform.Status.SonataFlowPlatformDBMigrationStatus, operatorapi.DBMigrationStatusSucceeded, operatorapi.MessageDBMigrationStatusSucceeded, operatorapi.ReasonDBMigrationStatusSucceeded) + platform.Status.SonataFlowPlatformDBMigrationPhase = UpdateSonataFlowPlatformDBMigrationPhase(platform.Status.SonataFlowPlatformDBMigrationPhase, operatorapi.DBMigrationStatusSucceeded, operatorapi.MessageDBMigrationStatusSucceeded, operatorapi.ReasonDBMigrationStatusSucceeded) klog.V(log.E).InfoS("DB migrator job completed successful") return nil } else { diff --git a/internal/controller/platform/services/services.go b/internal/controller/platform/services/services.go index d847d0b32..4a5b56fe9 100644 --- a/internal/controller/platform/services/services.go +++ b/internal/controller/platform/services/services.go @@ -111,37 +111,16 @@ type PlatformServiceHandler interface { CheckKSinkInjected() (bool, error) // Returns whether job based, service based or no DB migration is needed - GetDBMigrationApproach() operatorapi.DBMigrationStrategyType - // Returns true if job based db migration, false otherwise - IsJobsBasedDBMigration() bool - // Returns true if service based db migration, false otherwise - IsServiceBasedDBMigration() bool - // Returns true if no DB migration is needed - IsNoDBMigration() bool + GetDBMigrationStrategy() operatorapi.DBMigrationStrategyType } type DataIndexHandler struct { platform *operatorapi.SonataFlowPlatform } -// GetDBMigrationApproach returns DB migration approach -func (d *DataIndexHandler) GetDBMigrationApproach() operatorapi.DBMigrationStrategyType { - return getDBMigrationApproach(d.platform.Spec.Services.DataIndex.Persistence) -} - -// IsJobsBasedDBMigration returns true if job based db migration, false otherwise -func (d *DataIndexHandler) IsJobsBasedDBMigration() bool { - return isJobsBasedDBMigration(d.platform.Spec.Services.DataIndex.Persistence) -} - -// IsNoDBMigration returns true if no db migration, false otherwise -func (d *DataIndexHandler) IsNoDBMigration() bool { - return isNoDBMigration(d.platform.Spec.Services.DataIndex.Persistence) -} - -// IsServiceBasedDBMigration returns true if service based db migration false otherwise -func (d *DataIndexHandler) IsServiceBasedDBMigration() bool { - return isServiceBasedDBMigration(d.platform.Spec.Services.DataIndex.Persistence) +// GetDBMigrationStrategy returns DB migration approach +func (d *DataIndexHandler) GetDBMigrationStrategy() operatorapi.DBMigrationStrategyType { + return GetDBMigrationStrategy(d.platform.Spec.Services.DataIndex.Persistence) } func NewDataIndexHandler(platform *operatorapi.SonataFlowPlatform) PlatformServiceHandler { @@ -263,7 +242,7 @@ func (d *DataIndexHandler) hasPostgreSQLConfigured() bool { (d.platform.Spec.Persistence != nil && d.platform.Spec.Persistence.PostgreSQL != nil)) } -func getDBMigrationApproach(persistence *operatorapi.PersistenceOptionsSpec) operatorapi.DBMigrationStrategyType { +func GetDBMigrationStrategy(persistence *operatorapi.PersistenceOptionsSpec) operatorapi.DBMigrationStrategyType { dbMigrationStrategy := operatorapi.DBMigrationStrategyNone if persistence != nil { @@ -273,25 +252,25 @@ func getDBMigrationApproach(persistence *operatorapi.PersistenceOptionsSpec) ope return dbMigrationStrategy } -func isServiceBasedDBMigration(persistence *operatorapi.PersistenceOptionsSpec) bool { - dbMigrationStrategy := getDBMigrationApproach(persistence) +func IsServiceBasedDBMigration(persistence *operatorapi.PersistenceOptionsSpec) bool { + dbMigrationStrategy := GetDBMigrationStrategy(persistence) return dbMigrationStrategy == operatorapi.DBMigrationStrategyService } -func isJobsBasedDBMigration(persistence *operatorapi.PersistenceOptionsSpec) bool { - dbMigrationStrategy := getDBMigrationApproach(persistence) +func IsJobsBasedDBMigration(persistence *operatorapi.PersistenceOptionsSpec) bool { + dbMigrationStrategy := GetDBMigrationStrategy(persistence) return dbMigrationStrategy == operatorapi.DBMigrationStrategyJob } -func isNoDBMigration(persistence *operatorapi.PersistenceOptionsSpec) bool { - dbMigrationStrategy := getDBMigrationApproach(persistence) +func IsNoDBMigration(persistence *operatorapi.PersistenceOptionsSpec) bool { + dbMigrationStrategy := GetDBMigrationStrategy(persistence) return dbMigrationStrategy == operatorapi.DBMigrationStrategyNone || dbMigrationStrategy == "" } func isDBMigrationStrategyService(persistence *v1alpha08.PersistenceOptionsSpec) string { dbMigrationStrategyService := "true" if persistence != nil { - dbMigrationStrategyService = strconv.FormatBool(isServiceBasedDBMigration(persistence)) + dbMigrationStrategyService = strconv.FormatBool(IsServiceBasedDBMigration(persistence)) } return dbMigrationStrategyService @@ -350,24 +329,9 @@ type JobServiceHandler struct { platform *operatorapi.SonataFlowPlatform } -// GetDBMigrationApproach returns db migration approach otherwise -func (j *JobServiceHandler) GetDBMigrationApproach() operatorapi.DBMigrationStrategyType { - return getDBMigrationApproach(j.platform.Spec.Services.JobService.Persistence) -} - -// IsJobsBasedDBMigration returns true if job based db migration, false otherwise -func (j *JobServiceHandler) IsJobsBasedDBMigration() bool { - return isJobsBasedDBMigration(j.platform.Spec.Services.JobService.Persistence) -} - -// IsNoDBMigration returns true if no db migration, false otherwise -func (j *JobServiceHandler) IsNoDBMigration() bool { - return isNoDBMigration(j.platform.Spec.Services.JobService.Persistence) -} - -// IsServiceBasedDBMigration returns true if service based db migration, false otherwise -func (j *JobServiceHandler) IsServiceBasedDBMigration() bool { - return isServiceBasedDBMigration(j.platform.Spec.Services.JobService.Persistence) +// GetDBMigrationStrategy returns db migration approach otherwise +func (j *JobServiceHandler) GetDBMigrationStrategy() operatorapi.DBMigrationStrategyType { + return GetDBMigrationStrategy(j.platform.Spec.Services.JobService.Persistence) } func NewJobServiceHandler(platform *operatorapi.SonataFlowPlatform) PlatformServiceHandler { @@ -431,7 +395,7 @@ func (j *JobServiceHandler) IsServiceEnabledInSpec() bool { } func (j JobServiceHandler) IsPersistenceEnabledtInSpec() bool { - return j.IsServiceSetInSpec() && j.platform.Spec.Services.DataIndex.Persistence != nil + return j.IsServiceSetInSpec() && j.platform.Spec.Services.JobService.Persistence != nil } func (j *JobServiceHandler) isServiceEnabledInStatus() bool { diff --git a/operator.yaml b/operator.yaml index 93b1de7ab..0d620df44 100644 --- a/operator.yaml +++ b/operator.yaml @@ -17430,7 +17430,7 @@ spec: description: The generation observed by the deployment controller. format: int64 type: integer - sonataFlowPlatformDBMigrationStatus: + sonataFlowPlatformDBMigrationPhase: properties: dbMigrationStatus: type: string @@ -17451,15 +17451,6 @@ spec: namespace: description: Namespace of the Trigger type: string - sonataFlowPlatformDBMigrationStatus: - properties: - dbMigrationStatus: - type: string - message: - type: string - reason: - type: string - type: object required: - name - namespace