From be79c16d388dacc40a83ba8607385c6829c7f1c8 Mon Sep 17 00:00:00 2001 From: Luis Rascao Date: Thu, 23 Nov 2023 11:17:28 +0000 Subject: [PATCH] fixup! Add support for local Helm repos --- README.md | 2 +- pkg/kubernetes/kubernetes.go | 2 +- utils/utils.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 916fecff8..0b463a2db 100644 --- a/README.md +++ b/README.md @@ -369,7 +369,7 @@ export DAPR_HELM_REPO_PASSWORD="passwd_xxx" Setting the above parameters will allow `dapr init -k` to install Dapr images from the configured Helm repository. -A local Helm repo is also supported: +A local Helm repo is also supported, this can either be a directory path or an existing .tgz file. export DAPR_HELM_REPO_URL="/home/user/dapr/helm-charts" diff --git a/pkg/kubernetes/kubernetes.go b/pkg/kubernetes/kubernetes.go index f9f4c22ca..df1079648 100644 --- a/pkg/kubernetes/kubernetes.go +++ b/pkg/kubernetes/kubernetes.go @@ -210,7 +210,7 @@ func locateChartFile(dirPath string) (string, error) { } func pullHelmChart(version, releaseName, helmRepo string, config *helm.Configuration) (string, func(), error) { - // is helmRepo already a directory path? (ie. /home/user/dapr/helm-charts) + // is helmRepo already a directory path or a .tgz file? (ie. /home/user/dapr/helm-charts). if localPath, err := utils.DiscoverHelmPath(helmRepo, releaseName, version); err == nil { return localPath, func() {}, nil } diff --git a/utils/utils.go b/utils/utils.go index d9c76e9ce..eecc55bb8 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -435,13 +435,13 @@ func GetJobObjectNameFromPID(pid string) string { } func DiscoverHelmPath(helmPath, release, version string) (string, error) { - // first try for a local directory path + // first try for a local directory path. dirPath := filepath.Join(helmPath, fmt.Sprintf("%s-%s", release, version)) if ValidatePath(dirPath) == nil { return dirPath, nil } - // not a dir, try a .tgz file instead + // not a dir, try a .tgz file instead. filePath := filepath.Join(helmPath, fmt.Sprintf("%s-%s.tgz", release, version)) if ValidatePath(filePath) == nil { return filePath, nil