ARTIFACTORY: How to Set up a Virtual Helm Repository in Artifactory

Fadi Rouhana
2021-06-07 12:36

ARTIFACTORY: How to Set up a Virtual Helm Repository in Artifactory

In this Knowledge Base article, we will go through the chart repository structure and basic setup of a virtual Helm repository in Artifactory.

Introduction to the chart repository structure:

A chart repository consists of packaged charts and a special file called index.yaml which contains an index of all of the charts in the repository.

For instance, the layout of the repository https://example.com/charts might look like this:

charts/

  |

  |- index.yaml

  |

  |- alpine-0.1.2.tgz

  |

  |- alpine-0.1.2.tgz.prov

In this case, the index file would contain information about one chart, the Alpine chart, and provide the download URL https://example.com/charts/alpine-0.1.2.tgz for that chart.

A chart package does not have to be on the same server as the index.yaml file. However, doing so is frequently the simplest option.

The index file:

The index file is a yaml file called index.yaml. It contains some metadata about the package, including the contents of a chart's Chart.yaml file. A valid chart repository must have an index file. The index file contains information about each chart in the chart repository. 

How to set up a virtual Helm repository in Artifactory?

To work with Helm repositories, first, install and configure your Helm client.

You need to use Helm version 2.9.0 or above that supports authentication against Artifactory.

Artifactory only supports a resolution of Helm charts from virtual repositories.

To define a virtual Helm chart repository, create a virtual repository, set the Package Type to be Helm, and select the underlying local and remote Helm repositories to include in the Basic settings tab. This virtual repository will be configured in the Helm client.

Usually, the charts described in index.yaml are stored on the same server as the provenance files. Yet, there are three different scenarios to be aware of:

Standard Repositories:

By Standart Repository, we refer to repositories that have both their index.yaml and charts available via the same URL.

To configure such a repo in Artifactory, it's enough to specify only the URL in the remote repository Basic settings.

Single-Base-URL Repositories:

Repositories that host charts in a different base URL (download URL) than index.yaml, for example, https://charts.gitlab.io/.

In this case, the URL of the remote repo in Artifactory should point to the repository index, for eg.: <URL>/index.yaml and Charts Base URL (under Helm Settings of the remote repository) to the actual repository, where the charts are available for download, eg: https://gitlab-charts.s3.amazonaws.com/ in case of charts.gitlab.io.

Multi-Base-URL Repositories:

Repositories that host their charts in two or more different repositories/Download URLs such as charts.jenkins.io (contains both https://github.com and https://charts.jenkins.io URLs).

Artifactory currently doesn't support rewriting multiple download URLs. We either rewrite the URL or Charts Base URL (if specified). That said, we have the following RTFACT-24678 to fully support such repositories as well and it is part of our roadmap for this year.

For more information regarding Kubernetes Helm Chart Repositories, please refer to the following link.

Published: June 1, 2021

Last updated: June 24, 2021

 

Keywords: Helm Charts, Helm Virtual Repository