Skip to content

Commit

Permalink
Fix offline backup (#537)
Browse files Browse the repository at this point in the history
This PR fixes #535 
Fixed:
- [x] Fixed `ScaledownCronJob`  does not scale up workload to 1 replica properly.
- [x] Fixed wait until workload scaled down and pod force deletion for satefulset/daemonset.

Issue to fix:
- [x] backup count of repository crd get updated from second backup only,  when status sub-resource is enabled.
- [x] can not get snapshot.
Error:
```
kubectl get snapshots --all-namespaces
No resources found.
Error from server: no pod found for workload stash-demo
```

- [x] Update test
- [x] Update Snapshot doc to specify in which situation user will fail to list `Snapshot`
  • Loading branch information
Md. Emruz Hossain authored and tamalsaha committed Aug 9, 2018
1 parent 5049a63 commit bcf5926
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ func NewCmdBackup() *cobra.Command {
log.Fatal(err)
}

if replica > 1 || !util.HasOldReplicaAnnotation(kubeClient, opt.Namespace, opt.Workload) {
log.Infof("Skipping backup. Reason: Backup type offline and replica > 1")
if replica > 1 {
log.Infof("Skipping backup...\n" +
"Reason: Backup type offline and replica > 1\n" +
"Backup has taken by another replica or scheduled CronJob hasn't run yet.")
} else if !util.HasOldReplicaAnnotation(kubeClient, opt.Namespace, opt.Workload) {
log.Infof("Skipping backup...\n" +
"Reason: Backup type offline and workload does not have 'old-replica' annotation.\n" +
"Backup will be taken at next scheduled time.")
} else {
log.Infoln("Running backup once")
if err = ctrl.Backup(); err != nil {
Expand Down

0 comments on commit bcf5926

Please sign in to comment.