projectsyn / commodore

Commodore provides opinionated tenant-aware management of Kapitan inventories and templates. Commodore uses Kapitan for the heavy lifting of rendering templates and resolving a hierachical configuration structure.
https://syn.tools/commodore/
BSD 3-Clause "New" or "Revised" License
46 stars 8 forks source link

Use go-jsonnet in Commodore #1046

Closed simu closed 2 weeks ago

simu commented 4 weeks ago

We add go-jsonnet as a dependency, set use_go_jsonnet=True when calling kapitan.targets.render_targets() and replace our direct usages of jsonnet for rendering jsonnetfile.jsonnet for components and for postprocessing with go-jsonnet.

Additionally, we fix an oversight in the Jsonnet import callback used by the Commodore postprocessing where we should return a full path to the imported file but instead returned the filename only. With go-jsonnet this leads to an import loop for lib/kube.libjsonnet for the builtin helm_namespace filter. Interestingly, the same issue doesn't occur when using the same include in a Jsonnet postprocessing filter. Note that with C++ jsonnet we never had any issues with the previous import callback implementation. Additionally, note that Kapitan returns the full path in the import callback, cf. https://github.com/kapicorp/kapitan/blob/dfa5d33bd3e74db5fad84086c833402bc892da6f/kapitan/resources.py#L211-L257

Checklist

simu commented 4 weeks ago

Needs https://github.com/appuio/component-openshift4-monitoring/pull/217 which is released in https://github.com/appuio/component-openshift4-monitoring/releases/tag/v6.5.1