Skip to content

Commit

Permalink
Add support for Helm charts from OCI registries (#834)
Browse files Browse the repository at this point in the history
* Add support for Helm charts from OCI registries

* Add information about Helm charts on OCI registries in documentation
  • Loading branch information
graillus authored Mar 25, 2022
1 parent 2a738c5 commit 85fe799
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/external_dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ Fetches helm charts and any specific subcharts in the `requirements.yaml` file.
It defaults to the value of the `KAPITAN_HELM_PATH` environment var or simply to `helm` if neither is set.
You should specify only if you don't want the default behavior.

`source` can be either the URL to a chart repository, or the URL to a chart on an OCI registry (supported since Helm 3.8.0).

### Usage

```yaml
Expand All @@ -184,7 +186,7 @@ parameters:
dependencies:
- type: helm
output_path: path/to/chart
source: http[s]://<helm_chart_repository_url>
source: http[s]|oci://<helm_chart_repository_url>
version: <specific chart version>
chart_name: <name of chart>
helm_path: <helm binary>
Expand Down
9 changes: 7 additions & 2 deletions kapitan/dependency_manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,18 @@ def fetch_helm_archive(helm_path, repo, chart_name, version, save_path):
logger.info("Dependency helm chart %s and version %s: fetching now", chart_name, version or "latest")
# Fetch archive and untar it into parent dir
save_dir = os.path.dirname(save_path)
args = ["pull", "--destination", save_dir, "--untar", "--repo", repo]
args = ["pull", "--destination", save_dir, "--untar"]

if version:
args.append("--version")
args.append(version)

args.append(chart_name)
if repo.startswith("oci://"):
args.append(repo)
else:
args.append("--repo")
args.append(repo)
args.append(chart_name)

response = helm_cli(helm_path, args)
if response != "":
Expand Down

0 comments on commit 85fe799

Please sign in to comment.