Registries

Helm 3 supports OCI for package distribution. Chart packages are able to bestored and shared across OCI-based registries.

Enabling OCI Support

Currently OCI support is considered experimental.

In order to use the commands described below, please set HELM_EXPERIMENTAL_OCIin the enironment:

  1. export HELM_EXPERIMENTAL_OCI=1

Running a registry

Starting a registry for test purposes is trivial. As long as you have Dockerinstalled, run the following command:

  1. docker run -dp 5000:5000 --restart=always --name registry registry

This will start a registry server at localhost:5000.

Use docker logs -f registry to see the logs and docker rm -f registry tostop.

If you wish to persist storage, you can add -v$(pwd)/registry:/var/lib/registry to the command above.

For more configuration options, please see thedocs.

Auth

If you wish to enable auth on the registry, you can do the following-

First, create file auth.htpasswd with username and password combo:

  1. htpasswd -cB -b auth.htpasswd myuser mypass

Then, start the server, mounting that file and setting the REGISTRY_AUTH envvar:

  1. docker run -dp 5000:5000 --restart=always --name registry \
  2. -v $(pwd)/auth.htpasswd:/etc/docker/registry/auth.htpasswd \
  3. -e REGISTRY_AUTH="{htpasswd: {realm: localhost, path: /etc/docker/registry/auth.htpasswd}}" \
  4. registry

Commands for working with registries

Commands are available under both helm registry and helm chart that allowyou to work with registries and local cache.

The registry subcommand

login

login to a registry (with manual password entry)

  1. $ helm registry login -u myuser localhost:5000
  2. Password:
  3. Login succeeded

logout

logout from a registry

  1. $ helm registry logout localhost:5000
  2. Logout succeeded

The chart subcommand

save

save a chart directory to local cache

  1. $ helm chart save mychart/ localhost:5000/myrepo/mychart:2.7.0
  2. ref: localhost:5000/myrepo/mychart:2.7.0
  3. digest: 1b251d38cfe948dfc0a5745b7af5ca574ecb61e52aed10b19039db39af6e1617
  4. size: 2.4 KiB
  5. name: mychart
  6. version: 0.1.0
  7. 2.7.0: saved

list

list all saved charts

  1. $ helm chart list
  2. REF NAME VERSION DIGEST SIZE CREATED
  3. localhost:5000/myrepo/mychart:2.7.0 mychart 2.7.0 84059d7 454 B 27 seconds
  4. localhost:5000/stable/acs-engine-autoscaler:2.2.2 acs-engine-autoscaler 2.2.2 d8d6762 4.3 KiB 2 hours
  5. localhost:5000/stable/aerospike:0.2.1 aerospike 0.2.1 4aff638 3.7 KiB 2 hours
  6. localhost:5000/stable/airflow:0.13.0 airflow 0.13.0 c46cc43 28.1 KiB 2 hours
  7. localhost:5000/stable/anchore-engine:0.10.0 anchore-engine 0.10.0 3f3dcd7 34.3 KiB 2 hours
  8. ...

export

export a chart to directory

  1. $ helm chart export localhost:5000/myrepo/mychart:2.7.0
  2. ref: localhost:5000/myrepo/mychart:2.7.0
  3. digest: 1b251d38cfe948dfc0a5745b7af5ca574ecb61e52aed10b19039db39af6e1617
  4. size: 2.4 KiB
  5. name: mychart
  6. version: 0.1.0
  7. Exported chart to mychart/

push

push a chart to remote

  1. $ helm chart push localhost:5000/myrepo/mychart:2.7.0
  2. The push refers to repository [localhost:5000/myrepo/mychart]
  3. ref: localhost:5000/myrepo/mychart:2.7.0
  4. digest: 1b251d38cfe948dfc0a5745b7af5ca574ecb61e52aed10b19039db39af6e1617
  5. size: 2.4 KiB
  6. name: mychart
  7. version: 0.1.0
  8. 2.7.0: pushed to remote (1 layer, 2.4 KiB total)

remove

remove a chart from cache

  1. $ helm chart remove localhost:5000/myrepo/mychart:2.7.0
  2. 2.7.0: removed

pull

pull a chart from remote

  1. $ helm chart pull localhost:5000/myrepo/mychart:2.7.0
  2. 2.7.0: Pulling from localhost:5000/myrepo/mychart
  3. ref: localhost:5000/myrepo/mychart:2.7.0
  4. digest: 1b251d38cfe948dfc0a5745b7af5ca574ecb61e52aed10b19039db39af6e1617
  5. size: 2.4 KiB
  6. name: mychart
  7. version: 0.1.0
  8. Status: Downloaded newer chart for localhost:5000/myrepo/mychart:2.7.0

Where are my charts?

Charts stored using the commands above will be cached on the filesystem.

The OCI Image LayoutSpecificationis adhered to strictly for filesystem layout, for example:

  1. $ tree ~/Library/Caches/helm/
  2. /Users/myuser/Library/Caches/helm/
  3. └── registry
  4. ├── cache
  5. ├── blobs
  6. └── sha256
  7. ├── 1b251d38cfe948dfc0a5745b7af5ca574ecb61e52aed10b19039db39af6e1617
  8. ├── 31fb454efb3c69fafe53672598006790122269a1b3b458607dbe106aba7059ef
  9. └── 8ec7c0f2f6860037c19b54c3cfbab48d9b4b21b485a93d87b64690fdb68c2111
  10. ├── index.json
  11. ├── ingest
  12. └── oci-layout
  13. └── config.json

Example index.json, which contains refs to all Helm chart manifests:

  1. $ cat ~/Library/Caches/helm/registry/cache/index.json | jq
  2. {
  3. "schemaVersion": 2,
  4. "manifests": [
  5. {
  6. "mediaType": "application/vnd.oci.image.manifest.v1+json",
  7. "digest": "sha256:31fb454efb3c69fafe53672598006790122269a1b3b458607dbe106aba7059ef",
  8. "size": 354,
  9. "annotations": {
  10. "org.opencontainers.image.ref.name": "localhost:5000/myrepo/mychart:2.7.0"
  11. }
  12. }
  13. ]
  14. }

Example Helm chart manifest (note the mediaType fields):

  1. $ cat ~/Library/Caches/helm/registry/cache/blobs/sha256/31fb454efb3c69fafe53672598006790122269a1b3b458607dbe106aba7059ef | jq
  2. {
  3. "schemaVersion": 2,
  4. "config": {
  5. "mediaType": "application/vnd.cncf.helm.config.v1+json",
  6. "digest": "sha256:8ec7c0f2f6860037c19b54c3cfbab48d9b4b21b485a93d87b64690fdb68c2111",
  7. "size": 117
  8. },
  9. "layers": [
  10. {
  11. "mediaType": "application/vnd.cncf.helm.chart.content.layer.v1+tar",
  12. "digest": "sha256:1b251d38cfe948dfc0a5745b7af5ca574ecb61e52aed10b19039db39af6e1617",
  13. "size": 2487
  14. }
  15. ]
  16. }

Migrating from chart repos

Migrating from classic chart repositories(index.yaml-based repos) is as simple as a helm fetch (Helm 2 CLI), helmchart save, helm chart push.