Documentation ¶
Index ¶
- func AnonymousClientConfigWithWrapTransport(config *rest.Config) *rest.Config
- func DefaultServerName(config *rest.Config) error
- func GetClientConfig(kubeConfigFile string, overrides *ClientConnectionOverrides) (*rest.Config, error)
- func GetKubeConfigOrInClusterConfig(kubeConfigFile string, overrides *ClientConnectionOverrides) (*rest.Config, error)
- func NewPreferredHostRoundTripper(preferredHostFn func() string) func(http.RoundTripper) http.RoundTripper
- type ClientConnectionOverrides
- type ClientTransportOverrides
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnonymousClientConfigWithWrapTransport ¶
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 ¶
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.