Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Basic Auth to access Helm repo #41

Closed
DomenicoS-sdet opened this issue Aug 24, 2020 · 10 comments · Fixed by #77
Closed

Adding Basic Auth to access Helm repo #41

DomenicoS-sdet opened this issue Aug 24, 2020 · 10 comments · Fixed by #77

Comments

@DomenicoS-sdet
Copy link

Hi,

Great idea the override, however it returns a 401 Unauthorised if the repo has authentication implemented (like mine). I cloned the code and added a basic Authentication to the Get request to download the index.yaml file from the override, and now I am able to get the file.

Below an example of the config.yaml file, where for each Helm repo it is possible to specify its own authentication as Env variables. These can then be passed as k8s secret, or CI env variable at deploy.

helmRegistries:
  override:
    - registry:
        url: "https://private.chart.museum/index.yaml"
      charts:
        - chart_one
        - chart_two
      usernameEnvName: OVERRIDE_HELM_USER
      passwordEnvName: OVERRIDE_HELM_PSW
      allowAllReleases: true

Then the code for the new request is quite easy

req, err := http.NewRequest(http.MethodGet, r.HelmRegistry.URL, nil)
	if err != nil {
		log.WithError(err).Error("failed to get chart info")
	}
	u, ok := os.LookupEnv(r.UsernameEnvName)
	p, ok := os.LookupEnv(r.PasswordEnvNam)
	if ok {
		req.SetBasicAuth(u, p)
	}
	resp, err := client.Do(req)

If it sounds sensible I can open a PR with all the changes to introduce the authentication

@shanestarcher-okta
Copy link
Contributor

Your changes sound sensible. Overall I would prefer the code to use the helm libraries, but I understand if that is more effort than your time would allow.

@DomenicoS-sdet
Copy link
Author

Sorry, I am a bit lost! by using the helm libraries, you mean?

@shanestarcher-okta
Copy link
Contributor

yes vs using a raw http.NewRequest.

@DomenicoS-sdet
Copy link
Author

sorry, I wasn't clear in my previous question. I don't understand why using the Helm libraries to perform a GET call to the Chart Museum to get back the index.yaml. I normally use the Helm libraries to interact with k8s.
It's just for out of curiosity, as possibly I have missed something

@shanestarcher-okta
Copy link
Contributor

The helm libraries natively understand index management and authentication to those indexes along with supporting non-http indexes such as s3 index via plugins.

You would get all of these features built-in.

@DomenicoS-sdet
Copy link
Author

ok, I'll have a look! Thanks

@tuananhnguyen-ct
Copy link
Contributor

@DomenicoS-sdet do you have any WIP for this issue, I'd like to pick up and fix it, since we are using private helm repo here as well?

@DomenicoS-sdet
Copy link
Author

Hi, no I don't have anything. We adapted for our needs, but wasn't touched since then.🙂

@PPACI
Copy link

PPACI commented Jun 14, 2021

Hi everyone.

Is someone currently working on this?

@sstarcher
Copy link
Owner

@PPACI no one is actively working on adding this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants