SidecarPVCs Metadata Pruning Issue in Percona MongoDB Operator Deployment

I’m trying to deploy MongoDB with the Percona MongoDB Operator and am facing an issue when defining a PVC for use with the sidecar.

I defined the sidecarPVCs in the PerconaServerMongoDB CRD using HELM, in the replicaSets section.

...
replicaSets:
  - name: rs0
    ...
    sidecarPVCs:
      - apiVersion: v1
        kind: PersistentVolumeClaim
        metadata:
          name: filebeat-data
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi
          storageClassName: gp3
          volumeMode: Filesystem
    ...

After creating the StatefulSet, I noticed the Pod wasn’t launching. I discovered an error indicating an incorrect PVC name, and found that the metadata.name field in the Volume Claims section of the StatefulSet is empty.

> kubectl describe sts/mongodb-test-rs0
...
Volume Claims:
  Name:          mongod-data
  StorageClass:  gp3
  Labels:        <none>
  Annotations:   <none>
  Capacity:      8Gi
  Access Modes:  [ReadWriteOnce]
  Name:                                                <--- EMPTY NAME
  StorageClass:  gp3
  Labels:        <none>
  Annotations:   <none>
  Capacity:      1Gi
  Access Modes:  [ReadWriteOnce]

> kubectl describe PerconaServerMongoDB/mongodb-test
...
    Name:  rs0
    Sidecar PV Cs:
      API Version:  v1
      Kind:         PersistentVolumeClaim
      Metadata:                                         <---- EMPTY METADATA
      Spec:
        Access Modes:
          ReadWriteOnce
        Resources:
          Requests:
            Storage:         1Gi
        Storage Class Name:  gp3
        Volume Mode:         Filesystem

I think this issue is related to the sidecarPVCs.metadata definition in the CRD.

It appears the metadata type is defined as an object and the x-kubernetes-preserve-unknown-fields: true option isn’t set, potentially leading to field pruning.

Can you please help verify this issue? Thank you.

I very much confirm your finding, @bitofsky.
I manually edited the CRD, adding x-kubernetes-preserve-unknown-fields: true as you suggested, and I saw the PVC being correctly reported in the PerconaServerMongoDB custom resource.
I think you should report a bug on https://jira.percona.com/projects/K8SPSMDB/issues.
I am wondering if this sidecar PVC functionality is included in the operator test suite, otherwise it would have been discovered earlier.