planetscale/vitess-operator

When configured backup, backup parameters not added to vtcld pods

alebedinskiy opened this issue · 0 comments

When configured backup, backup parameters not added to vtcld pods
Product version
Vitess version 14.0.1
Operator version 2.7.2

Problem
backup arguments are not added by operator to vtcld pods
it causes that is not possible to do list of backups with vtctlclient

VitessCluster Configuration
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app: ope-vitess-backup
  name: ope-vitess-backup
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
#  storageClassName: sharedfs
---
apiVersion: planetscale.com/v2
kind: VitessCluster
metadata:
  name: ope-vitess-cluster
spec:
  backup:
    engine: xtrabackup
    locations:
      - volume:
          persistentVolumeClaim:
            claimName: ope-vitess-backup
  cells:
    - gateway:
        extraFlags:
          mysql_auth_server_impl: none
          mysql_server_version: 8.0.23-Vitess
        replicas: 2
        resources:
          limits:
            memory: 256Mi
          requests:
            cpu: 200m
            memory: 256Mi
      name: region1
  globalLockserver:
    etcd:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: planetscale.com/component
                      operator: In
                      values:
                        - vttablet
                topologyKey: kubernetes.io/hostname
              weight: 100
      dataVolumeClaimTemplate:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 2Gi
#        storageClassName: sharedfs
      resources:
        limits:
          cpu: 100m
          memory: 128Mi
        requests:
          cpu: 100m
          memory: 128Mi
  images:
    mysqld:
      mysql80Compatible: docker.io/vitess/lite:v14.0.1-mysql80
    mysqldExporter: docker.io/prom/mysqld-exporter:v0.11.0
    vtbackup: docker.io/vitess/lite:v14.0.1-mysql80
    vtctld: docker.io/vitess/lite:v14.0.1-mysql80
    vtgate: docker.io/vitess/lite:v14.0.1-mysql80
    vtorc: docker.io/vitess/lite:v14.0.1-mysql80
    vttablet: docker.io/vitess/lite:v14.0.1-mysql80
  keyspaces:
    - databaseName: ope
      durabilityPolicy: semi_sync
      name: ope
      partitionings:
        - equal:
            parts: 1
            shardTemplate:
              databaseInitScriptSecret:
                key: init_db.sql
                name: ope-vitess-cluster-config
              replication:
                enforceSemiSync: true
                recoverRestartedMaster: false
              tabletPools:
                - cell: region1
                  dataVolumeClaimTemplate:
                    accessModes:
                      - ReadWriteOnce
                    resources:
                      requests:
                        storage: 10Gi
#                    storageClassName: local-path
                  mysqld:
                    configOverrides: |
                      [mysqld]
                      lower_case_table_names = 1
                    resources:
                      limits:
                        cpu: 200m
                        memory: 1Gi
                      requests:
                        cpu: 200m
                        memory: 1Gi
                  replicas: 3
                  type: replica
                  vttablet:
                    extraFlags:
                      db_charset: utf8mb4
                      disable_active_reparents: "true"
                      queryserver-config-transaction-timeout: "300"
                    resources:
                      limits:
                        cpu: 200m
                        memory: 1Gi
                      requests:
                        cpu: 200m
                        memory: 1Gi
      vitessOrchestrator:
        affinity:
          podAntiAffinity:
            preferredDuringSchedulingIgnoredDuringExecution:
              - podAffinityTerm:
                  labelSelector:
                    matchExpressions:
                      - key: planetscale.com/component
                        operator: In
                        values:
                          - vttablet
                  topologyKey: kubernetes.io/hostname
                weight: 100
        configSecret:
          key: orc_config.json
          name: ope-vitess-cluster-config
        resources:
          limits:
            memory: 128Mi
          requests:
            cpu: 100m
            memory: 128Mi
  vitessDashboard:
    cells:
      - region1
    extraFlags:
      security_policy: read-only
    replicas: 2
    resources:
      limits:
        memory: 128Mi
      requests:
        cpu: 200m
        memory: 128Mi

Command

alias vc='kubectl exec -i -t $(kubectl get pod -l "planetscale.com/component=vtctld" -o jsonpath="{.items[0].metadata.name}") -- /vt/bin/vtctlclient --server $(kubectl get svc -l "planetscale.com/component=vtctld" -o jsonpath="{.items[0].metadata.name}"):15999'
vc ListBackups ope/-

Result

ListBackups Error: rpc error: code = Unknown desc = no registered implementation of BackupStorage
E0805 13:55:55.827184      67 main.go:103] remote error: rpc error: code = Unknown desc = no registered implementation of BackupStorage
command terminated with exit code 1

I was able to configure vtcld pods with missing backup parameters and with add extraVolume for correct work retrieve list of backups, I have added the same backup params that were added to vttablets pods

