Migrate Helm Charts from Chartmuseum to OCI

Wissensdatenbanken

Migrate Helm Charts from Chartmuseum to OCI


Icons/System/eye-open Created with Sketch. 345 Ansichten 18.10.2024 Cloud / Managed Private Registry

Objective

The OVHcloud Managed Private Registry service provides you a managed, authenticated Docker registry where you can privately store your Docker images and Helm charts.

Managed Private Registry is built on top of Open Source solution Harbor, to guarantee its interoperability.

Harbor supports two different ways to store the Helm charts data:

  1. Harbor registry storage directly via OCI API.
  2. Harbor hosted Chartmuseum backend via Chartmuseum's API.

From Harbor version 2.6, Chartmuseum is deprecated and is removed from Harbor version 2.8.

How to know if I have Helm charts stored inside Chartmuseum?

Follow the guide Connecting to the UI to connect to your registry.

From the main page (Projects list) once you're logged in, check if you have some Chartmuseum Helm charts in "Chart Count" column. Harbor Projects

Helm charts stored in Chartmuseum are viewable under project "Helm Charts" tab. Harbor Helm Charts Chaertmuseum

While Helm charts stored in OCI are viewable under project "Repository" tab like the Docker images. Harbor Helm Charts OCI

Instructions

We developed a tool called chartmuseum2oci whose purpose is to migrate Helm charts from Harbor Chartmuseum to Helm OCI registry.

Requirements

To migrate all Helm charts you have to use an admin user or a user having at least the "developer" role on all projects.

If the user hasn't enough rights, only the Helm Charts contained in projects accessible by user will be copied. No error will be displayed.

Then export the following variables:

export HARBOR_URL=https://
export HARBOR_USER=
export HARBOR_PASSWORD=

Run migration

Run the following commands:

git clone https://github.com/goharbor/chartmuseum-migration-tools.git
cd chartmuseum-migration-tools/chartmuseum2oci
docker build -t goharbor/chartmuseum2oci .
docker run -ti --rm goharbor/chartmuseum2oci --url $HARBOR_URL --username $HARBOR_USER --password $HARBOR_PASSWORD

During the migration, the tool will give you the amount of charts to migrate and the progression of the migration:

$ docker run -ti --rm ovhcloud/harbor-chartmuseum-migrator --url $HARBOR_URL --username $HARBOR_USER --password $HARBOR_PASSWORD
$ docker run -ti --rm ovhcloud/harbor-chartmuseum-migrator --url $HARBOR_URL --username $HARBOR_USER --password $HARBOR_PASSWORD
2023/06/28 16:17:32 416 Helm charts to migrate from Chartmuseum to OCI
   4% |█████                                                                                                                                        | (19/416, 20 it/min) [56s:19m36s]

Then, when the migration is ended:

$ docker run -ti --rm ovhcloud/harbor-chartmuseum-migrator --url $HARBOR_URL --username $HARBOR_USER --password $HARBOR_PASSWORD
$ docker run -ti --rm ovhcloud/harbor-chartmuseum-migrator --url $HARBOR_URL --username $HARBOR_USER --password $HARBOR_PASSWORD
2023/06/28 16:17:32 416 Helm charts to migrate from Chartmuseum to OCI
   100% |█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (416/416, 20 it/min)
2023/06/28 16:38:14 416 Helm charts successfully migrated from Chartmuseum to OCI

Important: The tool copies Helm charts but does not delete them from Chartmuseum.

Use OCI Helm charts

To interact with Helm charts in OCI format, use Helm in version 3.8+ (https://helm.sh/docs/intro/install/). To finalize the migration process, you have to modify all Helm charts occurrences to use OCI URL instead of Chartmuseum one. Find below some OCI examples:

Login

helm registry login $HARBOR_URL

Push

helm push dummy-chart-0.1.0.tgz $HARBOR_URL/$HARBOR_PROJECT

Install

helm install dummy-chart oci://$HARBOR_URL/$HARBOR_PROJECT/dummy-chart --version 0.1.0

Go further

To have an overview of OVHcloud Managed Private Registry service, you can consult the OVHcloud Managed Private Registry site.

Join our community of users on https://community.ovh.com/en/.

Zugehörige Artikel