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

Details of Helm charts with a slash in the chart-name cannot be displayed #5897

Closed
absoludity opened this issue Jan 20, 2023 · 0 comments · Fixed by #5970
Closed

Details of Helm charts with a slash in the chart-name cannot be displayed #5897

absoludity opened this issue Jan 20, 2023 · 0 comments · Fixed by #5970
Assignees
Labels
component/apprepository Issue related to kubeapps apprepository kind/bug An issue that reports a defect in an existing feature

Comments

@absoludity
Copy link
Contributor

Describe the bug

When using Harbor as a helm repository for charts in a Harbor project, Harbor provides two possible URLs for the Helm index.yaml repository index:

  • One endpoint which is for all charts on the harbor instance
  • A project specific endpoint

The project specific endpoint works fine in Kubeapps, but if a user uses the single endpoint for all charts on the harbor instance, then the chart names are listed in the index.yaml file in the format <project-name>/<chart-name>.

These get sync'd to the Helm backend's postgresql database with IDs in the form <repo-name>/<project-name>/<chart-name>, whereas when retrieving the charts, Kubeapps looks for <repo-name>/<project-name>%2F<chart-name> (that is, the chart-name, from Kubeapps' perspective, should not contain any slashes). This was a decision made when the OCI repository support was added, as chart names include slashes in that case also, which are encoded so the single slash divides the kubeapps repo and the full chart name.

We should update the chart-sync for helm charts to ensure chart names with slashes are also encoded.

In the mean-time, the person who experienced this issue, is using the project-specific URL instead.

To Reproduce
Steps to reproduce the behavior:

  1. Setup Harbor 2.7.0, create a project and add a helm chart
  2. Add the instance-wide repo url to kubeapps as a Helm repository
  3. View the catalog and click on the chart
  4. An error is shown that Kubeapps is "unable to retrieve the chart: sql: no rows in result set".

If you check the api-server logs, you can verify Kubeapps is correctly looking for, for example, harbor-test/kubeapps%2Fnginx (ie. only a single slash between the repo and chart name, the the complete chart name being encoded), whereas if you check the database table you'll find the chart ID in the DB is harbor-test/kubeapps/nginx.

Expected behavior

The normal chart details are displayed.

@absoludity absoludity added the kind/bug An issue that reports a defect in an existing feature label Jan 20, 2023
@ppbaena ppbaena added the component/apprepository Issue related to kubeapps apprepository label Jan 24, 2023
@ppbaena ppbaena added this to the Technical debt milestone Jan 24, 2023
@absoludity absoludity self-assigned this Feb 2, 2023
absoludity added a commit that referenced this issue Feb 8, 2023
Signed-off-by: Michael Nelson <minelson@vmware.com>
absoludity added a commit that referenced this issue Feb 8, 2023
Signed-off-by: Michael Nelson <minelson@vmware.com>

<!--
Before you open the request please review the following guidelines and
tips to help it be more easily integrated:

 - Describe the scope of your change - i.e. what the change does.
 - Describe any known limitations with your change.
- Please run any tests or examples that can exercise your modified code.

 Thank you for contributing!
 -->

### Description of the change

<!-- Describe the scope of your change - i.e. what the change does. -->

In #3863 a change was made to ensure that we unescape spaces in the
chart name before syncing data to the database, which unintentionally
stopped Kubeapps from being able to retrieve charts that include a slash
`/` in the chart name (as is the case when using a unified repository
with Harbor). It was [noted on the PR as a
possibility](#3863 (review)),
but at the time, we didn't have non-OCI helm chart names with slashes
that we were aware of, so we didn't follow it up.

### Benefits

<!-- What benefits will be realized by the code change? -->
A unified Harbor Helm repo can be used with Kubeapps.

### Possible drawbacks

<!-- Describe any known limitations with your change -->
Haven't checked if the chart will display with the escaped slash or not,
but still better to be able to display it rather than error.

### Applicable issues

<!-- Enter any applicable Issues here (You can reference an issue using
#) -->

- fixes #5897 

### Additional information

<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->

Signed-off-by: Michael Nelson <minelson@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/apprepository Issue related to kubeapps apprepository kind/bug An issue that reports a defect in an existing feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants