cloudnative-pg / charts

CloudNativePG Helm Charts
Apache License 2.0
138 stars 62 forks source link

`object_store` recovery is not possible without `clusterName` set #243

Closed mrclrchtr closed 1 month ago

mrclrchtr commented 3 months ago

Version 0.0.6 of Cluster-Chart

The following full config is not possible without clusterName set:

backups:
  enabled: true
  data:
    encryption: "" # Contabo does not support encryption
  wal:
    encryption: "" # Contabo does not support encryption
  endpointURL: "https://eu2.contabostorage.com"
  s3:
    bucket: "cnpg-cluster"
    accessKey: "xxx"
    secretKey: "xxx"
    path: "/backups"
  scheduledBackups:
    - name: daily-backup
      schedule: "0 * * * * *" # Daily at midnight
      backupOwnerReference: self

mode: recovery
recovery:
  method: "object_store"
  endpointURL: "https://eu2.contabostorage.com"
  # clusterName: "cnpg-cluster"
  s3:
    bucket: "cnpg-cluster"
    accessKey: "xxx"
    secretKey: "xxx"
    path: "/recovery"

With cluster name, the recovery works perfectly.

I did not use a different cluster name for the backup. It's the same config, I want to recover from.

itay-grudev commented 3 months ago

Is your Helm release called the same?

mrclrchtr commented 3 months ago

I'm using kustomize:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

helmCharts:
  - name: cnpg-cluster
    repo: https://cloudnative-pg.github.io/charts
    releaseName: cnpg-cluster
    version: 0.0.7
    valuesFile: ../../../base/cnpg-cluster/values.yaml

So the it's the same I assume.

itay-grudev commented 1 month ago

I'm sorry for the late response, but to understand the issue I need to clarify a couple of things.

According to the documentation for serverName, the underlying parameter:

The server name on S3, the cluster name is used if this parameter is omitted

In turn the cluster name is based on the chart name and release name. Assuming that the release name was identical between the original standalone cluster and the consecutive recovery cluster it would have worked without needing to specify recovery.clusterName.

That being said I'll crate a PR that sets it to:

serverName: {{ default (include "cluster.fullname" .) .Values.recovery.clusterName }}

This should make sure it is consistent.