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

Subcharts using oci dependencies do not restore them during bundle publish #130

Open
1 task done
kayanme opened this issue Sep 23, 2024 · 1 comment
Open
1 task done

Comments

@kayanme
Copy link

kayanme commented Sep 23, 2024

Before proceeding

  • I didn't find a similar issue

Version

2.10.5

How to reproduce

  1. Create library chart with some template function there ("test-template-function").
  2. Push this chart to the OCI repo.
  3. Create a new chart ("parent").
  4. Create a subchart there ("child").
  5. Declare a dependency to the library chart from step 2 in this subchart.
  6. Include the library function in this subchart somehow ("{{ include "test-template-function") .}}") .
  7. Publish the parent chart via bundle publish.
  8. Use bundle render to view a chart content.

Instead of 7 and 8 you can just render chart or just converge it, the result will be the same (no function found).

Result

Error: error constructing chart tree: error rendering resources for chart "parent": template: parent/charts/child/templates/function-call.yaml:1:4: executing "parent/charts/child/templates/function-call.yaml" at <include "test-template-function" . >: error calling include: template: no template "test-template-function" associated with template "gotpl"

Expected result

The function from the subchart dependency should be seen.

Additional information

You can add the subchart dependency to the parent chart, then the function will be available to use in the subchart, but only in one.
Other subcharts with this dependency will not be rendered at all.

@ilya-lesikov
Copy link
Member

ilya-lesikov commented Sep 27, 2024

Сhart dependency resolution in Helm is very primitive. As far as I remember it only downloads direct dependencies of the root chart, but unable to resolve and download subchart dependencies. So you either vendor your whole charts tree in .helm/charts or define a complete list of charts needed to be downloaded in .helm/Chart.yaml.

You can add the subchart dependency to the parent chart, then the function will be available to use in the subchart, but only in one. Other subcharts with this dependency will not be rendered at all.

That's not how it should work. This is a bug or, most likely, misconfiguration. Helm templates (define/include templates in .tpl files) are globally scoped. Once a chart with such .tpl templates included once, all of these templates become available to all the other charts, be it parent or child or sibling charts. Make sure you do everything correctly and if the issue stays please provide a reproducible example.

@alexey-igrychev alexey-igrychev transferred this issue from werf/werf Oct 24, 2024
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

2 participants