kbst / mongodb

MongoDB Operator for Kubernetes

Home Page:https://www.kubestack.com/catalog/mongodb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improved module

ChrisTerBeke opened this issue · comments

Hi all,

We've been trying to adopt this module in our projects, but found a few issues so far that we couldn't get around. So instead we decided to write our own operator which can be found at https://github.com/Ultimaker/k8s-mongo-operator. For anyone using this module we'd like some feedback on our direction. Our current development branch is https://github.com/Ultimaker/k8s-mongo-operator/tree/k8s.

Compared to this module, we have made the following changes:

  • The event listening in Kubernetes always returns the same objects over and over again, so it's not a reliable source. This is fixed in k8s 1.10, but many people are running 1.8 or 1.9 and cannot upgrade for other reasons. Instead we're manually polling the objects list and doing a diff with the previously cached list. This seems more reliable. Only downside is the potential delay in creating/deleting objects depending on your polling interval. Something else positive this brings is that there are no longer 2 threads needed, as the garbage collection can be done in the same loop. This simplifies the whole code base a lot.
  • The code quality of this module seems someone under our own standards (lack of unit testing, lack of inline comments, using dicts instead of proper models). Our operator has more of all of these in hopes to improve the reliability of the operator.
  • Mongo exec response parsing in this operator is unreliable, we're using JSON parse with some regex replacements to get a result that we can always rely on.
  • We've added updating the stateful set (not available in this module), including scaling the MongoDB replica set with it.
  • We're working on adding backups via Google Cloud Storage as well, to get a more feature-rich operator that you can fully rely on to run your production Mongo tasks.
  • Added some test scripts for MiniKube and example YAML files.
  • Simpler k8s config setup (in-cluster).

Please don't see this as criticising this module, we're very happy with all the effort it took to build this, and we're using it as a great source of inspiration. Our goal is simply to create an even better operator. Only reason we haven't forked it is that it's basically a complete rewrite from the ground up.

Looking forward to interacting with this community on ways to improve running MongoDB in Kubernetes!