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
sub-sub-charts of aliased sub-charts not evaluated correctly #9150
Comments
Hi @dastrobu, thank you for reporting this, I've been able to reproduce this issue! In fact, I've tried aliasing further and I still see only one grandchild being returned.
|
@dastrobu Thanks for providing an easy way to reproduce this situation. |
Took a look at the code. I think the issue is in Line 85 in 59d5b94
grandchild chart is loaded only once and the reference to the chart is shared between the two alias charts foo and bar , see Line 196 in a374fff
So the last loaded sub-chart overrides the parent of grandchild and only this one will be rendered in Line 358 in 3192408
There might be several ways to fix this. If I have a good idea how, I'll provide a PR. |
…ltiply aliased dependencies Dependencies keep a reference on their parent chart, which breaks if a chart reference is shared among multiple aliases. By copying the dependencies, parent information can be set correctly to render the templates as expected later on. Note that this change will make ChartFullPath return a different path. It will contain the alias names instead of the path to the chart files. It is not clear if this is expected behaviour. Closes helm#9150 Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
Fixing this seems to be harder than I expected. My first thought was to copy dependencies on resolving aliases, see https://github.com/dastrobu/helm/blob/72fb27a4b0d146d5a14cc24b3c8df18da993deec/pkg/chartutil/dependencies.go#L112 So I thought about keeping the chart data structures with the shared reference as is and don't rely on the Line 358 in 3192408
It is relatively easy to create an id which respects the aliases without relying on the ChartFullPath . The issue is, when returning a map with keys other than file names from Line 330 in 3192408
rendered map in Line 260 in 3192408
There are multiple places relying on file paths as keys, see helm/pkg/lint/rules/template.go Line 118 in dfb5a5e
Line 148 in ed5fba5
In general I guess it would make sense to separate ids for a template instance and file paths pointing to the template definition. Getting this right seems to be a bit more work than I expected. I could try to move on with this approach if this is the right direction. |
Closes helm#9150 Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
as it turns out there are a number of issue with aliases as subcharts: #2993, #3457, #3909, #4300, #4390, #7061, #7093, #7413, #7729. Not heaving read through all of them I assume some of them are related to the code analysis above. |
…ltiply aliased dependencies Dependencies keep a reference on their parent chart, which breaks if a chart reference is shared among multiple aliases. By copying the dependencies, parent information can be set correctly to render the templates as expected later on. Note that this change will make ChartFullPath return a different path for sub-subcharts. It will contain the alias names instead of the path to the chart files which makes it consistent with paths to templates on the subchart level. Closes helm#9150 Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
after digging through the code I think using the alias names for
While the child level paths are constructed from alias names On the long run it might be a good idea to have a clear separation between names and aliases in the code base, so that it is always clear what the path to a chart on the file system is, and what a path in the dependency tree ist. Mixing names and aliases by e.g. simply overriding the names of charts on processing dependencies does not seem to be a good idea from my point of view: helm/pkg/chartutil/dependencies.go Line 118 in 6a441a6
helm/pkg/chartutil/dependencies.go Line 152 in 6a441a6
|
@mattfarina any chance we get this on the 3.5.1 milestone? |
@sbose78 and @mattfarina there is an open PR (#9175) on this issue open for a few months. Anything I need to do, to get someone to review this PR? |
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs. |
remove "Stale". PR still waiting for review.... |
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs. |
remove "Stale". PR still waiting for review.... |
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs. |
remove "Stale". PR still waiting for review.... |
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs. |
Any chances this bug could get fixed with v3.10.0 ? its becoming headache with this issue. any one have workaround to avoid this ? |
Is there any plan to include it soon? |
…ltiply aliased dependencies Dependencies keep a reference on their parent chart, which breaks if a chart reference is shared among multiple aliases. By copying the dependencies, parent information can be set correctly to render the templates as expected later on. Note that this change will make ChartFullPath return a different path for sub-subcharts. It will contain the alias names instead of the path to the chart files which makes it consistent with paths to templates on the subchart level. Closes helm#9150 Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
would be great to see this in 3.11.0, as 3.10.3. was just released... |
Any chance this is ever getting merged or is there a workaround? |
Summary
Given a chart with a subchart
child
and a sub-sub-chartgrandchild
where the sub chart is referenced twice with an alias from the
Chart.yaml
:It is expected that the resources of the
grandchild
chart are rendered twice with different values specified for the two aliasesfoo
andbar
.SSCCE
To reproduce it fully, run:
which prints out:
What is missing, is the following:
From my understanding of sub-charts and aliases, this is a bug.
Output of
helm version
:version.BuildInfo{Version:"v3.4.1", GitCommit:"c4e74854886b2efe3321e185578e6db9be0a6e29", GitTreeState:"clean", GoVersion:"go1.14.11"}
The text was updated successfully, but these errors were encountered: