INNER CODE UNIT · Go
func
stashed/stash · pkg/backup/backupsession.go:87
func (c *BackupSessionController) RunBackup(targetInfo invoker.BackupTargetInfo, invokerRef *core.ObjectReference) error {
stopCh := make(chan struct{})
defer close(stopCh)
// for Deployment and DeploymentConfig run BackupSession watcher only in leader pod.
// for others workload i.e. DaemonSet and StatefulSet run BackupSession watcher in all pods.
switch targetInfo.Target.Ref.Kind {
case apis.KindDeployment, apis.KindDeploymentConfig:
if err := c.electLeaderPod(targetInfo, invokerRef, stopCh); err != nil {
return err
}
default:
if err := c.runBackupSessionController(invokerRef, stopCh); err != nil {
return err
}
}
klog.Info("Stopping Stash backup")
return nil