mongodb / mongodb-atlas-kubernetes

MongoDB Atlas Kubernetes Operator - Manage your MongoDB Atlas clusters from Kubernetes
http://www.mongodb.com/cloud/atlas
Apache License 2.0
146 stars 75 forks source link

AtlasTeam is created but modifications don't reconcile #827

Closed pabloromeo closed 1 year ago

pabloromeo commented 1 year ago

What did you do to encounter the bug? Create an AtlasTeam:

apiVersion: atlas.mongodb.com/v1
kind: AtlasTeam
metadata:
  name: team-name
spec:
  name: "Team name"
  usernames:
    - "one@example.com"
    - "two@example.com"

The team is created. However, if you add another user to the team:

apiVersion: atlas.mongodb.com/v1
kind: AtlasTeam
metadata:
  name: team-name
spec:
  name: "Team name"
  usernames:
    - "one@example.com"
    - "two@example.com"
    - "three@example.com"

Then reconciling fails. Describing AtlasTeam you get the following status:

Status:
  Conditions:
    Last Transition Time:  2023-01-05T13:52:03Z
    Message:               context canceled
    Reason:                TeamUsersNotReady
    Status:                False
    Type:                  Ready
  Id:                      63b33c930b3b9d3a0ce440d1
  Observed Generation:     3
Events:
  Type     Reason             Age        From          Message
  ----     ------             ----       ----          -------
  Normal   Ready              <invalid>  AtlasProject
  Warning  TeamUsersNotReady  <invalid>  AtlasProject  context canceled

And in the operator logs you see the following:

{"level":"WARN","time":"2023-01-05T13:52:03.379Z","msg":"failed to retrieve users to add to the team 63b33c930b3b9d3a0ce440d1","atlasteam":"xxx/xxx"}

What did you expect? The team should have a new member.

What happened instead? The team in Atlas wasn't modified.

Screenshots If applicable, add screenshots to help explain your problem.

Operator Information

Kubernetes Cluster Information

Additional context I initially tried with user three@example.com not being part of the users in the organization, to see if it would invite them as well. It didn't work. I tried again manually adding the user as an Organization Member, waiting for email to be verified, and then adding them to the team through the operator. Failed as well.

If possible, please include:

sunib commented 1 year ago

I appear to have to the same problem:

Also have the same log lines in my operator

{"level":"INFO","time":"2023-01-06T11:07:13.311Z","msg":"-> Starting AtlasTeam reconciliation","atlasteam":"***","spec":{"name":"***","usernames":[***]}}
{"level":"WARN","time":"2023-01-06T11:07:13.711Z","msg":"failed to retrieve users to add to the team ***","atlasteam":"***"}

I'm running on AKS and using the latest operator (1.5.1).

helderjs commented 1 year ago

@pabloromeo thank you for raising the issue. We were able to reproduce the problem and a fix will come in the next release. For now, you can use the workaround mentioned by @sunib, which is to recreate the Team containing the new users. Just for clarification: The user must be part of the organization already

pabloromeo commented 1 year ago

Awesome, thanks for the workaroud and the clarification about the users being in the org.