| 26 | ) |
| 27 | |
| 28 | func (c *Controller) clusterResync(stopCh <-chan struct{}, wg *sync.WaitGroup) { |
| 29 | defer wg.Done() |
| 30 | ticker := time.NewTicker(c.opConfig.ResyncPeriod) |
| 31 | |
| 32 | for { |
| 33 | select { |
| 34 | case <-ticker.C: |
| 35 | if err := c.clusterListAndSync(); err != nil { |
| 36 | c.logger.Errorf("could not list clusters: %v", err) |
| 37 | } |
| 38 | case <-stopCh: |
| 39 | return |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // clusterListFunc obtains a list of all PostgreSQL clusters |
| 45 | func (c *Controller) listClusters(options metav1.ListOptions) (*acidv1.PostgresqlList, error) { |