Helm Repositories: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 12: Line 12:
A repository is a place - usually a HTTP server - where [[Helm_Concepts#Chart|charts]] are collected and shared. A [[Helm_Dependencies#Local_Dependencies|local directory]] can be used as Helm repository too, charts can refer to their dependencies using a <code>file://...</code> syntax. The charts are maintained and exposed by repository in an [[Helm_Concepts#Chart_Archive|archived format]]. A repository must expose an [[#index.yaml| index.yaml]] file in its root. This file contains a list of all packages supplied by repository, together with metadata that allows retrieving and verifying those packages.  
A repository is a place - usually a HTTP server - where [[Helm_Concepts#Chart|charts]] are collected and shared. A [[Helm_Dependencies#Local_Dependencies|local directory]] can be used as Helm repository too, charts can refer to their dependencies using a <code>file://...</code> syntax. The charts are maintained and exposed by repository in an [[Helm_Concepts#Chart_Archive|archived format]]. A repository must expose an [[#index.yaml| index.yaml]] file in its root. This file contains a list of all packages supplied by repository, together with metadata that allows retrieving and verifying those packages.  


When Helm is installed, it is pre-configured with a [[#Default_Repository|default repository]]. New repositories an be [[Helm_repo#Add_a_New_Repository|added]]. The list of locally-configured repository can be inspected with [[Helm_repo#List_Repositories_Helm_is_Configured_With|helm repo list]]. Repositories can be searched for charts with [[helm search]]. Because chart repositories change frequently, it is recommended to [[Helm_repo#Update_the_Local_Repository_Cache|update the local cache]].  
When Helm is installed, it is pre-configured with a [[#Default_Repository|default repository]]. New repositories can be [[Helm_repo#Add_a_New_Repository|added]]. The list of locally-configured repository can be inspected with [[Helm_repo#List_Repositories_Helm_is_Configured_With|helm repo list]]. Repositories can be searched for charts with [[helm search]]. Because chart repositories change frequently, it is recommended to [[Helm_repo#Update_the_Local_Repository_Cache|update the local cache]].  


Using Helm repositories is recommended practice, but they are optional. A Helm chart can be deployed directly from the local filesystem.  
Using Helm repositories is recommended practice, but they are optional. A Helm chart can be deployed directly from the local filesystem.  

Latest revision as of 02:35, 10 January 2023

External

Internal

Overview

A repository is a place - usually a HTTP server - where charts are collected and shared. A local directory can be used as Helm repository too, charts can refer to their dependencies using a file://... syntax. The charts are maintained and exposed by repository in an archived format. A repository must expose an index.yaml file in its root. This file contains a list of all packages supplied by repository, together with metadata that allows retrieving and verifying those packages.

When Helm is installed, it is pre-configured with a default repository. New repositories can be added. The list of locally-configured repository can be inspected with helm repo list. Repositories can be searched for charts with helm search. Because chart repositories change frequently, it is recommended to update the local cache.

Using Helm repositories is recommended practice, but they are optional. A Helm chart can be deployed directly from the local filesystem.

Charts are stored and exposed in repositories as chart archives whose name include the chart name and version:

my-chart-1.2.3.tgz

As newer versions are added, the old version stay around, so they can be still looked up when an older version is needed. Should the local repository be called cache?. Helm 2 came with a built-in package server for developer testing. It seems, however, that the helm serve has been removed in Helm 3.

Repository Management

Repository URL

Source Repository

Managed (Locally Added) Repository

Also known as "managed" repository.

What is a locally added repository? What it is structure? What it is its function?

Managed repositories are useful when authentication information needs to be provided. It is cached.

TODO: https://helm.sh/docs/topics/chart_repository/

A repository becomes "managed" if it is "locally added" with the helm repo add command.

Repository Name

repositories.yaml

/Users/<username>/Library/Preferences/helm/repositories.yaml

apiVersion: ""
generated: "0001-01-01T00:00:00Z"
repositories:
- name: bitnami
  url: https://charts.bitnami.com/bitnami
  insecure_skip_tls_verify: false
  username: ""
  password: ""
  caFile: ""
  certFile: ""
  keyFile: ""
- ...

A new entry is added to this file when 'helm repo add' is invoked.

Unmanaged Repository

Unmanaged repositories can be used when they don't require authentication. helm dependency update command will connect directly to the source repository and pull the dependency every times is invoked. If authentication or certificates are required to access the repository, a managed repository is required.

Known Repositories

https://charts.helm.sh/stable

The default repository for stable charts is https://charts.helm.sh/stable.

To add the repository locally:

helm repo add stable https://charts.helm.sh/stable

To see the charts via command line:

helm search repo stable

To brows the charts, go to the CNCF Artifact Hub and search the "helm-stable" repository:

https://artifacthub.io/packages/search

Helm Hub

The canonical source for Helm chart is the Helm Hub https://hub.helm.sh/, an aggregator for distributed chart repositories. Helm Hub exposes stable and incubator, which both reside in GitHub under https://github.com/helm/charts, as well as many other repositories. Helm Hub is convenient while searching various repositories for charts.

stable

Helm Hub link: https://hub.helm.sh/charts/stable

Chart.yaml dependencies "repository":

dependencies:
  - name: ...
    repository: https://kubernetes-charts.storage.googleapis.com

GitHub source: https://github.com/helm/charts/tree/master/stable

More details: https://github.com/helm/charts.

incubator

Helm Hub link: https://hub.helm.sh/charts/incubator

Chart.yaml dependencies "repository":

dependencies:
  - name: ...
    repository: https://kubernetes-charts-incubator.storage.googleapis.com/

GitHub source: https://github.com/helm/charts/tree/master/incubator

More details: https://github.com/helm/charts.

Repository Name

Each locally-added repository is known under a name, which is associated with the repository URL.

Repository URL

The repository URL represents the endpoint of a Helm repository - the endpoint's root must contain an index.yaml file. Also see the discussion for the special case of dependency charts that exist on the local file system.

Default Repository

When Helm is installed, it is pre-configured to look into the official Helm Charts GitHub repository, named "stable". Is this still true for Helm 3?

Local Cache

In Helm 2, the local repository cache is maintained under ~/.helm/repository.

TODO investigate ~/.helm/repository

Chart Reference

A chart stored in a chart repository can be identified by its chart reference, relative to the repository. The chart reference and the chart name are semantically equivalent. The chart reference, or the chart name, is used to specify the chart when installed.

Repository Structure

charts/
 |
 +- index.yaml
 |
 +- blue-1.0.0.tgz
 +- blue-1.0.1.tgz
 +- blue-1.0.2.tgz

index.yaml

https://helm.sh/docs/topics/chart_repository/#the-index-file

The index file contains metadata about hosted charts, including the content of Chart.yaml, and it. is generated by helm repo index.

Example if an index file:

apiVersion: v1
entries:
  a:
  - apiVersion: v2
    created: "2019-12-15T14:01:02.326198-08:00"
    dependencies:
    - name: b
      repository: http://localhost/charts
      version: 1.0.0
    digest: 64627fcd102f2ac9271bfb36e38d57ba3e9c4636fb42fbff582e83d999e7ab3f
    name: a
    urls:
    - a-1.0.0.tgz
    version: 1.0.0
  b:
  - apiVersion: v2
    created: "2019-12-15T14:01:02.326484-08:00"
    dependencies:
    - name: c
      repository: http://localhost/charts
      version: 1.0.0
    digest: 064e1d3507270014718f9fc4539f1ce0c12585bc94d95c82fe5966e25e08582b
    name: b
    urls:
    - b-1.0.0.tgz
    version: 1.0.0
  c:
  - apiVersion: v2
    created: "2019-12-15T14:01:02.32662-08:00"
    digest: a5fbc1d4d9a73c0f16d8c769c8118101f63bde617d46d636c14fb99059bcd96a
    name: c
    urls:
    - c-1.0.0.tgz
    version: 1.0.0
generated: "2019-12-15T14:01:02.324043-08:00"

Runtimes

Repository Operations