-
Notifications
You must be signed in to change notification settings - Fork 7k
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
fix(*): Helm v3 handling of APIVersion v1 charts dependencies #7009
fix(*): Helm v3 handling of APIVersion v1 charts dependencies #7009
Conversation
I haven't added tests to cover the APIVersion v1 behaviours; the changes were visible in the test runs as they broke the dependency tests which were testing APIVersion v2 behaviours with a generated APIVersion v1 chart. Instead I changed those tests to test the behaviour of APIVersion v2 charts, and they pass again. |
Is there any kind of process to go through to have a PR reviewed? This's been sitting idle for a couple of weeks now, and I'd love to know if there's more I need to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TBBle Thank you for pushing this PR. It is a good fix. I have added some comments for consideration.
One other change is that the requirements.lock
file should not be saved when packaging. The check could potentially be added before: https://github.com/helm/helm/blob/master/pkg/chartutil/save.go#L182
@TBBle Thanks for the details. Some additional feedback below.
I am unable to reproduce this. Can you give more details about it?
Added feedback in #7009 (comment) |
Why should |
With Helm v2.16.2: helm create testchart Add a requirements.yaml: dependencies:
- name: magic-ip-address
version: ">0"
repository: "@stable" With Helm v2.16.2: helm dependency update testchart With Helm v3.0.0 or v3.0.1 helm package testchart
helm lint testchart-0.1.0.tgz This will reproduce the failure:
|
I agree that it is included in Helm 2 but the |
Thanks for clarification of this in #7009 (comment). I missed the subtly of doing update first with Helm 2. |
Personally, I'd keep it around for API stability reasons, in case someone's scripts are using |
Fixes #6974. This ensures that when reading a Chart marked with APIVersion v1, we maintain the behaviour of Helm v2 and include the requirements.yaml and requirements.lock in the Files collection, and hence produce charts that work correctly with Helm v2. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
This keeps the on-disk format consistent after `helm dependency update` of an APIVersion1 Chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
This fixes `helm lint` against an APIVersion1 chart packaged with Helm v3. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
As the generated chart contains no requirements.yaml in its files list, but has dependencies in its metadata, it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
Specifically for the charts that have dependencies, the generated chart contains no requirements.yaml in its files but has dependencies in its metadata. Hence it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix @TBBle
picked into release-3.0 |
* Include requirements.* as Files in APIVersionV1 Fixes #6974. This ensures that when reading a Chart marked with APIVersion v1, we maintain the behaviour of Helm v2 and include the requirements.yaml and requirements.lock in the Files collection, and hence produce charts that work correctly with Helm v2. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Write out requirements.lock for APIVersion1 Charts This keeps the on-disk format consistent after `helm dependency update` of an APIVersion1 Chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Exclude 'dependencies' from APVersion1 Chart.yaml This fixes `helm lint` against an APIVersion1 chart packaged with Helm v3. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Generate APIVersion v2 charts for dependency tests As the generated chart contains no requirements.yaml in its files list, but has dependencies in its metadata, it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Generate APIVersion v2 charts for manager tests Specifically for the charts that have dependencies, the generated chart contains no requirements.yaml in its files but has dependencies in its metadata. Hence it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
@TBBle @hickeyma generating |
As noted in roboll/helmfile#1052, the change back to requirements.yaml for Helm APIVersion 1 charts was reverting an incorrect API breakage, and has now been fixed in helmfile, which was incorrectly generating APIVersion 1 (by default) charts with the APIVersion 2 |
) * Include requirements.* as Files in APIVersionV1 Fixes helm#6974. This ensures that when reading a Chart marked with APIVersion v1, we maintain the behaviour of Helm v2 and include the requirements.yaml and requirements.lock in the Files collection, and hence produce charts that work correctly with Helm v2. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Write out requirements.lock for APIVersion1 Charts This keeps the on-disk format consistent after `helm dependency update` of an APIVersion1 Chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Exclude 'dependencies' from APVersion1 Chart.yaml This fixes `helm lint` against an APIVersion1 chart packaged with Helm v3. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Generate APIVersion v2 charts for dependency tests As the generated chart contains no requirements.yaml in its files list, but has dependencies in its metadata, it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Generate APIVersion v2 charts for manager tests Specifically for the charts that have dependencies, the generated chart contains no requirements.yaml in its files but has dependencies in its metadata. Hence it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
) * Include requirements.* as Files in APIVersionV1 Fixes helm#6974. This ensures that when reading a Chart marked with APIVersion v1, we maintain the behaviour of Helm v2 and include the requirements.yaml and requirements.lock in the Files collection, and hence produce charts that work correctly with Helm v2. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Write out requirements.lock for APIVersion1 Charts This keeps the on-disk format consistent after `helm dependency update` of an APIVersion1 Chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Exclude 'dependencies' from APVersion1 Chart.yaml This fixes `helm lint` against an APIVersion1 chart packaged with Helm v3. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Generate APIVersion v2 charts for dependency tests As the generated chart contains no requirements.yaml in its files list, but has dependencies in its metadata, it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Generate APIVersion v2 charts for manager tests Specifically for the charts that have dependencies, the generated chart contains no requirements.yaml in its files but has dependencies in its metadata. Hence it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
) * Include requirements.* as Files in APIVersionV1 Fixes helm#6974. This ensures that when reading a Chart marked with APIVersion v1, we maintain the behaviour of Helm v2 and include the requirements.yaml and requirements.lock in the Files collection, and hence produce charts that work correctly with Helm v2. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Write out requirements.lock for APIVersion1 Charts This keeps the on-disk format consistent after `helm dependency update` of an APIVersion1 Chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Exclude 'dependencies' from APVersion1 Chart.yaml This fixes `helm lint` against an APIVersion1 chart packaged with Helm v3. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Generate APIVersion v2 charts for dependency tests As the generated chart contains no requirements.yaml in its files list, but has dependencies in its metadata, it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net> * Generate APIVersion v2 charts for manager tests Specifically for the charts that have dependencies, the generated chart contains no requirements.yaml in its files but has dependencies in its metadata. Hence it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson <p_hampson@wargaming.net>
This fixes unexpected changes in APIVersion1 (Helm v2) Charts when they are operated on by Helm v3 using
package
ordependency update
.The fixes:
requirements.yaml
was being unconditionally merged intoChart.yaml
, which produced packages which failedhelm lint
.requirements.lock
was being converted intoChart.lock
byhelm dep up
on an APIVersion1 chart.requirements.lock
andrequirements.yaml
in APIVersion1 charts for backwards compatibility, was incorrectly excluding those files fromhelm package
and theFiles
collection in templates. As well asFiles
behaviour changing, this also broke sub-chart aliases for Helm v2 as those are stored inrequirements.yaml
.Helm v3 incorrectly reads aliases from
Chart.yaml
'sdependencies
map in APIVersion1 charts, but I didn't change that, ashelm lint
warns you that this is an unexpected combination already, and it's as well asrequirements.yaml
so doesn't break anything.The changes in the third commit (ae74c91) are possibly not go-idiomatic, and I specifically welcome feedback or suggested improvements.
Fixes: #6974