Metadata empty when creating a PVC for sidecar in MongoDB

I am trying to create a PVC and mount to my sidecar using MongoDB cr version 1.19.0. When I look at the STS the metadata is empty. Below is an insert from the sts and the sidecar config. Im not sure why the metadata is not being recognized by the sts. Thank you for any insight.

  • apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    creationTimestamp: null
    spec:
    accessModes:
    • ReadWriteOnce
      resources:
      requests:
      storage: 1Gi
      volumeMode: Filesystem

###################

sidecars:
   - image: public.ecr.aws/docker/library/busybox
     command: ["/bin/sh"]
     args:
     - "-c"
     - |
       trap 'echo "got sigterm" ; exit 0' SIGTERM
       tail -n 20 -F /var/lib/mysql/audit.log &
       while true; do sleep 1; done
     name: audit-tail
     resources:
       requests:
         memory: 100M
         cpu: 100m
       limits:
         memory: 200M
         cpu: 200m
     volumeMounts:
     - mountPath: /data/db
       name: mongod-data
     - mountPath: /audit
       name: audit-mount
       #sidecarPVCs:

sidecarPVCs:
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: audit-mount
  spec:
    resources:
      requests:
        storage: 1Gi
    volumeMode: Filesystem
    accessModes:
      - ReadWriteOnce

###ERROR MESSAGE##########


Warning FailedCreate 22h (x20 over 22h) statefulset-controller create Claim -test20-psmdb-db-rs0-0 for Pod test20-psmdb-db-rs0-0 in StatefulSet test20-psmdb-db-rs0 failed error: PersistentVolumeClaim “-test20-psmdb-db-rs0-0” is invalid: metadata.name: Invalid value: “-test20-psmdb-db-rs0-0”: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, ‘-’ or ‘.’, and must start and end with an alphanumeric character (e.g. ‘example.com’, regex used for validation is ‘a-z0-9?(.a-z0-9?)*’)

I am having the same issue that was discussed in the forum back in 2023. Does anyone know if it was ever fixed ? Or do I still need to manually make the edit.

Henry, thank you for your report. I will recheck the issue and return to you.

1 Like

Henry, hi!
I rechecked and found the issue on our side. You can check the progress in the ticket Jira. The issue will be resolved in version 1.21.0 of the PSMDB Operator.

1 Like

Hi Natalia, Thanks for your reply. Is there a workaround I can use for now ? In the post from 2023 there is talk about editing the crd but I do not know where to place the fix in the file.

I believe it is possible to create the PVC manually, but I would like to verify it first. I will get back to you later with an update.

Henry, hi!
You can manually set up a PVC and connect it to your cluster. Here’s a reference from our CR.

sidecars:
- image: busybox
  command: ["/bin/sh"]
  args: ["-c", "while true; do echo echo $(date -u) 'test' >> /dev/null; sleep 5;done"]
  name: rs-sidecar-1
  volumeMounts:
    - mountPath: /volume1
      name: sidecar-volume-claim
sidecarVolumes:
- name: sidecar-volume-claim
  persistentVolumeClaim:
    claimName: sidecar-volume-claim

Feel free to reach out if you need any help getting it set up

1 Like