-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
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:
postgres-operator/pkg/cluster/k8sres.go
Lines 1534 to 1544 in def9e1d
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:
- Modify
generatePersistentVolumeClaimTemplate()
to take aCluster
receiver and remodel aftergeneratePodTemplate()
, or - Modify/overwrite the annotations property of the returned
volumeClaimTemplate
, leavinggeneratePersistentVolumeClaimTemplate()
untouched