Parameters that I have added
backup_engine_implementation: xtrabackup
backup_storage_compress: "true"
backup_storage_implementation: file
file_backup_storage_root: /vt/backups/ope-vitess-cluster
xbstream_restore_flags: --parallel=3
xtrabackup_backup_flags: --parallel=1
xtrabackup_stream_mode: xbstream
xtrabackup_stripes: "8"
xtrabackup_user: vt_dba

But I think that backup parameters should be added to vtcld pods by vitess operator, and only one point of backup configuration should be in backup section
https://github.com/planetscale/vitess-operator/blob/main/docs/api.md#planetscale.com/v2.ClusterBackupSpec
Could you please fix this issue

Workaround with add parameters and exraVolume
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app: ope-vitess-backup
  name: ope-vitess-backup
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
#  storageClassName: sharedfs
---
apiVersion: planetscale.com/v2
kind: VitessCluster
metadata:
  name: ope-vitess-cluster
spec:
  backup:
    engine: xtrabackup
    locations:
      - volume:
          persistentVolumeClaim:
            claimName: ope-vitess-backup
  cells:
    - gateway:
        extraFlags:
          mysql_auth_server_impl: none
          mysql_server_version: 8.0.23-Vitess
        replicas: 2
        resources:
          limits:
            memory: 256Mi
          requests:
            cpu: 200m
            memory: 256Mi
      name: region1
  globalLockserver:
    etcd:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: planetscale.com/component
                      operator: In
                      values:
                        - vttablet
                topologyKey: kubernetes.io/hostname
              weight: 100
      dataVolumeClaimTemplate:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 2Gi
#        storageClassName: sharedfs
      resources:
        limits:
          cpu: 100m
          memory: 128Mi
        requests:
          cpu: 100m
          memory: 128Mi
  images:
    mysqld:
      mysql80Compatible: docker.io/vitess/lite:v14.0.1-mysql80
    mysqldExporter: docker.io/prom/mysqld-exporter:v0.11.0
    vtbackup: docker.io/vitess/lite:v14.0.1-mysql80
    vtctld: docker.io/vitess/lite:v14.0.1-mysql80
    vtgate: docker.io/vitess/lite:v14.0.1-mysql80
    vtorc: docker.io/vitess/lite:v14.0.1-mysql80
    vttablet: docker.io/vitess/lite:v14.0.1-mysql80
  keyspaces:
    - databaseName: ope
      durabilityPolicy: semi_sync
      name: ope
      partitionings:
        - equal:
            parts: 1
            shardTemplate:
              databaseInitScriptSecret:
                key: init_db.sql
                name: ope-vitess-cluster-config
              replication:
                enforceSemiSync: true
                recoverRestartedMaster: false
              tabletPools:
                - cell: region1
                  dataVolumeClaimTemplate:
                    accessModes:
                      - ReadWriteOnce
                    resources:
                      requests:
                        storage: 10Gi
#                    storageClassName: local-path
                  mysqld:
                    configOverrides: |
                      [mysqld]
                      lower_case_table_names = 1
                    resources:
                      limits:
                        cpu: 200m
                        memory: 1Gi
                      requests:
                        cpu: 200m
                        memory: 1Gi
                  replicas: 3
                  type: replica
                  vttablet:
                    extraFlags:
                      db_charset: utf8mb4
                      disable_active_reparents: "true"
                      queryserver-config-transaction-timeout: "300"
                    resources:
                      limits:
                        cpu: 200m
                        memory: 1Gi
                      requests:
                        cpu: 200m
                        memory: 1Gi
      vitessOrchestrator:
        affinity:
          podAntiAffinity:
            preferredDuringSchedulingIgnoredDuringExecution:
              - podAffinityTerm:
                  labelSelector:
                    matchExpressions:
                      - key: planetscale.com/component
                        operator: In
                        values:
                          - vttablet
                  topologyKey: kubernetes.io/hostname
                weight: 100
        configSecret:
          key: orc_config.json
          name: ope-vitess-cluster-config
        resources:
          limits:
            memory: 128Mi
          requests:
            cpu: 100m
            memory: 128Mi
  vitessDashboard:
    cells:
      - region1
    extraFlags:
      backup_engine_implementation: xtrabackup
      backup_storage_compress: "true"
      backup_storage_implementation: file
      file_backup_storage_root: /vt/backups/ope-vitess-cluster
      security_policy: read-only
      xbstream_restore_flags: --parallel=3
      xtrabackup_backup_flags: --parallel=1
      xtrabackup_stream_mode: xbstream
      xtrabackup_stripes: "8"
      xtrabackup_user: vt_dba
    extraVolumeMounts:
      - mountPath: /vt/backups
        name: vitess-backups
    extraVolumes:
      - name: vitess-backups
        persistentVolumeClaim:
          claimName: ope-vitess-backup
    replicas: 2
    resources:
      limits:
        memory: 128Mi
      requests:
        cpu: 200m
        memory: 128Mi