InseeFrLab / onyxia

🔬 Data science environment for k8s
https://onyxia.sh
MIT License
432 stars 78 forks source link

Differentiate the repository URL from the index.yaml URL in the catalogs configuration #806

Closed nitreb closed 1 month ago

nitreb commented 2 months ago

Hi!

When configuring a catalog, there a location field to set the URL of the catalog. It's used for both getting the charts index file, and build the link to the repository in the catalog page header help section in the datalab.

The issue we have is that in our case, those links are not the same. We host our charts with the package registry of Gitlab, and to access the index.yaml file, we need to point to an API url. Thus, we configure the location field to https://gitlab.mercator-ocean.fr/api/v4/projects/1974/packages/helm/playground, that does not point to our repository directly...

Would it be possible to differentiate the two? With maybe a repositoryLocation and indexLocation fields?

fcomte commented 2 months ago

do you like having that on your platform ?

image

I think we should at least give an option to remove this help because it's not really usefull for 99,9% of users.

garronej commented 2 months ago

Hi @nitreb,

You should be able to resolve the issue on your end.

Ensure that both index.yaml and index.html files are present in your public directory:

https://github.com/InseeFrLab/helm-charts-interactive-services/tree/gh-pages

image

When an HTTP GET request is made to: https://inseefrlab.github.io/helm-charts-interactive-services
GitHub Pages will automatically redirect to index.html. I believe GitLab will exhibit similar behavior.

Helm explicitly queries the index.yaml.

In the index.html, to redirect users to the repository, use the following snippet:

https://github.com/InseeFrLab/helm-charts-interactive-services/blob/42d043e49bca7c5abdc689944a75e078f635b92b/index.html#L1-L5

Replace the URL with the URL of your repository.

@fcomte, I propose we remove the informational notice altogether as it occupies too much space and, without the link, it conveys no essential information. It might as well say, "Look! Very easy, very cool!".

How about removing the page header on the catalog page and replacing it with a command bar like this:

helm repo add ide https://inseefrlab.github.io/helm-charts-interactive-services

This could be updated dynamically when switching catalog tabs.
It would provide the relevant information, occupy less space, and both users and administrators can hide the command bar if needed. What are your thoughts?

nitreb commented 2 months ago

Thank you both for your response!

Unfortunately, we do not use Gitlab pages but the package registry functionality. This mean that we access the index.yaml file through the Gitlab API, and not the repository URL.

Maybe a quick fix would be to add an option to remove the section completely.

odysseu commented 2 months ago

Same behavior as @nitreb when using gitlab package registry

fcomte commented 2 months ago

I agree with @garronej proposal

nitreb commented 2 months ago

Maybe this section can be reworked and display the description of the catalog. The description can support the markdown format. It would give the possibility to be more descriptive of each catalog purpose, and also put whatever link we want!

garronej commented 2 months ago

@nitreb Good idea, let's do that!

garronej commented 2 months ago

It's done.
Now the catalog's description, which is a localized string is displayed in the header of the catalog page as markdown if defined.

image

I updated the documentation: https://docs.onyxia.sh/admin-doc/catalog-of-services

image image
nitreb commented 2 months ago

Nice! Thank you @garronej

garronej commented 2 months ago

the api changes relative to this needs to be merged first though...

odysseu commented 2 months ago

I am not sure the API evolution would be enough.

Hear me out :

image

When one uses gitlab, the "2." link sends to https://gitlab.<domain>/api/v4/projects/<project ID>/packages/helm/stable/ which is not understood by gitlab/the navigator because it is understandable for helm.

nitreb commented 2 months ago

@odysseu I did not see this one, well spotted. Also, this link does not open in a new tab, which can be inconvenient...

odysseu commented 2 months ago

Must change something somewhere here : https://github.com/InseeFrLab/onyxia/blob/web-v4.27.0/web/src/ui/i18n/resources/fr.tsx#L713-L722 and there : https://github.com/InseeFrLab/onyxia/blob/web-v4.27.0/web/src/ui/pages/launcher/LauncherMainCard.tsx#L258-L264

garronej commented 2 months ago

Ok I've updated the logic Onyxia now performs some best effort inference for providing better insight on what the sources links points to:

image

The logic is here:

https://github.com/InseeFrLab/onyxia/blob/6627e0ad4e2dae7e65fccb01cd0166769659ab6f/web/src/core/usecases/launcher/selectors/selectors.ts#L559-L627

So basically, if you want the three link linke in the screenshot for your [vscode-python-gpu] on GitLab you would put in your Chart.yaml:

 apiVersion: v2
 name: vscode-python-gpu
 description: The VSCOde IDE with Python, Julia, and a collection of standard data
   science packages, with GPU support.
 icon: https://minio.lab.sspcloud.fr/projet-onyxia/assets/servicesImg/vscode.png
 keywords:
 - VSCode
 - Python
 home: https://code.visualstudio.com/
 sources:
-- https://github.com/InseeFrLab/images-datascience
-- https://github.com/InseeFrLab/helm-charts-interactive-services
+- https://gitlab.mercator-ocean.fr/pub/edito-infra/helm-charts/playground/-/tree/main/vscode-python-gpu
+- https://github.com/InseeFrLab/images-datascience/tree/main/vscode
 type: application
 version: 1.11.19
 dependencies:
 - name: library-chart
   version: 1.5.17
   repository: https://inseefrlab.github.io/helm-charts-interactive-services

But you don't have to put all thoses liks. It's just that if they are present, Onyxia will do it's best to generate insightfull helper messages by inferring where the links likely points to.

fcomte commented 1 month ago

Can we close this issue? @garronej @nitreb

nitreb commented 1 month ago

Looks good to me, thanks!