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
152 stars 78 forks source link

IP Allow List Rule reconciliation stuck in an infinite loop. #711

Closed Freyert closed 1 year ago

Freyert commented 2 years ago

What did you do to encounter the bug? Steps to reproduce the behavior:

What did you expect? A clear and concise description of what you expected to happen.

I would expect the operator to not re-request API Allow list rules if the rules currently exist (even in a Pending state).

What happened instead? A clear and concise description of what happened instead

The operator requests changes to the IP Access List, sees items in pending, goes into another reconcile loop, requests changes to the IP access list, forever.

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

https://github.com/mongodb/mongodb-atlas-kubernetes/blob/1f6ce4a1b71578a43154a709d2595ad29fb898e1/pkg/controller/atlasproject/ipaccess_list.go#L62-L83

Operator Information

Kubernetes Cluster Information

Additional context Add any other context about the problem here.

If possible, please include:

Freyert commented 2 years ago

The main issue is you need to do set difference twice:

A = desired set B = existing set

difference(A,B) = (what's in A, but not in B) = items to add difference(B,A) = (what's in B, but not in A) = items to remove

Then only enter the create/destroy paths depending on the elements in either call.

The following just runs every time. So we will always issue a new POST/PUT.

https://github.com/mongodb/mongodb-atlas-kubernetes/blob/1f6ce4a1b71578a43154a709d2595ad29fb898e1/pkg/controller/atlasproject/ipaccess_list.go#L148-L156

igor-karpukhin commented 2 years ago

Hi @Freyert. Thanks for raising an issue. Could you please provide your AtlasProject resource where your installation of atlas operator is stuck in an infinite loop?

igor-karpukhin commented 1 year ago

Closed due to no activity