feat(parser): add flag to filter helm template files #516
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds Helm template files filtering needed for kubeshop/monokle-cli#24.
Changes
extractK8sResources()
method to filter Helm template files by default.Fixes
Remarks
Initially I used what Cloud does but recognizing Helm files based on
templates
string in file path or simple/values.*.(yaml|yml)/
regex seems error prone (in fact one test invalidation
package was already failing due to that). So I went with recognizing Helm template files based on template syntax present in file content -{{ ... }}
.Now, it's not 100% perfect because I can imagine one can have a template without any
{{ ... }}
(but then it will be the same as just vanilla K8s manifest, so not sure if makes any sense). It will not filter it out then but also parser will work fine not throwing errors.The 2nd thing (and this is similar for Cloud, AFAIU), even if we pass
extractHelmLikeFiles=true
, template files will still error during parsing and will be filtered out... If we want to use Helm templates files further, those should have dedicated handling as forKustomize files (suggest to extract to separate issue).Checklist