Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco committed May 29, 2019
1 parent 886f598 commit 6735611
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions cmd/helm-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,6 @@ func main() {
nsOpt := ifinformers.WithNamespace(*namespace)
ifInformerFactory := ifinformers.NewSharedInformerFactoryWithOptions(ifClient, *chartsSyncInterval, nsOpt)
fhrInformer := ifInformerFactory.Flux().V1beta1().HelmReleases()
go ifInformerFactory.Start(shutdown)

// wait for the caches to be synced before starting workers
mainLogger.Log("info", "waiting for informer caches to sync")
if ok := cache.WaitForCacheSync(shutdown, fhrInformer.Informer().HasSynced); !ok {
mainLogger.Log("error", "failed to wait for caches to sync")
os.Exit(1)
}
mainLogger.Log("info", "informer caches synced")

// the status updater, to keep track of the release status for
// every HelmRelease
statusUpdater := status.New(ifClient, kubeClient, helmClient, *namespace)
go statusUpdater.Loop(shutdown, log.With(logger, "component", "status"))

queue := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "ChartRelease")

Expand All @@ -201,10 +187,26 @@ func main() {
chartsync.Config{LogDiffs: *logReleaseDiffs, UpdateDeps: *updateDependencies, GitTimeout: *gitTimeout, GitPollInterval: *gitPollInterval},
*namespace,
)
chartSync.Run(shutdown, errc, shutdownWg)

// start FluxRelease informer
opr := operator.New(log.With(logger, "component", "operator"), *logReleaseDiffs, kubeClient, fhrInformer, queue, chartSync)
go ifInformerFactory.Start(shutdown)

// wait for the caches to be synced before starting workers
mainLogger.Log("info", "waiting for informer caches to sync")
if ok := cache.WaitForCacheSync(shutdown, fhrInformer.Informer().HasSynced); !ok {
mainLogger.Log("error", "failed to wait for caches to sync")
os.Exit(1)
}
mainLogger.Log("info", "informer caches synced")

// the status updater, to keep track of the release status for
// every HelmRelease
statusUpdater := status.New(ifClient, kubeClient, helmClient, *namespace)
go statusUpdater.Loop(shutdown, log.With(logger, "component", "status"))

// start git sync loop
chartSync.Run(shutdown, errc, shutdownWg)

// start HTTP server
go daemonhttp.ListenAndServe(*listenAddr, chartSync, log.With(logger, "component", "daemonhttp"), shutdown)
Expand Down

0 comments on commit 6735611

Please sign in to comment.