open-cluster-management-io / policy-generator-plugin

A Kustomize generator plugin to generate Open Cluster Management policies
Apache License 2.0
29 stars 31 forks source link

[RFE] Allow kustomize --enable-helm equivalent functionality #105

Closed eformat closed 9 months ago

eformat commented 1 year ago

This may not be feasible due to the way YAML is parsed by the plugin, but it would be great if the plugin could work "as if" you had called:

kustomize build --enable-alpha-plugins --enable-helm ./

this would allow kustomization of a helm chart functionality with PolicyGenerator.

of course, some may also consider this undesireable as well - but i thought it was worth asking !

dhaiducek commented 1 year ago

Hi @eformat! Thanks for opening an issue! Would you please elaborate a bit more on this use-case? Are you requesting that, as part of providing a Kustomization manifest as an input, that plugins and Helm are enabled there as well?

eformat commented 1 year ago

hi @dhaiducek - yes exactly so - use Policy Generator -> kustomize manifests -> to call helm charts my example use case is using PolicyGenerator to bootstrap Team Based ArgoCD's

https://github.com/eformat/acm-gitops-helm

but because " --enable-helm" does not get passed on via PolicyGenrator .. i have two step the process for now. make sense ?

dhaiducek commented 1 year ago

@eformat I'll take this up with others on our team. I don't think we'd want it turned on by default, but I don't see why we couldn't raise a flag in the generator to pass to our Kustomize instance.

dhaiducek commented 1 year ago

I've just entered a PR for our team to review. It lacks tests (though it works locally)--does this look like it'd meet requirements for your use case?

eformat commented 1 year ago

@dhaiducek - yes it does. i just built your branch and tried it out on my repo. enabling this in the policy generator manifest:

    manifests:
      - path: helm-input/
        kustomizeOptions:
          enableAlphaPlugins: true
          enableHelm: true

worked like a charm ! and then enableHelm: false correctly gives the error

`: must specify --enable-helm
Error: failure in plugin configured via /tmp/kust-plugin-config-3212683469; exit status 1: exit status 1

thanks & great stuff 🎉

dhaiducek commented 9 months ago

@eformat You probably noticed, but we opted for an env, POLICY_GEN_ENABLE_HELM="true" to enable Helm globally rather than per-generator. Thanks for raising this, and apologies for the rather slow resolution!

eformat commented 9 months ago

thanks @dhaiducek ! yes , all good - i will be able to stop carrying the patch now for this ! thanks a lot i use it all the time :)