| 154 | } |
| 155 | |
| 156 | func (c *Controller) syncHandler(w workItem) error { |
| 157 | var err error |
| 158 | if w.task == backupTask { |
| 159 | err = snapshots.ReconcileBackupsForSnapshotGroup(w.snapshotGroup) |
| 160 | } else if w.task == restoreTask { |
| 161 | err = snapshots.RestoreSnapshotGroup(w.snapshotGroup, c.snapshotReadyTimeoutSeconds) |
| 162 | } else if w.task == deleteTask { |
| 163 | err = snapshots.OnSnapshotGroupDelete(w.snapshotGroup) |
| 164 | } |
| 165 | |
| 166 | if err != nil { |
| 167 | klog.Errorf("%s/%s: failed to perform %s - %v", w.namespace, w.name, taskLabels[w.task], err) |
| 168 | return err |
| 169 | } |
| 170 | |
| 171 | return nil |
| 172 | } |
| 173 | |
| 174 | // Run starts the controller |
| 175 | func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error { |