helmfile / chartify

Convert K8s manifests/Kustomization into Helm Chart
Apache License 2.0
77 stars 29 forks source link

Fixes for chartifying with dependency charts and multiple jsonpatches #3

Closed ento closed 3 years ago

ento commented 4 years ago

Contains two fixes for...

Chartifying with dependencies

Because of what seems like an intended behavior of Helm, resources defined in a dependency chart get double-rendered unless the *.tgz files are removed from the charts/ directory as well as the template files that were extracted from the tarballs.

I0529 23:14:12.259257 625 patch.go:141] generating /run/user/1000/2245639347060509570/helmx.2.patched.yaml
TestIntegration: integration_test.go:75: Integration test failed: exit status 1

COMMAND: kustomize build /run/user/1000/2245639347060509570 --output /run/user/1000/2245639347060509570/helmx.2.patched.yaml

OUTPUT: 2020/05/29 23:14:12 got file 'configmap.yaml', but '/run/user/1000/2245639347060509570/helmx.1.rendered/helm-chart/charts/subchart/templates/configmap.yaml' must be a directory to be a root Error: accumulating resources: merging resources from 'helmx.1.rendered/helm-chart/charts/subchart/templates/configmap.yaml': may not add resource with an already registered id: ~G_v1_ConfigMap|~X|subchart

Applying multiple json patches

The PR makes it so that os.Mkdir is called only for the first json patch. There might be a more elegant way of handling this, but my go-lang knowledge is limited.

I0529 22:40:05.626866 29761 patch.go:37] patching files: [/run/user/1000/8086575219059440647/helmx.1. rendered/helm-chart/templates/configmaps.yaml]
TestIntegration: integration_test.go:72: Integration test failed: mkdir /run/user/1000/8086575219059440647/jsonpatches: file exists