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

Detect unsupported helm functions in charts and show a warning #14944

Open
rowi1de opened this issue Aug 7, 2023 · 3 comments
Open

Detect unsupported helm functions in charts and show a warning #14944

rowi1de opened this issue Aug 7, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@rowi1de
Copy link
Contributor

rowi1de commented Aug 7, 2023

Summary

ArgoCD is using helm template which doesn’t support all features / functions inside templates. The idea (in comparisons to documentation only solution #14943), ArgoCD should detect the usage of unsupported functions in charts.

Motivation

Currently it’s hard to debug why a 3rd part chart might not work an expected. e.g. bitnami/charts#18130 which deloys a dependency chart which uses the random function for secret generation. As mentioned here https://argo-cd.readthedocs.io/en/stable/user-guide/helm/#random-data

Proposal

If possible use Helm to get the raw templates.
ArgoCD should maintain a list of unsupported functions. A warning could be shown if any of these is present. I would need to check what parsing capabilities are present, ideally it would be possible to generate a “mitigation”
e.g. ignoreDiffs.

Alternatively a list of 3rd part charts could be added, where known issues exists. This would require some community effort to add / maintain charts with known issues but overall would make the ArgoCD experience more smooth.

@crenshaw-dev
Copy link
Collaborator

crenshaw-dev commented Aug 7, 2023

I think a reactive approach will be much more reliable than proactive.

A proactive approach would probably require regex'ing every YAML file in a Helm repo with something like this:

{{[^}]*(lookup|random) [^}]*}}

The regex could yield false positives (for example, when a lookup is inside conditional logic) or false negatives (when the lookup is in a dependency chart, or because of a bug in the regex).

By contrast, detecting an error message from Helm saying "lookup function not found" and then augmenting that with "Argo CD does not support lookup functions (link-to-docs)" is much more reliable.

@rowi1de
Copy link
Contributor Author

rowi1de commented Aug 7, 2023

By contrast, detecting an error message from Helm saying "lookup function not found" and then augmenting that with "Argo CD does not support lookup functions (link-to-docs)" is much more reliable.

Good point 💯

Helm saying "lookup function not found"

is helm already doing this? Then the tricky part of this feature is already solved

this would just not work with function like random value generation which are supported, but misbehave with ArgoCD / GitOps https://argo-cd.readthedocs.io/en/stable/user-guide/helm/#random-data

@crenshaw-dev
Copy link
Collaborator

is helm already doing this?

I think it does product a meaningful/detectable error message today.

Yeah, random is a bit tricker, since the issue doesn't surface as an error message.

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

No branches or pull requests

2 participants