update vendor

Signed-off-by: Roland.Ma <rolandma@yunify.com>
This commit is contained in:
Roland.Ma
2021-08-11 07:10:14 +00:00
parent a18f72b565
commit ea8f47c73a
2901 changed files with 269317 additions and 43103 deletions

View File

@@ -22,6 +22,7 @@ import (
"github.com/pkg/errors"
"helm.sh/helm/v3/internal/experimental/registry"
"helm.sh/helm/v3/pkg/cli"
)
@@ -33,10 +34,13 @@ type options struct {
certFile string
keyFile string
caFile string
unTar bool
insecureSkipVerifyTLS bool
username string
password string
userAgent string
version string
registryClient *registry.Client
timeout time.Duration
}
@@ -90,6 +94,24 @@ func WithTimeout(timeout time.Duration) Option {
}
}
func WithTagName(tagname string) Option {
return func(opts *options) {
opts.version = tagname
}
}
func WithRegistryClient(client *registry.Client) Option {
return func(opts *options) {
opts.registryClient = client
}
}
func WithUntar() Option {
return func(opts *options) {
opts.unTar = true
}
}
// Getter is an interface to support GET to the specified URL.
type Getter interface {
// Get file content by url string
@@ -139,11 +161,16 @@ var httpProvider = Provider{
New: NewHTTPGetter,
}
var ociProvider = Provider{
Schemes: []string{"oci"},
New: NewOCIGetter,
}
// All finds all of the registered getters as a list of Provider instances.
// Currently, the built-in getters and the discovered plugins with downloader
// notations are collected.
func All(settings *cli.EnvSettings) Providers {
result := Providers{httpProvider}
result := Providers{httpProvider, ociProvider}
pluginDownloaders, _ := collectPlugins(settings)
result = append(result, pluginDownloaders...)
return result

View File

@@ -111,10 +111,13 @@ func (g *HTTPGetter) httpClient() (*http.Client, error) {
}
if g.opts.insecureSkipVerifyTLS {
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
if transport.TLSClientConfig == nil {
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
} else {
transport.TLSClientConfig.InsecureSkipVerify = true
}
}
client := &http.Client{

View File

@@ -0,0 +1,69 @@
/*
Copyright The Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package getter
import (
"bytes"
"fmt"
"strings"
"helm.sh/helm/v3/internal/experimental/registry"
)
// OCIGetter is the default HTTP(/S) backend handler
type OCIGetter struct {
opts options
}
//Get performs a Get from repo.Getter and returns the body.
func (g *OCIGetter) Get(href string, options ...Option) (*bytes.Buffer, error) {
for _, opt := range options {
opt(&g.opts)
}
return g.get(href)
}
func (g *OCIGetter) get(href string) (*bytes.Buffer, error) {
client := g.opts.registryClient
ref := strings.TrimPrefix(href, "oci://")
if version := g.opts.version; version != "" {
ref = fmt.Sprintf("%s:%s", ref, version)
}
r, err := registry.ParseReference(ref)
if err != nil {
return nil, err
}
buf, err := client.PullChart(r)
if err != nil {
return nil, err
}
return buf, nil
}
// NewOCIGetter constructs a valid http/https client as a Getter
func NewOCIGetter(options ...Option) (Getter, error) {
var client OCIGetter
for _, opt := range options {
opt(&client.opts)
}
return &client, nil
}