helm: Basic auth credentials from repo not used in install/upgrade/fetch commands

I added the repo (JFrog Artifactory) with the new --username and --password params, and they are stored correctly in the repositories.yaml. When I run helm repo update everythings works fine, but for helm fetch <repo>/<chart>, helm install <repo>/chart> and helm upgrade <release> <repo/<chart> it doesn’t pick up the credentials. It works if I pass them manually to each command, but this seems to be wrong for me, since they are already stored…

Versions:

Client: &version.Version{SemVer:"v2.9.0-rc3", GitCommit:"60abcdca41f544caaecb224acbfb92aee11e1f6e", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.9.0-rc3", GitCommit:"60abcdca41f544caaecb224acbfb92aee11e1f6e", GitTreeState:"clean"}
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.6", GitCommit:"6260bb08c46c31eea6cb538b34a9ceb3e406689c", GitTreeState:"clean", BuildDate:"2017-12-21T06:34:11Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"", Minor:"", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2018-01-26T19:04:38Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}

Running against Minikube & GKE

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@bacongobbler It’s still an issue in helm 2.10.0-rc.2:

$ helm version
Client: &version.Version{SemVer:"v2.10.0-rc.2", GitCommit:"56154102a2f25ebf679c791907fd355bb0377f05", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.10.0-rc.2", GitCommit:"56154102a2f25ebf679c791907fd355bb0377f05", GitTreeState:"clean"}

$ helm dependency update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "local" chart repository
...Successfully got an update from the "chartmuseum" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading mongodb-replicaset from repo https://chartmuseum-customurl
Save error occurred:  could not download https://chartmuseum-customurl/charts/mongodb-replicaset-3.5.0.tgz: Failed to fetch https://chartmuseum-customurl/charts/mongodb-replicaset-3.5.0.tgz : 401 Unauthorized
Deleting newly downloaded charts, restoring pre-update state
Error: could not download https://chartmuseum-customurl/charts/mongodb-replicaset-3.5.0.tgz: Failed to fetch https://chartmuseum-customurl/charts/mongodb-replicaset-3.5.0.tgz : 401 Unauthorized```

@eyalbe4 we suspect that bug still exists. We created chartmuseum repository with basic auth, then watch this:

➜  repository: helm version                               
Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
➜  repository: helm init
$HELM_HOME has been configured at /home/awawa/.helm.
Warning: Tiller is already installed in the cluster.
(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)
Happy Helming!
➜  repository: helm repo add --username [redacted] --password '[redacted]' innocode https://[redacted]
"innocode" has been added to your repositories
➜  repository: cat repositories.yaml                                                                                   
apiVersion: v1
generated: 2018-05-18T18:07:13.780887357+03:00
repositories:
- caFile: ""
  cache: /home/awawa/.helm/repository/cache/stable-index.yaml
  certFile: ""
  keyFile: ""
  name: stable
  password: ""
  url: https://kubernetes-charts.storage.googleapis.com
  username: ""
- caFile: ""
  cache: /home/awawa/.helm/repository/cache/local-index.yaml
  certFile: ""
  keyFile: ""
  name: local
  password: ""
  url: http://127.0.0.1:8879/charts
  username: ""
- caFile: ""
  cache: /home/awawa/.helm/repository/cache/innocode-index.yaml
  certFile: ""
  keyFile: ""
  name: innocode
  password: [redacted]
  url: https://[redacted]
  username: [redacted]
➜  repository: helm dependency update                                                                                  
Hang tight while we grab the latest from your chart repositories...
...Unable to get an update from the "local" chart repository (http://127.0.0.1:8879/charts):
	Get http://127.0.0.1:8879/charts/index.yaml: dial tcp 127.0.0.1:8879: connect: connection refused
...Successfully got an update from the "innocode" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 5 charts
Downloading innocode-cloudsqlproxy from repo https://[redacted]
Save error occurred:  could not download https://[redacted]/charts/innocode-cloudsqlproxy-1.0.0.tgz: Failed to fetch https://[redacted]/charts/innocode-cloudsqlproxy-1.0.0.tgz : 401 Unauthorized
Deleting newly downloaded charts, restoring pre-update state
Error: could not download https://[redacted]/charts/innocode-cloudsqlproxy-1.0.0.tgz: Failed to fetch https://[redacted]/charts/innocode-cloudsqlproxy-1.0.0.tgz : 401 Unauthorized

But helm search and helm push both work.

@eyalbe4 @innocode-devops @dcovello and I figured it out. There was a mismatch between the chart urls in dependencies.yaml and the index.yaml in our chartmuseum. To solve it we now run chartmuseum with the --chart_url flag (or CHART_URL env variable) set to chartmuseum’s url.

@olvesh and @djablonski, I’ve just created this pull request with a fix for this issue. Thanks for reporting it! @bacongobbler, can you please merge the fix? Thanks