Introduction Helm chart newman
Hey man! I am sure you know already newman from postman, a cool CLI/API to run HTTP queries defined in a JSON file:
It become famous for testing API, health check etc... also this allow to store in git HTTP queries (aka git-ops). You dont know it yet? Really check this out!
The story
At Qwant.com, the french search engine, I am using it to configure elasticsearch (via HTTP API):
- setup index templates
- setup ILM policies
This allow us to put all ES configuration stuff in a git repository (git-ops philosophy), and with a pinch of CI, change index template from a simple git push.
As we use kubernetes to deploy our stuff, I decided to write a Helm chart with it.
The idea is to run a k8s job, that take collection.json from a ConfigMap and execute it, pretty simple. In case of elasticsearch, I am (manually) waiting for ES ready before.
As a bonus, the Helm chart contains a NetworkPolicy template, to add egress rules to the job.
I use Helm hook to execute job after ConfigMap and NetworkPolicy have been installed, then job is deleted. At Qwant.com we deploy with ArgoCD, Helm hooks are fully compatible:
This output:
Chart is located at:
Elasticsearch use case
I give you raw collection.json file that create a “index livecycle policy” and “index template”:
Bonus: I use ansible / templating engine to build this file, so I can parametrize number of shards and replicas.