getter

package
v0.22.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthFromSecret

func BasicAuthFromSecret(secret corev1.Secret) (getter.Option, error)

BasicAuthFromSecret attempts to construct a basic auth getter.Option for the given v1.Secret and returns the result.

Secrets with no username AND password are ignored, if only one is defined it returns an error.

func ClientOptionsFromSecret

func ClientOptionsFromSecret(secret corev1.Secret) ([]getter.Option, error)

ClientOptionsFromSecret constructs a getter.Option slice for the given secret. It returns the slice, or an error.

func NewOrIdle added in v0.22.0

func NewOrIdle(tlsConfig *tls.Config) *http.Transport

NewOrIdle tries to return an existing transport that is not currently being used. If none is found, creates a new Transport instead.

tlsConfig can optionally set the TLSClientConfig for the transport.

func Release added in v0.22.0

func Release(transport *http.Transport) error

Release releases the transport back to the TransportPool after sanitising its sensitive fields.

func TLSClientConfigFromSecret

func TLSClientConfigFromSecret(secret corev1.Secret, repositoryUrl string) (*tls.Config, error)

TLSClientConfigFromSecret attempts to construct a TLS client config for the given v1.Secret. It returns the TLS client config or an error.

Secrets with no certFile, keyFile, AND caFile are ignored, if only a certBytes OR keyBytes is defined it returns an error.

Types

type TransportPool added in v0.22.0

type TransportPool struct {
}

TransportPool is a progressive and non-blocking pool for http.Transport objects, optimised for Gargabe Collection and without a hard limit on number of objects created.

Its main purpose is to enable for transport objects to be used across helm chart download requests and helm/pkg/getter instances by leveraging the getter.WithTransport(t) construct.

The use of this pool improves the default behaviour of helm getter which creates a new connection per request, or per getter instance, resulting on unnecessary TCP connections with the target.

http.Transport objects may contain sensitive material and also have settings that may impact the security of HTTP operations using them (i.e. InsecureSkipVerify). Therefore, ensure that they are used in a thread-safe way, and also by reseting TLS specific state after each use.

Calling the Release(t) function will reset TLS specific state whilst also releasing the transport back to the pool to be reused.

xref: https://github.com/helm/helm/pull/10568 xref2: https://github.com/fluxcd/source-controller/issues/578

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL