Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Do not create a StatefulSet for Arbiters when spec.arbiters is not defined or set to 0. #1641

Open
verdel opened this issue Dec 3, 2024 · 0 comments

Comments

@verdel
Copy link

verdel commented Dec 3, 2024

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

  1. A MongoDB operator is deployed in the Kubernetes cluster.
  2. A MongoDBCommunity manifest is created, where spec.arbiters is not specified, and spec.members is set to 1.
  3. Two StatefulSets are created in the cluster (one main StatefulSet with replicas = 1 and one for arbiters with replicas = 0).

What did you expect?

If the number of arbiters is not specified or equals 0, an additional StatefulSet should not be created.

  • Creating extra objects in the Kubernetes cluster consumes resources in etcd.
  • Monitoring systems react to this StatefulSet, as they are configured to report when there is a StatefulSet in the cluster with 0 active replicas.

What happened instead?

Even if we do not specify the need to use Arbiter nodes when creating a MongoDBCommunity, an unused StatefulSet is still created in the cluster, and this behavior cannot be adjusted through additional settings.

Operator Information

  • Operator Version (0.11.0)
  • MongoDB Image used (mongo:8.0.1)

Kubernetes Cluster Information

  • Google Cloud Platform
  • Version (v1.28.7-gke.1026000)
  • Image Registry location (quay)

Additional context
In the deployStatefulSet function, there is no way to control the creation of a StatefulSet for arbiters. I believe that the part of the code responsible for creating this type of StatefulSet should only execute if spec.arbiters > 0.

If possible, please include:

  • The operator logs
  • Below we assume that your replicaset database pods are named mongo-<>. For instance:
❯ k get pods
NAME      READY   STATUS    RESTARTS   AGE
mongodb-testing-0   2/2     Running   1 (4d12h ago)   18d                                                                                     

❯ k get mdbc
NAME    PHASE     VERSION
mongodb-testing   Running   8.0.1
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant