Join us

Store and consume Helm charts using GitLab’s private registry

1_4Q22VCl2oXB6Wes92b06FQ.jpeg

In this article I’ll show how to store and consume Helm charts in GitLab’s private registry.

You’ll learn how to create 2 simple helm charts, called store-chart and consume-chart where store-chart will be stored in GitLab and consume-chart will consume the stored chart.

The following directory structure outlines the final result.

To see a working example see GitLab.

Create the store-chart

Let’s create the store-chart first and add the following to the config.yaml.

Create the Chart.yaml.

And finally the default values in the values.yaml.

Store the chart in GitLab

Now create a basic .gitlab-ci.yml.

For convenience use the alpine/helm image so the helm cli is given out-of-the-box to you. Explicitly override the entrypoint, to prevent running a subcommand of the helm cli.

  1. First login into the GitLab registry, using solely GitLab’s built-in variables.
  2. Add the stable helm chart repository given by GitLab. The chart repository follows the following URL structure.

3. Create the Helm package and push it to GitLab’s private registry.

You should now be able to run the pipeline.

Now verify if the chart has been created.

All done!

Create the consumer

Now let’s create the consume-chart and add the following:

To use the store-chart refer to it as a dependency, where the repository URL equals the registry URL found in GitLab, as shown in the last step of storing the chart.

Now override the default values of the chart by adding a values.yaml:

Note the store-chart prefix key is necessary here to override the values of a the dependency.

Update your .gitlab-ci.yml to verify if you can consume your chart from the pipeline:

The consume-chart step should now output the following:

All done, you can see the name of the ConfigMap has been successfully overwritten 🚀!


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

Avatar

Robert-Jan Kuyper

Freelance Software Engineer, Datails

@datails
User Popularity
40

Influence

4k

Total Hits

1

Posts