What happened?
We found the field spec.runUid is not effective. Changing the field does not update the UID that's used for running MongoDB.
Did you expect to see something different?
We expected that by setting the field spec.runUid to another uid, PSMDB operator would use that UID to run MongoDB. But through checking the code, we found that the field spec.runUid never actually gets used, and the Uid is hardcoded as 1001.
How to reproduce it (as minimally and precisely as possible):
Deploy PSMDB operator
Change the runUid to 1003 by applying the cr1.yaml
What happened? We found the field spec.runUid is not effective. Changing the field does not update the UID that's used for running MongoDB.
Did you expect to see something different? We expected that by setting the field
spec.runUid
to another uid, PSMDB operator would use that UID to run MongoDB. But through checking the code, we found that the fieldspec.runUid
never actually gets used, and the Uid is hardcoded as 1001.How to reproduce it (as minimally and precisely as possible):
Change the runUid to
1003
by applying the cr1.yamlcr1.yaml
```yaml apiVersion: psmdb.percona.com/v1-12-0 kind: PerconaServerMongoDB metadata: name: minimal-cluster spec: runUid: 1003 crVersion: 1.12.0 image: percona/percona-server-mongodb:5.0.7-6 allowUnsafeConfigurations: true upgradeOptions: apply: 5.0-never schedule: "0 2 * * *" secrets: users: minimal-cluster replsets: - name: rs0 size: 1 volumeSpec: persistentVolumeClaim: resources: requests: storage: 3Gi sharding: enabled: true configsvrReplSet: size: 1 volumeSpec: persistentVolumeClaim: resources: requests: storage: 3Gi mongos: size: 1 ```1001
Environment
Kubernetes version information:
Kubernetes cluster kind: Kind cluster
Anything else we need to know?: The root cause is inside the https://github.com/percona/percona-server-mongodb-operator/blob/5bf62ab58b58c7949c8aa7750d730a112ec69ecf/pkg/apis/psmdb/v1/psmdb_defaults.go#L580 where the fsgroup is hardcoded as
1001
. And the fieldspec.runUid
is never accessed excepting setting the defaults.