Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restoring from a backup does not work due Permission denied: '/data/scriptlogs' #127

Open
camilamacedo86 opened this issue May 24, 2024 · 2 comments

Comments

@camilamacedo86
Copy link

camilamacedo86 commented May 24, 2024

See: https://docs.couchbase.com/operator/current/howto-backup.html#restoring-from-a-backup

By applying the resource it will not workout the issue faced is described following and it is the same scenario of to create the backup at the first place: #126 (comment)

Traceback (most recent call last):
  File "/usr/local/bin/backup.py", line 1288, in <module>
    Backup(context).run()
  File "/usr/local/bin/backup.py", line 395, in run
    self._setup_logging()
  File "/usr/local/bin/backup.py", line 1196, in _setup_logging
    os.makedirs(self.context.log_path, exist_ok=True)
  File "/usr/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/data/scriptlogs'

PS.: This issue seems to be impossible to workaround since the Operator will delete the Cronjob.

@camilamacedo86
Copy link
Author

We can try to workaround by creating the JOB

kubectl apply -f - <<EOF
apiVersion: batch/v1
kind: Job
metadata:
  annotations:
    operator.couchbase.com/version: 2.5.0
  name: couchbase-restore-test
  namespace: couchbase
  labels:
    app: couchbase
    couchbase_cluster: couchbase
    couchbase_restore: couchbase-restore
spec:
  backoffLimit: 2
  completionMode: NonIndexed
  completions: 1
  parallelism: 1
  suspend: false
  template:
    metadata:
      labels:
        app: couchbase
        couchbase_cluster: couchbase
        couchbase_restore: couchbase-restore
    spec:
      containers:
      - args:
        - --mode
        - restore
        - --v
        - "DEBUG"
        - --log-ret
        - "168.00"
        - couchbase
        - --repo
        - couchbase-2024-05-28T06_41_38 
        - --threads
        - "1"
        - --obj-endpoint
        - storage.googleapis.com
        - --obj-store
        - gs://my-couchbase
        image: docker.io/couchbase/operator-backup:1.3.8
        imagePullPolicy: IfNotPresent
        name: cbbackupmgr-restore
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /data
          name: couchbase-cluster-backup-volume
        - mountPath: /var/run/secrets/couchbase
          name: couchbase-admin
          readOnly: true
        workingDir: /
      dnsPolicy: ClusterFirst
      restartPolicy: Never
      schedulerName: default-scheduler
      securityContext:
        fsGroup: 1000
      serviceAccountName: couchbase-backup
      terminationGracePeriodSeconds: 30
      volumes:
      - name: couchbase-cluster-backup-volume
        persistentVolumeClaim:
          claimName: couchbase-backup
      - name: couchbase-admin
        secret:
          defaultMode: 420
          secretName: my-secret
EOF

However, that will fails because the Operator will say that the CR is not created

HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"couchbasebackuprestores.couchbase.com \"couchbase-restore\" not found","reason":"NotFound","details":{"name":"couchbase-restore","group":"couchbase.com","kind":"couchbasebackuprestores"},"code":404}

@camilamacedo86
Copy link
Author

I could workaround this issue by

  • checking the job created by the operator
  • getting the yaml from the job
  • creating a new job based on this result using the same operator labels and adding the arg
        - --default-recovery
        - "purge"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant