Skip to content

Commit

Permalink
fixup! Add support for local Helm repos
Browse files Browse the repository at this point in the history
  • Loading branch information
lrascao committed Nov 24, 2023
1 parent 7c4b45c commit be79c16
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion pkg/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit be79c16

Please sign in to comment.