helmfile / chartify

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

Usage of kustomize transformers with "path" instead of "patch" #90

Open gllb opened 1 month ago

gllb commented 1 month ago

Hello,

I have a need for a transformer that patch a complex yaml configuration (nodeSelector) in multiple template of a chart. So I figure a kustomize transformer might solve this (https://kubectl.docs.kubernetes.io/references/kustomize/builtins/#_patchtransformer_) and more specifically I need to use the path instead of the patch because the former one only allow a string, which is not compatible with nodeSelector.

But its like chartify does not support this path usage in transformers because I get either : if using a relative path:

  Error: accumulation err='accumulating resources from 'transformers/transformer.0.yaml': missing Resource metadata': must build at directory: '/tmp/chartify3396108642/....../transformers/transformer.0.yaml': file is not directory]

or if using an absolute path:

  Error: plugin PatchTransformer.builtin.[noGrp]/not-important.[noNs] fails configuration: failed to get the patch file from path(/.../nodeSelector.yaml): security; file '/.../nodeSelector.yaml' is not in or below '/tmp/chartify336424650/.../']

So question here : Do I misuse the transformer object, or is there a better approach ? Does chartify lack the support for the path by not copying the file in the temporary dir ?

I'm happy if you guys have some better approach for this problem, as I found kustomize somehow complex to use.

yxxhero commented 1 week ago

@gllb PR is welcome.