Skip to content

inherited_annotations not passed to PVC #1754

@bchrobot

Description

@bchrobot

Please, answer some short questions which should help us to understand your problem / question better?

  • Which image of the operator are you using? registry.opensource.zalan.do/acid/postgres-operator:v1.7.0
  • Where do you run it - cloud or metal? Kubernetes or OpenShift? GKE
  • Are you running Postgres Operator in production? yes
  • Type of issue? Bug report

We are trying to use pvc-autoresizer and need to pass the following types of annotations to the data PVCs:

apiVersion: "acid.zalan.do/v1"
kind: postgresql
metadata:
  name: acid-mypostgres-cluster
  annotations:
    "resize.topolvm.io/storage_limit": "100Gi"
    "resize.topolvm.io/threshold": "20%"
    "resize.topolvm.io/increase": "10Gi"

However, the only annotation that gets set for data PVCs, regardless of inherited_annotations, is the storage class. See:

metadata := metav1.ObjectMeta{
Name: constants.DataVolumeName,
}
if volumeStorageClass != "" {
// TODO: remove the old annotation, switching completely to the StorageClassName field.
metadata.Annotations = map[string]string{"volume.beta.kubernetes.io/storage-class": volumeStorageClass}
storageClassName = &volumeStorageClass
} else {
metadata.Annotations = map[string]string{"volume.alpha.kubernetes.io/storage-class": "default"}
storageClassName = nil
}

It looks like annotationsSet() could be used to add the desired annotations to the volume claim template.

I'm happy to open a PR for this but hoped to get some guidance on which approach is preferred:

  1. Modify generatePersistentVolumeClaimTemplate() to take a Cluster receiver and remodel after generatePodTemplate(), or
  2. Modify/overwrite the annotations property of the returned volumeClaimTemplate, leaving generatePersistentVolumeClaimTemplate() untouched

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions