volsync icon indicating copy to clipboard operation
volsync copied to clipboard

CLI - pvbackup create, schedule, sync, restore and delete

Open vh05 opened this issue 2 years ago • 16 comments

Describe what this PR does The backup and restore is based on restic utility.

Create:

  1. Create the secret referring restic config file
  2. Create the replication source
  3. Save the details to relationship file

Schedule:

  1. Set schedule on the replication source for
  2. Scheduled backups

Sync:

  1. Trigger single manual backup by setting manual trigger

Restore

  1. Create the NS, pvc, secret if doesn't exist or use the same if exists
  2. Pause ReplicationSource
  3. Create ReplicationDestination and trigger the restore
  4. Unpause the ReplicationSource
  5. Save the details to relationship file

Delete:

  1. Delete the replicationSource/replicationDestination relationship
  2. Delete the secret
  3. Delete the relationship file

Related issues: #193

Signed-off-by: Vinayakswami Hariharmath [email protected]

vh05 avatar Apr 27 '22 17:04 vh05

/cc @JohnStrunk

vh05 avatar May 04 '22 15:05 vh05

/retest

vh05 avatar May 11 '22 14:05 vh05

/retest

vh05 avatar May 13 '22 10:05 vh05

/hold

vh05 avatar May 17 '22 07:05 vh05

/unhold

vh05 avatar Jun 23 '22 13:06 vh05

/cc @JohnStrunk

vh05 avatar Jun 23 '22 13:06 vh05

I'm having a bit of trouble untangling the usage a bit... There are 5 sub commands here: create, delete, restore, schedule, and sync. I assume that the intention is that a given pvbackup relationship would be either a backup or a restore, not both? (the pause code is what's confusing me). Assuming this to be true:

  • Backup flow would be: create -> (optional schedule / sync calls) -> delete
  • Restore flow: restore -> delete We should probably rename "create" to "backup".

I am thinking how to make command (pv-backup) and option (create ==> backup) look bit nice. If I rename create to backup then it will be kubectl volsync pv-backup backup ....

Any suggestion for the name of the command ? Even for restore, the command is pv-backup which is not complementing well.

vh05 avatar Jun 27 '22 11:06 vh05

/retest

vh05 avatar Jun 27 '22 15:06 vh05

I'm having a bit of trouble untangling the usage a bit... There are 5 sub commands here: create, delete, restore, schedule, and sync. I assume that the intention is that a given pvbackup relationship would be either a backup or a restore, not both? (the pause code is what's confusing me). Assuming this to be true:

  • Backup flow would be: create -> (optional schedule / sync calls) -> delete
  • Restore flow: restore -> delete We should probably rename "create" to "backup".

I am thinking how to make command (pv-backup) and option (create ==> backup) look bit nice. If I rename create to backup then it will be kubectl volsync pv-backup backup ....

Any suggestion for the name of the command ? Even for restore, the command is pv-backup which is not complementing well.

Maybe my suggestion wasn't so good... We could stick with the create/restore. Would changing the top-level command make it read any better? You do "create" a backup and then "restore" it later.

$ kubectl volsync backup create ...
$ kubectl volsync backup restore ...

The part I'm struggling with is that the other commands require you to "create" a relationship, and that's what we've used the create for. Whereas here, you don't need to issue a create before a restore (for a given relationship). I don't know what to suggest.

JohnStrunk avatar Jun 27 '22 21:06 JohnStrunk

/retest

JohnStrunk avatar Jun 27 '22 21:06 JohnStrunk

/retest

JohnStrunk avatar Jun 28 '22 15:06 JohnStrunk

Codecov Report

Merging #208 (ba3788f) into main (81fd412) will decrease coverage by 4.7%. The diff coverage is 6.4%.

:exclamation: Current head ba3788f differs from pull request most recent head 32a2a20. Consider uploading reports for the commit 32a2a20 to get more accurate results

@@           Coverage Diff           @@
##            main    #208     +/-   ##
=======================================
- Coverage   60.4%   55.7%   -4.8%     
=======================================
  Files         36      50     +14     
  Lines       4061    5911   +1850     
=======================================
+ Hits        2456    3294    +838     
- Misses      1471    2423    +952     
- Partials     134     194     +60     
Impacted Files Coverage Δ
kubectl-volsync/cmd/common_utils.go 0.0% <0.0%> (ø)
kubectl-volsync/cmd/replication_schedule.go 11.1% <0.0%> (ø)
kubectl-volsync/cmd/replication_sync.go 5.0% <0.0%> (+1.2%) :arrow_up:
kubectl-volsync/cmd/pvbackup_delete.go 4.1% <4.1%> (ø)
kubectl-volsync/cmd/pvbackup.go 5.7% <5.7%> (ø)
kubectl-volsync/cmd/pvbackup_create.go 6.2% <6.2%> (ø)
kubectl-volsync/cmd/pvbackup_restore.go 7.6% <7.6%> (ø)
kubectl-volsync/cmd/pvbackup_sync.go 8.6% <8.6%> (ø)
kubectl-volsync/cmd/pvbackup_schedule.go 11.7% <11.7%> (ø)
controllers/utils/affinity.go 86.6% <100.0%> (-2.3%) :arrow_down:
... and 16 more

codecov[bot] avatar Jun 28 '22 15:06 codecov[bot]

/retest

vh05 avatar Jul 19 '22 09:07 vh05

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: v-harihar Once this PR has been reviewed and has the lgtm label, please assign johnstrunk for approval by writing /assign @johnstrunk in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Jul 20 '22 11:07 openshift-ci[bot]

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
2.1% 2.1% Duplication

sonarcloud[bot] avatar Jul 21 '22 14:07 sonarcloud[bot]

@v-harihar: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-openshift 0cfaeff8fbe5287b769aba5bbb3923efe6674241 link false /test e2e-openshift

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

openshift-ci[bot] avatar Jul 21 '22 15:07 openshift-ci[bot]

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 20 '22 05:11 github-actions[bot]

This pull request has been automatically closed due to inactivity. Please re-open if these changes are still required.

github-actions[bot] avatar Dec 20 '22 05:12 github-actions[bot]

/unstale

vh05 avatar Dec 20 '22 05:12 vh05