apache / couchdb-helm

Apache CouchDB Helm Chart
https://couchdb.apache.org/
Apache License 2.0
49 stars 64 forks source link

Add helm post-install hook to automate placement tagging in CouchDB nodes #66

Closed fsalazarh closed 2 years ago

fsalazarh commented 2 years ago

What this PR does / why we need it:

In order to control shard distribution across CouchDB nodes is necessary tagging the nodes in the database _nodes with the "zone" attribute. https://docs.couchdb.org/en/stable/cluster/sharding.html#specifying-database-placement

This PR add a post-install hook that create a Job that automate the tagging of "zone" attribute, obtaining the info from node labels of kubernetes and the pods allocated on each node. For more information of the procedure itself, please refer to https://github.com/caligrafix/couchdb-autoscaler-placement-manager/blob/main/src/scripts.py

Which issue this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)

Special notes for your reviewer:

We consider that the better way to achieve this is through a configuration file, but currently this solution meets our needs so it's useful. We use this post-install hook in combination with Cluster Autoscaler and Vertical Pod Autoscaler, so this components are responsible for not schedule the pods in other zones after killing them for some reason (e.g. after VPA assigns new requests and limits values).

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.

kocolosk commented 2 years ago

LGTM, thanks!