postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Support metadata on PVC claims

Open QuingKhaos opened this issue 3 years ago • 5 comments

Overview

Support adding labels and annotations to the PVC claims, so PGO reconciles the wanted annotations and labels on the PVCs created.

Use Case

Starting with ODF 4.10, we can reclaim space on Ceph RDB by annotating the PVCs with the reclaimspace.csiaddons.openshift.io/schedule annotation to create a ReclaimSpaceCronJob for the PVC.

Enabling this behavior on specific PVCs requires to add the annotation. Creating a ReclaimSpaceCronJob doesn't work in a GitOps workflow, as the PGO PVC names have a dynamic suffix (except the repo host).

Desired Behavior

Feels weird to have metadata on the same level of the spec.

spec:
  instances:
    - name: db
      dataVolumeClaimSpec:
        metadata:
          labels:
          annotations:
        storageClassName: ocs-storagecluster-ceph-rbd
      walVolumeClaimSpec:
        metadata:
          labels:
          annotations:
        storageClassName: ocs-storagecluster-ceph-rbd
  backups:
    pgbackrest:
      repos:
        - name: repo1
          volume:
            volumeClaimSpec:
              metadata:
                labels:
                annotations:
              storageClassName: ocs-storagecluster-ceph-rbd

Another design possibility would be to introduce new template keys (like stafeful sets), while keeping the old ones for BC. Feels more naturally to have metadata and spec side-by-side.

spec:
  instances:
    - name: db
      dataVolumeClaimTemplate:
        metadata:
          labels:
          annotations:
        spec:
          storageClassName: ocs-storagecluster-ceph-rbd
      walVolumeClaimTemplate:
        metadata:
          labels:
          annotations:
        spec:
          storageClassName: ocs-storagecluster-ceph-rbd
  backups:
    pgbackrest:
      repos:
        - name: repo1
          volume:
            volumeClaimTemplate:
              metadata:
                labels:
                annotations:
              spec:
                storageClassName: ocs-storagecluster-ceph-rbd

Environment

  • Platform: OpenShift
  • Platform Version: 4.10
  • PGO Operator Version: 5.2
  • Storage: ODF 4.10

QuingKhaos avatar Oct 11 '22 11:10 QuingKhaos

A story has been added to our dev backlog.

dsessler7 avatar Apr 19 '23 17:04 dsessler7

+1

waldner avatar Aug 29 '23 12:08 waldner

Having the metadata templates exposed, for the generated instance PVCs, would be also incredibly helpful for situations where you have a backup tool like Velero, and you want to exclude the DB volumes from backup but not the rest of the volumes within the namespace. (i.e. when you utilise bg-backrest as your backup utility for the DB and don't need/want the redundancy)

Right now there is no GitOps way to really do this, as the necessary exclude label can only be applied manually (or with a post hook).

ti8m-dah avatar Jul 30 '24 15:07 ti8m-dah