Skip to content

Commit

Permalink
use same ref and update tracker for both apps and repos
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhelfand authored and ewrenn8 committed Jun 11, 2021
1 parent 127d163 commit d0d744d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions cmd/controller/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,15 @@ func Run(opts Options, runLog logr.Logger) {
os.Exit(1)
}

refTracker := reftracker.NewAppRefTracker()
updateStatusTracker := reftracker.NewAppUpdateStatus()

{ // add controller for apps
appRefTracker := reftracker.NewAppRefTracker()
appUpdateStatus := reftracker.NewAppUpdateStatus()
schApp := handlers.NewSecretHandler(runLog, appRefTracker, appUpdateStatus)
cfgmhApp := handlers.NewConfigMapHandler(runLog, appRefTracker, appUpdateStatus)
schApp := handlers.NewSecretHandler(runLog, refTracker, updateStatusTracker)
cfgmhApp := handlers.NewConfigMapHandler(runLog, refTracker, updateStatusTracker)
ctrlAppOpts := controller.Options{
Reconciler: NewUniqueReconciler(&ErrReconciler{
delegate: NewAppsReconciler(kcClient, runLog.WithName("ar"), appFactory, appRefTracker, appUpdateStatus),
delegate: NewAppsReconciler(kcClient, runLog.WithName("ar"), appFactory, refTracker, updateStatusTracker),
log: runLog.WithName("pr"),
}),
MaxConcurrentReconciles: opts.Concurrency,
Expand Down Expand Up @@ -185,12 +186,10 @@ func Run(opts Options, runLog logr.Logger) {
}

{ // add controller for pkgrepositories
pkgrRefTracker := reftracker.NewAppRefTracker()
pkgrUpdateStatus := reftracker.NewAppUpdateStatus()
schRepo := handlers.NewSecretHandler(runLog, pkgrRefTracker, pkgrUpdateStatus)
schRepo := handlers.NewSecretHandler(runLog, refTracker, updateStatusTracker)

pkgRepositoriesCtrlOpts := controller.Options{
Reconciler: NewPkgRepositoryReconciler(kcClient, runLog.WithName("prr"), appFactory, pkgrRefTracker, pkgrUpdateStatus),
Reconciler: NewPkgRepositoryReconciler(kcClient, runLog.WithName("prr"), appFactory, refTracker, updateStatusTracker),
// TODO: Consider making this configurable for multiple PackageRepo reconciles
MaxConcurrentReconciles: 1,
}
Expand Down

0 comments on commit d0d744d

Please sign in to comment.