Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for matching multiple resources for applying patches via kustomize #1576

Closed
elemental-lf opened this issue Nov 6, 2020 · 1 comment

Comments

@elemental-lf
Copy link

With #673 helmfile gained support for applying patches via kustomize. The helmfile directives jsonPatches and strategicMergePatches are translated to patchesJson6902 and strategicmergepatches in the generated kustomization.yaml by https://github.com/variantdev/chartify.

Unfortunately both of these directives don't support patching multiple Kubernetes resources at once. This is only supported by kustomize's patches directive (see https://kubernetes-sigs.github.io/kustomize/api-reference/kustomization/patches/) which in turn both supports strategic merge patches and a JSON patches. kustomize's patches directive accepts partial target specifications, target specification containing regular expressions and even label and annotation selectors.

My use case: I want to add some annotations to all resources of a Helm chart which doesn't support doing so via values.yaml.

Proposal: Add this kustomize feature via a new Helmfile directive patches which gets translated to the directive of the same name in the kustomization.yaml. The code should be identical to the one already present for the jsonPatches directive I think. See: https://github.com/variantdev/chartify/blob/d5b0a294ed25506d900c6fe7024a60a557f1c977/patch.go#L47-L109.

@elemental-lf
Copy link
Author

This should be addressed by #1592 because the patches section is implemented via the PatchTransformer plugin which should also be usable via the way implemented in #1592. And there are also the AnnotationTransformer and LabelTransformer for my specific use case. Thanks @mumoshu!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant