kapicorp / kapitan

Generic templated configuration management for Kubernetes, Terraform and other things
https://kapitan.dev
Apache License 2.0
1.8k stars 197 forks source link

Add more jinja2 filters (those from Ansible or even allow to add ones own custom filters) #214

Closed frittentheke closed 5 years ago

frittentheke commented 5 years ago

Feature Request

Currently Kapitan does support the core Jinja2 filters to which a handful of filters are added (https://github.com/deepmind/kapitan/blob/918e905a7ccf386226a697e8f2adcad0d1cec3ee/README.md#jinja2-custom-filters).

While the filters Kapitan delivers out of the box are all very helpful, sometimes more string modifications are required on the inventory items to use them efficiently in Jinaj2 templated files.

Expected behavior Either allow to add filters as source, just like i.e. Ansible does (filter_plugins dir) or simply add some of "their" already battle proven Jinja2 filters - https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/filter

Most of those, i.e. regex_replace, are so versatile they would greatly improve the templating capabilities of Kapitan.

adrianchifor commented 5 years ago

Thanks for raising this, wanted to add more jinja2 filters for a while, the ansible filters are a good starting point.

adrianchifor commented 5 years ago

@frittentheke if you want to experiment with the new jinja2 filters we've just made a release candidate https://pypi.org/project/kapitan/0.23.0rc1/