Background
DataLoad and DataMigrate both support three trigger policies via spec.policy:
Once — run the job once
Cron — run on a schedule
OnEvent — run when triggered by an event
Each has a corresponding StatusHandler implementation (OnceStatusHandler, CronStatusHandler, OnEventStatusHandler).
Problem
DataProcess currently has no Policy field in its spec and always uses OnceStatusHandler regardless:
// pkg/controllers/v1alpha1/dataprocess/implement.go
func (r *dataProcessOperation) GetStatusHandler() dataoperation.StatusHandler {
// TODO: Support dataProcess.Spec.Policy
return &OnceStatusHandler{Client: r.Client, dataProcess: r.dataProcess}
}
This means users cannot schedule recurring data processing jobs or trigger them on events functionality that is available for the other two data operations.
Proposed solution
- Add
Policy and Schedule fields to DataProcessSpec in api/v1alpha1/dataprocess_types.go, matching the pattern from DataLoadSpec and DataMigrateSpec
- Implement
CronStatusHandler and OnEventStatusHandler in pkg/controllers/v1alpha1/dataprocess/status_handler.go
- Update
GetStatusHandler() to switch on policy
- Regenerate CRD manifests via
make generate
- Add tests for all handlers
Notes
This follows the same pattern established in DataLoad and DataMigrate. Happy to work on this if the approach looks right.
Background
DataLoadandDataMigrateboth support three trigger policies viaspec.policy:Once— run the job onceCron— run on a scheduleOnEvent— run when triggered by an eventEach has a corresponding
StatusHandlerimplementation (OnceStatusHandler,CronStatusHandler,OnEventStatusHandler).Problem
DataProcesscurrently has noPolicyfield in its spec and always usesOnceStatusHandlerregardless:This means users cannot schedule recurring data processing jobs or trigger them on events functionality that is available for the other two data operations.
Proposed solution
PolicyandSchedulefields toDataProcessSpecinapi/v1alpha1/dataprocess_types.go, matching the pattern fromDataLoadSpecandDataMigrateSpecCronStatusHandlerandOnEventStatusHandlerinpkg/controllers/v1alpha1/dataprocess/status_handler.goGetStatusHandler()to switch on policymake generateNotes
This follows the same pattern established in
DataLoadandDataMigrate. Happy to work on this if the approach looks right.