Skip to content

Commit

Permalink
Implement kustomizeOptions
Browse files Browse the repository at this point in the history
Allows passing flags equivalent to `--enable-helm` via the
environment variable `POLICY_GEN_ENABLE_HELM`

ref: https://issues.redhat.com/browse/ACM-9060
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
  • Loading branch information
dhaiducek committed Dec 12, 2023
1 parent eb954dc commit e22a6df
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,14 @@ func setNamespaceSelector(

// processKustomizeDir runs a provided directory through Kustomize in order to generate the manifests within it.
func processKustomizeDir(path string) ([]map[string]interface{}, error) {
k := krusty.MakeKustomizer(krusty.MakeDefaultOptions())
kustomizeOpts := krusty.MakeDefaultOptions()

if os.Getenv("POLICY_GEN_ENABLE_HELM") == "true" {
kustomizeOpts.PluginConfig.HelmConfig.Enabled = true
kustomizeOpts.PluginConfig.HelmConfig.Command = "helm"
}

k := krusty.MakeKustomizer(kustomizeOpts)

resourceMap, err := k.Run(filesys.MakeFsOnDisk(), path)
if err != nil {
Expand Down

0 comments on commit e22a6df

Please sign in to comment.