mirror of
https://github.com/helm/helm.git
synced 2026-06-30 19:57:48 +00:00
Fix User-Agent header in requests made by Helm
Signed-off-by: Jakub Warczarek <jakub.warczarek@gmail.com>
This commit is contained in:
@@ -33,6 +33,7 @@ import (
|
||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||
"k8s.io/client-go/rest"
|
||||
|
||||
"helm.sh/helm/v3/internal/version"
|
||||
"helm.sh/helm/v3/pkg/helmpath"
|
||||
)
|
||||
|
||||
@@ -230,5 +231,9 @@ func (s *EnvSettings) SetNamespace(namespace string) {
|
||||
|
||||
// RESTClientGetter gets the kubeconfig from EnvSettings
|
||||
func (s *EnvSettings) RESTClientGetter() genericclioptions.RESTClientGetter {
|
||||
s.config.WrapConfigFn = func(c *rest.Config) *rest.Config {
|
||||
c.UserAgent = version.GetUserAgent()
|
||||
return c
|
||||
}
|
||||
return s.config
|
||||
}
|
||||
|
||||
@@ -184,11 +184,11 @@ func (c *ChartDownloader) getOciURI(ref, version string, u *url.URL) (*url.URL,
|
||||
//
|
||||
// A version is a SemVer string (1.2.3-beta.1+f334a6789).
|
||||
//
|
||||
// - For fully qualified URLs, the version will be ignored (since URLs aren't versioned)
|
||||
// - For a chart reference
|
||||
// * If version is non-empty, this will return the URL for that version
|
||||
// * If version is empty, this will return the URL for the latest version
|
||||
// * If no version can be found, an error is returned
|
||||
// - For fully qualified URLs, the version will be ignored (since URLs aren't versioned)
|
||||
// - For a chart reference
|
||||
// - If version is non-empty, this will return the URL for that version
|
||||
// - If version is empty, this will return the URL for the latest version
|
||||
// - If no version can be found, an error is returned
|
||||
func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, error) {
|
||||
u, err := url.Parse(ref)
|
||||
if err != nil {
|
||||
|
||||
@@ -120,7 +120,6 @@ func (r *ChartRepository) DownloadIndexFile() (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// TODO add user-agent
|
||||
resp, err := r.Client.Get(indexURL,
|
||||
getter.WithURL(r.Config.URL),
|
||||
getter.WithInsecureSkipVerifyTLS(r.Config.InsecureSkipTLSverify),
|
||||
|
||||
Reference in New Issue
Block a user