sodafoundation / contrib-lab01

This repo is for new contributors trial and learning. This is to support the SODA community members for their learning.
Apache License 2.0
19 stars 203 forks source link

Create Backup with specific deployment and all pods and then restore the backup #488

Open Devansh-Agrawal03 opened 1 year ago

Devansh-Agrawal03 commented 1 year ago

Issue/Feature Description: Test Case Precondition:

  1. Kahu project installed in given name-space (test-kahu)
  2. All below pods should be up and running: a. backup service b. Meta service with nfs provider c. nfs-server
  3. Metadata location is created already
  4. Namespace test-ns is created and contains some of the kubernetes resources 5.Namespace restore-ns is created Test Case steps:
  5. Create below backup CR using kubectl command (use kubectl create -f ) apiVersion: kahu.io/v1 kind: Backup metadata: name: backup-Kahu-0001 spec: includeNamespaces: [test-ns] metadataLocation: nfs includeResources:
    • name: kind: Pod isRegex: true
    • name: kind: Deployment isRegex: true
  6. Use kubectl describe backup -n test-kahu
  7. Get inside nfs server pod and check for the content inside mount path given (use command kubectl exec -ti -n test-kahu /bin/sh)
  8. Create a restore CR on new namespace (restore-ns) apiVersion: kahu.io/v1 kind: Restore metadata: name: restore-Kahu-0001 Spec: backupName: backup-Kahu-0001 namespaceMapping: test-ns : restore-ns Expected Result:
  9. In step 2, a) Verify that backup stage is Finished and State is Completed b) Verify the resource list in status shows all the required resources
  10. In step 3, verify that a) tar file is created with name of backup b) After untar file, All pods and the specific deployment mentioned are backuped.
  11. In step4, verify that a) Backed up specific deployment and pods are up in new namespace restore-ns Why this issue to fixed / feature is needed(give scenarios or use cases): This is a testcase which is to automated to make sure deployment is properly backed up and restored How to reproduce, in case of a bug: Other Notes / Environment Information: (Please give the env information, log link or any useful information for this issue)