MCPcopy Index your code
hub / github.com/zalando/postgres-operator / Run

Method Run

pkg/controller/controller.go:439–466  ·  view source on GitHub ↗

Run starts background controller processes

(stopCh <-chan struct{}, wg *sync.WaitGroup)

Source from the content-addressed store, hash-verified

437
438// Run starts background controller processes
439func (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
468func (c *Controller) runPodInformer(stopCh <-chan struct{}, wg *sync.WaitGroup) {
469 defer wg.Done()

Callers 6

mainFunction · 0.95
runPodInformerMethod · 0.45
runPostgresqlInformerMethod · 0.45
kubeNodesInformerMethod · 0.45
addClusterMethod · 0.45

Calls 10

initControllerMethod · 0.95
runPodInformerMethod · 0.95
runPostgresqlInformerMethod · 0.95
clusterResyncMethod · 0.95
kubeNodesInformerMethod · 0.95
NewFunction · 0.92
Bool2IntFunction · 0.92

Tested by

no test coverage detected