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

[Feature]Restore pod did not respect BackupPolicy's env and targetVolume #9023

Open
lancelot1989 opened this issue Mar 10, 2025 · 3 comments · May be fixed by #9026
Open

[Feature]Restore pod did not respect BackupPolicy's env and targetVolume #9023

lancelot1989 opened this issue Mar 10, 2025 · 3 comments · May be fixed by #9026
Assignees
Labels
kind/feature New feature
Milestone

Comments

@lancelot1989
Copy link
Contributor

  1. create a simple Cluster
  2. create a customized BackupPolicy with env and targetVolume
  3. create a Backup
  4. create a Restore

the BackupPolicy is likely below:

......
spec:
  backoffLimit: 2
  backupMethods:
  - actionSetName: hosted-secret
    env:
    - name: IMAGE_TAG
      value: "2.4"
    - name: FOO
      value: BAR
    name: hosted-secret
    snapshotVolumes: false
    targetVolumes:
      volumeMounts:
      - mountPath: /var/lib/mysql
        name: data
      - mountPath: /etc/hosted-secret
        name: hosted-secret
......

Backup pod is properly respect env and targetVolumes.

But Restore pod does not. Restore pod's yaml is likely below.

spec:
  containers:
  - command:
    - bash
    - -c
    - |
      set -x
      echo 'hello world'
    env:
    - name: DP_BACKUP_NAME
      value: myvipbackup-gfs-bcmzq
    - name: DP_TARGET_RELATIVE_PATH
    - name: DP_BACKUP_ROOT_PATH
      value: /default/mysql-cluster-d380d839-bda4-4cb1-89b4-cfe833cbe794/mysql
    - name: DP_BACKUP_BASE_PATH
      value: /default/mysql-cluster-d380d839-bda4-4cb1-89b4-cfe833cbe794/mysql/mybackup-bcmzq
    - name: DP_BACKUP_STOP_TIME
      value: "2025-03-07T12:33:20Z"
    - name: DATA_DIR
      value: /var/lib/mysql/data
    - name: MYSQL_DIR
      value: /var/lib/mysql
    - name: IMAGE_TAG
      value: "2.4"
    - name: DATASAFED_LOCAL_BACKEND_PATH
      value: /backupdata
    - name: DP_DATASAFED_BIN_PATH
      value: /bin/datasafed
    image: docker.io/apecloud/percona-xtrabackup:8.0
    imagePullPolicy: IfNotPresent
    name: restore
    resources:
      limits:
        cpu: "0"
        memory: "0"
      requests:
        cpu: "0"
        memory: "0"
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/lib/mysql
      name: dp-claim-tpl-data-vip-mysql-cluster-mysql-3
    - mountPath: /backupdata
      name: dp-backup-data
    - mountPath: /bin/datasafed
      name: dp-datasafed-bin
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-kxbdg
      readOnly: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  initContainers:
  - command:
    - /bin/sh
    - -c
    - /scripts/install-datasafed.sh /bin/datasafed
    image: apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/datasafed:0.2.0
......
@lancelot1989 lancelot1989 added the kind/bug Something isn't working label Mar 10, 2025
@shanshanying
Copy link
Contributor

@zjx20 PTAL.

@lancelot1989
Copy link
Contributor Author

In some scenarios, we will mount some hosted file or config which is relatively sensitive or not very cloud-native for extra encryption or customized behavior.

Something like:

  1. ssh-key
  2. device-fingerprint
  3. one-time-token-file generate by hosted-agent

@shanshanying shanshanying added this to the Release 1.1.0 milestone Mar 10, 2025
@shanshanying
Copy link
Contributor

In some scenarios, we will mount some hosted file or config which is relatively sensitive or not very cloud-native for extra encryption or customized behavior.

Something like:

  1. ssh-key
  2. device-fingerprint
  3. one-time-token-file generate by hosted-agent

Hi @lancelot1989 ,

Considering your use case, we recommend implementing it in the restore API.

@shanshanying shanshanying added kind/feature New feature and removed kind/bug Something isn't working labels Mar 10, 2025
@shanshanying shanshanying changed the title [BUG]Restore pod did not respect BackupPolicy's env and targetVolume [Feature]Restore pod did not respect BackupPolicy's env and targetVolume Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants