client

package
v0.0.0-...-52527b8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 50

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnonymousClientConfigWithWrapTransport

func AnonymousClientConfigWithWrapTransport(config *rest.Config) *rest.Config

AnonymousClientConfigWithWrapTransport returns a copy of the given config with all user credentials (cert/key, bearer token, and username/password) and custom transports (Transport) removed. This function preserves WrapTransport for clients that care about custom HTTP behavior.

func DefaultServerName

func DefaultServerName(config *rest.Config) error

DefaultServerName extract the hostname from the config.Host and sets it in config.ServerName the ServerName is passed to the server for SNI and is used in the client to check server certificates.

note: if the ServerName has been already specified calling this method has no effect

func GetClientConfig

func GetClientConfig(kubeConfigFile string, overrides *ClientConnectionOverrides) (*rest.Config, error)

GetClientConfig returns the rest.Config for a kubeconfig file

func GetKubeConfigOrInClusterConfig

func GetKubeConfigOrInClusterConfig(kubeConfigFile string, overrides *ClientConnectionOverrides) (*rest.Config, error)

GetKubeConfigOrInClusterConfig loads in-cluster config if kubeConfigFile is empty or the file if not, then applies overrides.

func NewPreferredHostRoundTripper

func NewPreferredHostRoundTripper(preferredHostFn func() string) func(http.RoundTripper) http.RoundTripper

NewPreferredHostRoundTripper a simple middleware for changing the destination host for each request to the provided one. If the preferred host doesn't exists (an empty string) then this RT has no effect.

Types

type ClientConnectionOverrides

type ClientConnectionOverrides struct {
	configv1.ClientConnectionOverrides

	// MaxIdleConnsPerHost, if non-zero, controls the maximum idle (keep-alive) connections to keep per-host:port.
	// If zero, DefaultMaxIdleConnsPerHost is used.
	// TODO roll this into the connection overrides in api
	MaxIdleConnsPerHost int
}

ClientConnectionOverrides allows overriding values for rest.Config not held in a kubeconfig. Most commonly used for QPS. Empty values are not used.

type ClientTransportOverrides

type ClientTransportOverrides struct {
	WrapTransport       func(rt http.RoundTripper) http.RoundTripper
	MaxIdleConnsPerHost int
}

func (ClientTransportOverrides) DefaultClientTransport

func (c ClientTransportOverrides) DefaultClientTransport(rt http.RoundTripper) http.RoundTripper

defaultClientTransport sets defaults for a client Transport that are suitable for use by infrastructure components.

Jump to

Keyboard shortcuts

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