okteto / docs

Apache License 2.0
6 stars 16 forks source link

Document how helm chart are supported in Okteto's built-in registry #108

Closed ifbyol closed 1 year ago

ifbyol commented 2 years ago

We had a discussion in our community forum about the helm chart support in Okteto's built-in registry. After some testing, we support that scenario and it would be nice to include some documentation explaining how to use it. I'll include some information on how it works but feel free to ping me directly if you have any question about how it works

The use case is to use Okteto's registry to store helm chart artifacts in the same way we store images. To do so, you can follow the next intructions.

  1. Login with helm in the Okteto registry using your Okteto credentials:
helm registry login -u <user> <okteto-registry-url>
Password:
Login Succeeded
  1. If your helm chart wasn't packaged yet, you can do it executing:
helm package <folder-with-chart-definition>
Successfully packaged chart and saved it to: <path-to-helm-artifacts-tgz>
  1. Once you have your helm chart packaged, you can push it to the Okteto registry using the following command. Important note, you need to specify the Okteto namespace (at the end of the registry url) where the artifacts will be pushed in the same way it is done when pushing an image:
helm push <path-to-helm-artifacts-tgz> oci://<okteto-registry-url>/<okteto-namespace>
Pushed: <okteto-registry-url>/<okteto-namespace>/<helm-chart-name>:<version>
Digest: sha256:07805....
  1. Now, you (or any other Okteto user with access to the Okteto namespace) should be able to pull the chart with the following command:
helm pull oci://<okteto-registry-url>/<okteto-namespace>/<helm-chart-name> --version <version>
Pulled: <okteto-registry-url>/<okteto-namespace>/<helm-chart-name>:<version>
Digest: sha256:0780569....

In the community forum I added an example on how to do it with Cloud and one of the helm charts defined in the movies example. I'll include it also here to illustrate how to apply the steps defined above. For this example, I will assume the movies repo is cloned locally.

  1. First thing, we should login into the Okteto Cloud registry using our Okteto Cloud credentials:
helm registry login -u <user> registry.cloud.okteto.net
Password:
Login Succeeded
  1. Lets go to the root folder of the cloned movies app and lets package the helm chart
helm package api/chart
Successfully packaged chart and saved it to: /Users/xxxx/xxxxx/xxxxx/xxxx/movies-api-0.1.0.tgz
  1. Once the chart is packaged, lets push it to Cloud's registry
helm push /Users/xxxx/xxxxx/xxxxx/xxxxxx/movies-api-0.1.0.tgz oci://registry.cloud.okteto.net/<okteto-namespace>
Pushed: registry.cloud.okteto.net/<okteto-namespace>/movies-api:0.1.0
Digest: sha256:07805....
  1. Now, you can verify everything was pushed correctly trying to pull the chart:
helm pull oci://registry.cloud.okteto.net/<okteto-namespace>/movies-api --version 0.1.0
Pulled: registry.cloud.okteto.net/<okteto-namespace>/movies-api:0.1.0
Digest: sha256:0780569....
ifbyol commented 2 years ago

We should also bear in mind the scenario of the global okteto namespace in the registry to make these artifacts accessible by all the Okteto users: https://github.com/okteto/docs/issues/111