Uploaded image for project: 'Percona Operator for MongoDB'
  1. Percona Operator for MongoDB
  2. K8SPSMDB-797

Restore backup with S3 storage details in yaml in psmdb

Details

    • Bug
    • Status: Done
    • Medium
    • Resolution: Done
    • None
    • 1.14.0
    • None
    • None
    • Yes
    • Yes
    • Yes

    Description

      As per the documentation, when mentioning the restore.yaml without "bucket" option, it complains:

      $ cat ./percona-server-mongodb-operator-v1.12/deploy/backup/restore-custom.yaml | grep -v "^#"
      apiVersion: psmdb.percona.com/v1
      kind: PerconaServerMongoDBRestore
      metadata:
        name: restore1
      spec:
        clusterName: minimal-cluster
        backupSource:
          destination: s3://psmdbGuliMan/2022-10-13T07:46:59Z
          s3:
            credentialsSecret: my-cluster-name-backup-s3
            region: us-west-004
            endpointUrl: https://s3xxxx.com/
      $ k get psmdb-backup 
      NAME      CLUSTER           STORAGE      DESTINATION            STATUS   COMPLETED   AGE 
       deepu2    minimal-cluster   s3-us-west   2022-10-13T07:46:59Z   ready    6m20s       6m53s
      $ k apply -f ./percona-server-mongodb-operator-v1.12/deploy/backup/restore-custom.yaml
      error: error validating "/home/balaguru/kubernetes/percona-server-mongodb-operator-v1.12/deploy/backup/restore-custom.yaml": error validating data: ValidationError(PerconaServerMongoDBRestore.spec.backupSource.s3): missing required field "bucket" in com.percona.psmdb.v1.PerconaServerMongoDBRestore.spec.backupSource.s3; if you choose to ignore these errors, turn validation off with --validate=false

       

      when I add bucket option, it works.

      $ cat ./percona-server-mongodb-operator-v1.12/deploy/backup/restore-custom.yaml | grep -v "^#"
      apiVersion: psmdb.percona.com/v1
      kind: PerconaServerMongoDBRestore
      metadata:
        name: restore1
      spec:
        clusterName: minimal-cluster
        backupSource:
          destination: s3://psmdbGuliMan/2022-10-13T07:46:59Z
          s3:
            bucket: psmdbGuliMan
            credentialsSecret: my-cluster-name-backup-s3
            region: us-west-004
            endpointUrl: https://s3.xxxx.com/
      
      $ k apply -f ./percona-server-mongodb-operator-v1.12/deploy/backup/restore-custom.yaml | grep -v "^#"
      perconaservermongodbrestore.psmdb.percona.com/restore1 created
      

       

      $ k get psmdb-restore
      NAME       CLUSTER           STATUS   AGE
      restore1   minimal-cluster   ready    7m32s
      

       

       

       

      From doc:

      https://docs.percona.com/percona-operator-for-mongodb/backups.html#restoring-without-point-in-time-recovery

      _if you are restoring backup on the Kubernetes-based cluster different from one you have used to save this backup, set spec.backupSource subsection instead of spec.backupName field to point on the appropriate S3-compatible storage. This backupSource subsection should contain a destination key, followed by necessary storage configuration keys, same as in deploy/cr.yaml file:_
       
       

      ...backupSource:

      destination: s3://S3-BUCKET-NAME/BACKUP-NAME

      s3:

      credentialsSecret: my-cluster-name-backup-s3

      region: us-west-2

      endpointUrl: https://URL-OF-THE-S3-COMPATIBLE-STORAGE

      In the above case, need to fix the doc.

       

      whereas in the other case, missing bucket option provides below error when restoring to the other deployment:

        name: restore12oct-latest-11
        namespace: ram-xxx-restore
        resourceVersion: "797056847"
        uid: b20ac799-39a7-4a11-8820-xxx
      spec:
        backupSource:
          destination: s3://xxx-backup-s3/2022-10-12T13:34:54Z
          s3:
            credentialsSecret: xxx-backup-s3
            endpointUrl: https://storage.googleapis.com
            region: us-west-2
        clusterName: xxx-dev
      status:
        error: |
          set resync backup list from the store: init storage: get S3 object header: InvalidParameter: 1 validation error(s) found.
          - minimum field size of 1, HeadObjectInput.Bucket.
        state: error

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vinodh.krishnaswamy Vinodh Krishnaswamy
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Smart Checklist