kubelet

package
v3.2.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	// URL of the Kubelet instance.  This will default to `https://<current
	// node hostname>:10250` if not provided.
	URL string `yaml:"url"`
	// Can be `none` for no auth, `tls` for TLS client cert auth, or
	// `serviceAccount` to use the pod's default service account token to
	// authenticate.
	AuthType AuthType `yaml:"authType" default:"none"`
	// Whether to skip verification of the Kubelet's TLS cert
	SkipVerify *bool `yaml:"skipVerify" default:"true"`
	// Path to the CA cert that has signed the Kubelet's TLS cert, unnecessary
	// if `skipVerify` is set to false.
	CACertPath string `yaml:"caCertPath"`
	// Path to the client TLS cert to use if `authType` is set to `tls`
	ClientCertPath string `yaml:"clientCertPath"`
	// Path to the client TLS key to use if `authType` is set to `tls`
	ClientKeyPath string `yaml:"clientKeyPath"`
	// Whether to log the raw cadvisor response at the debug level for
	// debugging purposes.
	LogResponses bool `yaml:"logResponses" default:"false"`
}

APIConfig contains config specific to the KubeletAPI

type AuthType

type AuthType string

AuthType to use when connecting to kubelet

const (
	// AuthTypeNone means there is no authentication to kubelet
	AuthTypeNone AuthType = "none"
	// AuthTypeTLS indicates that client TLS auth is desired
	AuthTypeTLS AuthType = "tls"
	// AuthTypeServiceAccount indicates that the default service account token should be used
	AuthTypeServiceAccount AuthType = "serviceAccount"
)

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

Client is a wrapper around http.Client that injects the right auth to every request.

func NewClient

func NewClient(kubeletAPI *APIConfig) (*Client, error)

NewClient creates a new client with the given config

func (*Client) DoRequestAndSetValue

func (kc *Client) DoRequestAndSetValue(req *http.Request, value interface{}) error

DoRequestAndSetValue does a request to the Kubelet and populates the `value` by deserializing the JSON in the response.

func (*Client) NewRequest

func (kc *Client) NewRequest(method, path string, body io.Reader) (*http.Request, error)

NewRequest is used to provide a base URL to which paths can be appended. Other than the second argument it is identical to the http.NewRequest method.

Jump to

Keyboard shortcuts

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