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

feat(parser): add flag to filter helm template files #516

Merged
merged 2 commits into from
Sep 18, 2023

Conversation

f1ames
Copy link
Contributor

@f1ames f1ames commented Sep 18, 2023

This PR adds Helm template files filtering needed for kubeshop/monokle-cli#24.

Changes

  • Adjusted extractK8sResources() method to filter Helm template files by default.

Fixes

  • None.

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 in validation 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

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

@changeset-bot
Copy link

changeset-bot bot commented Sep 18, 2023

🦋 Changeset detected

Latest commit: 7357bdf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@monokle/parser Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@f1ames f1ames merged commit c3fbca1 into main Sep 18, 2023
2 checks passed
@f1ames f1ames deleted the f1ames/feat/parser-helm-files branch September 18, 2023 14:01
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

Successfully merging this pull request may close these issues.

2 participants