@@ -51,7 +51,6 @@ import (
5151 "github.com/cobaltcore-dev/cortex/internal/scheduling/pods"
5252 "github.com/cobaltcore-dev/cortex/internal/scheduling/reservations"
5353 "github.com/cobaltcore-dev/cortex/internal/scheduling/reservations/commitments"
54- reservationscontroller "github.com/cobaltcore-dev/cortex/internal/scheduling/reservations/controller"
5554 "github.com/cobaltcore-dev/cortex/internal/scheduling/reservations/failover"
5655 "github.com/cobaltcore-dev/cortex/pkg/conf"
5756 "github.com/cobaltcore-dev/cortex/pkg/monitoring"
@@ -487,18 +486,37 @@ func main() {
487486 os .Exit (1 )
488487 }
489488 }
490- if slices .Contains (mainConfig .EnabledControllers , "reservations-controller" ) {
491- setupLog .Info ("enabling controller" , "controller" , "reservations-controller" )
492- monitor := reservationscontroller . NewControllerMonitor (multiclusterClient )
489+ if slices .Contains (mainConfig .EnabledControllers , "committed-resource- reservations-controller" ) {
490+ setupLog .Info ("enabling controller" , "controller" , "committed-resource- reservations-controller" )
491+ monitor := reservations . NewMonitor (multiclusterClient )
493492 metrics .Registry .MustRegister (& monitor )
494- reservationsControllerConfig := conf .GetConfigOrDie [reservationscontroller.Config ]()
493+ commitmentsConfig := conf .GetConfigOrDie [commitments.Config ]()
494+ commitmentsDefaults := commitments .DefaultConfig ()
495+ if commitmentsConfig .RequeueIntervalActive == 0 {
496+ commitmentsConfig .RequeueIntervalActive = commitmentsDefaults .RequeueIntervalActive
497+ }
498+ if commitmentsConfig .RequeueIntervalRetry == 0 {
499+ commitmentsConfig .RequeueIntervalRetry = commitmentsDefaults .RequeueIntervalRetry
500+ }
501+ if commitmentsConfig .PipelineDefault == "" {
502+ commitmentsConfig .PipelineDefault = commitmentsDefaults .PipelineDefault
503+ }
504+ if commitmentsConfig .SchedulerURL == "" {
505+ commitmentsConfig .SchedulerURL = commitmentsDefaults .SchedulerURL
506+ }
507+ if commitmentsConfig .ChangeAPIWatchReservationsTimeout == 0 {
508+ commitmentsConfig .ChangeAPIWatchReservationsTimeout = commitmentsDefaults .ChangeAPIWatchReservationsTimeout
509+ }
510+ if commitmentsConfig .ChangeAPIWatchReservationsPollInterval == 0 {
511+ commitmentsConfig .ChangeAPIWatchReservationsPollInterval = commitmentsDefaults .ChangeAPIWatchReservationsPollInterval
512+ }
495513
496- if err := (& reservationscontroller. ReservationReconciler {
514+ if err := (& commitments. CommitmentReservationController {
497515 Client : multiclusterClient ,
498516 Scheme : mgr .GetScheme (),
499- Conf : reservationsControllerConfig ,
517+ Conf : commitmentsConfig ,
500518 }).SetupWithManager (mgr , multiclusterClient ); err != nil {
501- setupLog .Error (err , "unable to create controller" , "controller" , "Reservation " )
519+ setupLog .Error (err , "unable to create controller" , "controller" , "CommitmentReservation " )
502520 os .Exit (1 )
503521 }
504522 }
@@ -677,9 +695,13 @@ func main() {
677695 setupLog .Info ("starting commitments syncer" )
678696 syncer := commitments .NewSyncer (multiclusterClient )
679697 syncerConfig := conf .GetConfigOrDie [commitments.SyncerConfig ]()
698+ syncerDefaults := commitments .DefaultSyncerConfig ()
699+ if syncerConfig .SyncInterval == 0 {
700+ syncerConfig .SyncInterval = syncerDefaults .SyncInterval
701+ }
680702 if err := (& task.Runner {
681703 Client : multiclusterClient ,
682- Interval : time . Hour ,
704+ Interval : syncerConfig . SyncInterval ,
683705 Name : "commitments-sync-task" ,
684706 Run : func (ctx context.Context ) error { return syncer .SyncReservations (ctx ) },
685707 Init : func (ctx context.Context ) error { return syncer .Init (ctx , syncerConfig ) },
0 commit comments