plugin-barman-cloud icon indicating copy to clipboard operation
plugin-barman-cloud copied to clipboard

[Feature] Support env expansion in `configuration.{destinationPath,endpointURL}`

Open 715d opened this issue 1 year ago • 1 comments

When pointing to a Bucket created by another system (like Ceph), the name/endpoint of the bucket is often stored in a ConfigMap rather than being known ahead of time. I'm able to use instanceSidecarConfiguration.env to pass the values through to the side car, but it doesn't seem to support expanding these values.

{"level":"info","ts":"2025-09-27T15:54:46.914931355Z","logger":"barman-cloud-wal-restore","msg":"2025-09-27 15:54:46,914 [51] ERROR: Barman cloud WAL restore exception: Invalid endpoint: https://$BUCKET_HOST","pipe":"stderr","logging_pod":"pg-foobar"}
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
  name: db-backup
spec:
  instanceSidecarConfiguration:
    env:
      - name: BUCKET_NAME
        valueFrom:
          configMapKeyRef:
            name: db-backup-data-bucket
            key: BUCKET_NAME
      - name: BUCKET_HOST
        valueFrom:
          configMapKeyRef:
            name: db-backup-data-bucket
            key: BUCKET_HOST
  retentionPolicy: "7d"
  configuration:
    destinationPath: s3://$BUCKET_NAME/
    endpointURL: https://$BUCKET_HOST
    s3Credentials:
      accessKeyId:
        name: db-backup-data-bucket
        key: AWS_ACCESS_KEY_ID
      secretAccessKey:
        name: db-backup-data-bucket
        key: AWS_SECRET_ACCESS_KEY
    wal:
      compression: gzip
    data:
      compression: gzip

715d avatar Sep 27 '25 16:09 715d

Hi @715d! I'm Dosu and I’m helping the plugin-barman-cloud team.

Environment variable expansion is not supported in the configuration.destinationPath or configuration.endpointURL fields—these are treated as static strings, so variables like $BUCKET_HOST are not substituted at runtime. Passing environment variables via instanceSidecarConfiguration.env only makes them available to the sidecar container, but does not enable their use in these configuration fields or CLI flags (source, docs).

A common workaround is to build a custom sidecar image with a wrapper script that expands environment variables and passes them as CLI arguments to the manager binary. This involves creating a Docker image based on the official sidecar, adding a shell script that performs the expansion, and setting that script as the entrypoint (example and steps).

Alternatively, you can use automation or templating tools (like Kustomize or Helm) to generate the ObjectStore manifest with the correct values before applying it to the cluster.

References:

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about plugin-barman-cloud Share Dosu with your team

dosubot[bot] avatar Sep 27 '25 16:09 dosubot[bot]