mirror of https://github.com/helm/helm.git
Pass credentials when either chart repo or repo dont specify a port but it matches the default port of that scheme
Signed-off-by: Danilo Bürger <danilo.buerger@helsing.ai>
This commit is contained in:
parent
091f9a24fe
commit
8096f09370
|
@ -746,6 +746,21 @@ OUTER:
|
|||
return nil
|
||||
}
|
||||
|
||||
func portOrDefault(u *url.URL) string {
|
||||
if p := u.Port(); p != "" {
|
||||
return p
|
||||
}
|
||||
|
||||
switch u.Scheme {
|
||||
case "http":
|
||||
return "80"
|
||||
case "https":
|
||||
return "443"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// LocateChart looks for a chart directory in known places, and returns either the full path or an error.
|
||||
//
|
||||
// This does not ensure that the chart is well-formed; only that the requested filename exists.
|
||||
|
@ -833,7 +848,7 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (
|
|||
// Host on URL (returned from url.Parse) contains the port if present.
|
||||
// This check ensures credentials are not passed between different
|
||||
// services on different ports.
|
||||
if c.PassCredentialsAll || (u1.Scheme == u2.Scheme && u1.Host == u2.Host) {
|
||||
if c.PassCredentialsAll || (u1.Scheme == u2.Scheme && u1.Hostname() == u2.Hostname() && portOrDefault(u1) == portOrDefault(u2)) {
|
||||
dl.Options = append(dl.Options, getter.WithBasicAuth(c.Username, c.Password))
|
||||
} else {
|
||||
dl.Options = append(dl.Options, getter.WithBasicAuth("", ""))
|
||||
|
|
Loading…
Reference in New Issue