vmware-labs / distribution-tooling-for-helm

Helm Distribution plugin is is a set of utilities and Helm Plugin for making offline work with Helm Charts easier. It is meant to be used for creating reproducible and relocatable packages for Helm Charts that can be moved around registries without hassles. This is particularly useful for distributing Helm Charts into airgapped environments.
Apache License 2.0
65 stars 10 forks source link

Update dependency repository when relocating #67

Open PhilKershaw opened 2 months ago

PhilKershaw commented 2 months ago

Is your feature request related to a problem? Please describe.

When relocating a Helm Chart with one of more dependencies the repository for said dependencies is not updated to the new location in the parent Chart.yaml. Meaning when installing the newly relocated parent chart it still pulls the original dependencies that contain the original image references.

Describe the solution you'd like

When relocating/unwrapping to a new repository the dependency repository references in Chart.yaml are updated to the new location. Thus, referencing the relocated subcharts that have references to the relocated images.

Describe alternatives you've considered

Besides manual intervention, no other alternatives considered.

Additional context

No response

beltran-rubo commented 2 months ago

Hi @PhilKershaw

The references to the sub-charts into the Chart.yaml are used mainly for 'pacakging' a new Helm chart. The scenario that Helm dt took into account is to have all the dependant Helm charts inside the "charts/" folder inside the main one.

When installing the main chart, the the dependant charts installed comes from the local directory "charts/" that have been modified to use the proper registry.

Are you bundling the Helm charts with the 'helm pack' command before running the 'helm dt' tool?

PhilKershaw commented 2 months ago

Hi @beltran-rubo

Thanks for sharing the thinking behind the approach. I totally understand and in practice it mostly works out.

Would there be any value in enabling an option to relocate dependency Helm Charts separately and not expecting them to be bundled? This would reduce duplication on the target registry side and possibly other benefits that don’t occur to me right now.

To your question RE running helm pack before dt. As part of a relocation procedure I run helm dep build which pulls the archive files before running helm dt wrap which would pulls down the images. There is a slight issue with this flow in that I have to extract the archives before helm dt wrap will run. It’s not a big issue but could perhaps be a little cleaner.

beltran-rubo commented 2 months ago

helm dt relies on the immutability of the images & dependencies so it is able to redistribute and verify the copy was done properly. In that case it requires the subcharts are already part of the chart (and part of the Chart.lock file).

shortwavedave commented 2 weeks ago

It appears that this does not work if there are multiple layers of dependencies, e.g., chartA depends on chartB depends on chartC - chartC does not get relocated