Skip to content

Roles update endlessly #2180

@alexfrunza

Description

@alexfrunza

Report

After adding a certain user with multiple roles, the operator updates the roles for it endlessly. And this log is showed every 5 seconds.

2026-01-09T11:06:04.153Z INFO User roles changed, updating them. {"controller": "psmdb-controller", "controllerGroup": "psmdb.percona.com", "controllerKind": "PerconaServerMongoDB", "PerconaServerMongoDB": {"name":"custom-mongo-name","namespace":"dev"}, "namespace": "dev", "name": "custom-mongo-name", "reconcileID": "9cb3a653-0301-4ec8-bc62-4e66f18cd597", "user": "admin.custom-user-name"}

More about the problem

I tried to see where the problem is and built the operator with some more logging, and I saw this line keeps failing, even if the roles are updated with the requested ones. I think the fault is that the reflect.DeepEqual expect the slice elements to be in some order, and they are not.

Steps to reproduce

Create a PSMDB resource with a user like the following:

  users:
    - name: customuser
      db: admin
      passwordSecretRef:
        name: my-secret
        key: PASSWORD
      roles:
        - name: readWrite
          db: my-custom-db2
        - name: readWrite
          db: my-custom-db3
        - name: readWrite
          db: my-db-custom-db3
        - name: readWrite
          db: my-db-custom-db1

Versions

  1. Kubernetes
  2. Operator: 1.21.1
  3. Database: 8.0.17-6

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions