Run starts background controller processes
(stopCh <-chan struct{}, wg *sync.WaitGroup)
| 437 | |
| 438 | // Run starts background controller processes |
| 439 | func (c *Controller) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) { |
| 440 | c.initController() |
| 441 | |
| 442 | // start workers reading from the events queue to prevent the initial sync from blocking on it. |
| 443 | for i := range c.clusterEventQueues { |
| 444 | wg.Add(1) |
| 445 | c.workerLogs[uint32(i)] = ringlog.New(c.opConfig.RingLogLines) |
| 446 | go c.processClusterEventsQueue(i, stopCh, wg) |
| 447 | } |
| 448 | |
| 449 | // populate clusters before starting nodeInformer that relies on it and run the initial sync |
| 450 | if err := c.acquireInitialListOfClusters(); err != nil { |
| 451 | panic("could not acquire initial list of clusters") |
| 452 | } |
| 453 | |
| 454 | wg.Add(5 + util.Bool2Int(c.opConfig.EnablePostgresTeamCRD)) |
| 455 | go c.runPodInformer(stopCh, wg) |
| 456 | go c.runPostgresqlInformer(stopCh, wg) |
| 457 | go c.clusterResync(stopCh, wg) |
| 458 | go c.apiserver.Run(stopCh, wg) |
| 459 | go c.kubeNodesInformer(stopCh, wg) |
| 460 | |
| 461 | if c.opConfig.EnablePostgresTeamCRD { |
| 462 | go c.runPostgresTeamInformer(stopCh, wg) |
| 463 | } |
| 464 | |
| 465 | c.logger.Info("started working in background") |
| 466 | } |
| 467 | |
| 468 | func (c *Controller) runPodInformer(stopCh <-chan struct{}, wg *sync.WaitGroup) { |
| 469 | defer wg.Done() |
no test coverage detected