xlab-uiuc / acto

Push-Button End-to-End Testing of Kubernetes Operators and Controllers
Apache License 2.0
113 stars 42 forks source link

[percona-server-mongodb-operator] Ineffective field: spec.runUid, unable to change the UID for running mongodb #90

Closed tylergu closed 2 years ago

tylergu commented 2 years ago

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):

  1. Deploy PSMDB operator
  2. Change the runUid to 1003 by applying the cr1.yaml

    cr1.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 ```
  3. Observe that the users are still 1001

Environment

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 field spec.runUid is never accessed excepting setting the defaults.

tylergu commented 2 years ago

Issued: https://jira.percona.com/browse/K8SPSMDB-697

tylergu commented 2 years ago

Confirmed

tianyin commented 2 years ago

@tylergu Let's close all the confirmed ones (to make sure we have a small issue dashboard) and move the results to https://github.com/xlab-uiuc/acto/blob/main/bugs.md

tylergu commented 2 years ago

Fixed