Setting custom annotations for PVC

Hi all,

I want to deploy percona mongodb operator with argocd (gitops approach). This means that argocd pulls the helm config from our git repository and applies it to the k8s cluster.

However, when certain kubernetes ressources are not in git but generated automatically like a PVC, I need to tell argocd to ignore those. Otherwise they might get pruned/deleted during sync process.

For this, I need to set an annotation on the PVC created by mongodb operator (like in this example from another operator: Kafka pvcs out of sync in Argo · Discussion #7205 · strimzi/strimzi-kafka-operator · GitHub)
However, looking on the custom resource options page (Custom Resource options - Percona Operator for MongoDB) I don’t see an option to set custom annotations on PVCs initated by percona mongo operator.
Is this true? Would it be possible to develop such feature if missing?

1 Like

Hello @aydink ,

this is a valid use case. For now it is not possible to set annotations to PVCs.

I have raised the following ticket to attack this: [K8SPSMDB-793] Add ability to set annotations and labels for PVCs - Percona JIRA
You can also track it in our public roadmap here: Percona Kubernetes Operators Roadmap · GitHub

1 Like

Hi @aydink,

Starting from 1.14.0 will be possible to add annotations and labels to PVCs using the following options e.g. for replsets:

  - name: rs0
        annotations: {}
        labels: {}

In this case, the operator will add them into PVCs but if a user needs to remove them. It should be done manually the operator can add but can’t remove annotations/labels from PVCs.

We have the plan to release 1.14.0 next month but you can test it using the main branch (please do not use this branch for production deployment).