server

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2016 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package server contains functions related to serving Kubelet's external interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServeKubeletReadOnlyServer added in v1.2.0

func ListenAndServeKubeletReadOnlyServer(host HostInterface, resourceAnalyzer stats.ResourceAnalyzer, address net.IP, port uint, runtime kubecontainer.Runtime)

ListenAndServeKubeletReadOnlyServer initializes a server to respond to HTTP network requests on the Kubelet.

func ListenAndServeKubeletServer added in v1.2.0

func ListenAndServeKubeletServer(
	host HostInterface,
	resourceAnalyzer stats.ResourceAnalyzer,
	address net.IP,
	port uint,
	tlsOptions *TLSOptions,
	auth AuthInterface,
	enableDebuggingHandlers bool,
	runtime kubecontainer.Runtime)

ListenAndServeKubeletServer initializes a server to respond to HTTP network requests on the Kubelet.

func ServePortForward added in v1.2.0

func ServePortForward(w http.ResponseWriter, req *http.Request, portForwarder PortForwarder, podName string, uid types.UID, idleTimeout time.Duration, streamCreationTimeout time.Duration)

ServePortForward handles a port forwarding request. A single request is kept alive as long as the client is still alive and the connection has not been timed out due to idleness. This function handles multiple forwarded connections; i.e., multiple `curl http://localhost:8888/` requests will be handled by a single invocation of ServePortForward.

Types

type AuthInterface added in v1.2.0

AuthInterface contains all methods required by the auth filters

func NewKubeletAuth added in v1.2.0

func NewKubeletAuth(authenticator authenticator.Request, authorizerAttributeGetter authorizer.RequestAttributesGetter, authorizer authorizer.Authorizer) AuthInterface

NewKubeletAuth returns a kubelet.AuthInterface composed of the given authenticator, attribute getter, and authorizer

type HostInterface added in v1.2.0

type HostInterface interface {
	GetContainerInfo(podFullName string, uid types.UID, containerName string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
	GetContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error)
	GetRawContainerInfo(containerName string, req *cadvisorapi.ContainerInfoRequest, subcontainers bool) (map[string]*cadvisorapi.ContainerInfo, error)
	GetCachedMachineInfo() (*cadvisorapi.MachineInfo, error)
	GetPods() []*api.Pod
	GetRunningPods() ([]*api.Pod, error)
	GetPodByName(namespace, name string) (*api.Pod, bool)
	RunInContainer(name string, uid types.UID, container string, cmd []string) ([]byte, error)
	ExecInContainer(name string, uid types.UID, container string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool) error
	AttachContainer(name string, uid types.UID, container string, in io.Reader, out, err io.WriteCloser, tty bool) error
	GetKubeletContainerLogs(podFullName, containerName string, logOptions *api.PodLogOptions, stdout, stderr io.Writer) error
	ServeLogs(w http.ResponseWriter, req *http.Request)
	PortForward(name string, uid types.UID, port uint16, stream io.ReadWriteCloser) error
	StreamingConnectionIdleTimeout() time.Duration
	ResyncInterval() time.Duration
	GetHostname() string
	GetNode() (*api.Node, error)
	GetNodeConfig() cm.NodeConfig
	LatestLoopEntryTime() time.Time
	ImagesFsInfo() (cadvisorapiv2.FsInfo, error)
	RootFsInfo() (cadvisorapiv2.FsInfo, error)
	ListVolumesForPod(podUID types.UID) (map[string]volume.Volume, bool)
	PLEGHealthCheck() (bool, error)
}

HostInterface contains all the kubelet methods required by the server. For testablitiy.

type KubeletAuth added in v1.2.0

type KubeletAuth struct {
	// authenticator identifies the user for requests to the Kubelet API
	authenticator.Request
	// authorizerAttributeGetter builds authorization.Attributes for a request to the Kubelet API
	authorizer.RequestAttributesGetter
	// authorizer determines whether a given authorization.Attributes is allowed
	authorizer.Authorizer
}

KubeletAuth implements AuthInterface

type PortForwarder added in v1.2.0

type PortForwarder interface {
	// PortForwarder copies data between a data stream and a port in a pod.
	PortForward(name string, uid types.UID, port uint16, stream io.ReadWriteCloser) error
}

PortForwarder knows how to forward content from a data stream to/from a port in a pod.

type Server added in v1.2.0

type Server struct {
	// contains filtered or unexported fields
}

Server is a http.Handler which exposes kubelet functionality over HTTP.

func NewServer added in v1.2.0

func NewServer(
	host HostInterface,
	resourceAnalyzer stats.ResourceAnalyzer,
	auth AuthInterface,
	enableDebuggingHandlers bool,
	runtime kubecontainer.Runtime) Server

NewServer initializes and configures a kubelet.Server object to handle HTTP requests.

func (*Server) InstallAuthFilter added in v1.2.0

func (s *Server) InstallAuthFilter()

InstallAuthFilter installs authentication filters with the restful Container.

func (*Server) InstallDebuggingHandlers added in v1.2.0

func (s *Server) InstallDebuggingHandlers()

InstallDeguggingHandlers registers the HTTP request patterns that serve logs or run commands/containers

func (*Server) InstallDefaultHandlers added in v1.2.0

func (s *Server) InstallDefaultHandlers()

InstallDefaultHandlers registers the default set of supported HTTP request patterns with the restful Container.

func (*Server) ServeHTTP added in v1.2.0

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP responds to HTTP requests on the Kubelet.

type TLSOptions added in v1.2.0

type TLSOptions struct {
	Config   *tls.Config
	CertFile string
	KeyFile  string
}

Directories

Path Synopsis
package portforward contains server-side logic for handling port forwarding requests.
package portforward contains server-side logic for handling port forwarding requests.
package remotecommand contains functions related to executing commands in and attaching to pods.
package remotecommand contains functions related to executing commands in and attaching to pods.
Package stats handles exporting Kubelet and container stats.
Package stats handles exporting Kubelet and container stats.

Jump to

Keyboard shortcuts

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