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

fix: Support published Helm charts with different name format #695

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

jimmidyson
Copy link
Contributor

Currently mindthegap create helm-bundle fails if the chart published in
the helm repo has a different name to the expected format
<chartName>-<chartVersion>.tgz. An example that hit this issue is the NFD
chart that is published with the name
<chartName>-chart-<chartVersion>.tgz.

This commit fixes the issue by first finding the download URL from the
Helm repo index and then using the existing GetChartFromURL function
to download the chart. This already correctly uses the basename of the
published chart file and hence doesn't hit the above issue.

Tested to be working:

$ cat repos.yaml
repositories:
  nfd:
    repoURL: https://kubernetes-sigs.github.io/node-feature-discovery/charts/
    charts:
      node-feature-discovery:
      - 0.15.2

$ ./dist/mindthegap_darwin_arm64/mindthegap create helm-bundle --helm-charts-file=repos.yaml --overwrite
 ✓ Parsing Helm chart bundle config
 ✓ Creating temporary OCI registry directory
 ✓ Starting temporary OCI registry
 ✓ Creating temporary chart storage directory
 ✓ Fetching Helm chart node-feature-discovery (versions [0.15.2]) from nfd
(https://kubernetes-sigs.github.io/node-feature-discovery/charts/)
 ✓ Archiving Helm charts to helm-charts.tar

$ ./dist/mindthegap_darwin_arm64/mindthegap serve bundle --bundle helm-charts.tar &
 ✓ Creating temporary directory
 ✓ Unarchiving image bundle "helm-charts.tar"
 ✓ Parsing Helm charts bundle config
 ✓ Creating Docker registry
Listening on 127.0.0.1:58639

$ crane ls 127.0.0.1:58783/charts/node-feature-discovery
0.15.2

@jimmidyson jimmidyson requested review from faiq and supershal April 24, 2024 08:59
@github-actions github-actions bot added the fix label Apr 24, 2024
Copy link
Contributor

github-actions bot commented Apr 24, 2024

Unit test results

100 tests   100 ✅  0s ⏱️
 24 suites    0 💤
  1 files      0 ❌

Results for commit 810aa99.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Apr 24, 2024

e2e test results

33 tests   30 ✅  1m 52s ⏱️
 2 suites   3 💤
 1 files     0 ❌

Results for commit 810aa99.

♻️ This comment has been updated with latest results.

Currently `minthegap create helm-bundle` fails if the chart published in
the helm repo has a different name to the expected format
`<chartName>-<chartVersion>.tgz`. An example that hit this issue is the NFD
chart that is published with the name
`<chartName>-chart-<chartVersion>.tgz`.

This commit fixes the issue by first finding the download URL from the
Helm repo index and then using the existing `GetChartFromURL` function
to download the chart. This already correctly uses the basename of the
published chart file and hence doesn't hit the above issue.

Tested to be working:

```bash
$ cat repos.yaml
repositories:
  nfd:
    repoURL: https://kubernetes-sigs.github.io/node-feature-discovery/charts/
    charts:
      node-feature-discovery:
      - 0.15.2

$ ./dist/mindthegap_darwin_arm64/mindthegap create helm-bundle --helm-charts-file=repos.yaml --overwrite
 ✓ Parsing Helm chart bundle config
 ✓ Creating temporary OCI registry directory
 ✓ Starting temporary OCI registry
 ✓ Creating temporary chart storage directory
 ✓ Fetching Helm chart node-feature-discovery (versions [0.15.2]) from nfd
(https://kubernetes-sigs.github.io/node-feature-discovery/charts/)
 ✓ Archiving Helm charts to helm-charts.tar

$ ./dist/mindthegap_darwin_arm64/mindthegap serve bundle --bundle helm-charts.tar &
 ✓ Creating temporary directory
 ✓ Unarchiving image bundle "helm-charts.tar"
 ✓ Parsing Helm charts bundle config
 ✓ Creating Docker registry
Listening on 127.0.0.1:58639

$ crane ls 127.0.0.1:58783/charts/node-feature-discovery
0.15.2
```
@jimmidyson jimmidyson force-pushed the jimmi/fix-download-from-different-chart-name branch from c804391 to 810aa99 Compare April 24, 2024 09:57
@jimmidyson jimmidyson enabled auto-merge (squash) April 24, 2024 09:59
@jimmidyson jimmidyson merged commit 1313f8c into main Apr 24, 2024
11 checks passed
@jimmidyson jimmidyson deleted the jimmi/fix-download-from-different-chart-name branch April 24, 2024 15:40
Copy link

@supershal supershal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for easy fix.

faiq pushed a commit that referenced this pull request Apr 24, 2024
🤖 I have created a release *beep* *boop*
---


## 1.13.4 (2024-04-24)

<!-- Release notes generated using configuration in .github/release.yaml
at main -->

## What's Changed
### Fixes 🔧
* fix: Support published Helm charts with different name format by
@jimmidyson in #695


**Full Changelog**:
v1.13.3...v1.13.4

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: mesosphere-actions-pr-bot[bot] <157582460+mesosphere-actions-pr-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants