Documentation ¶
Overview ¶
Package server contains functions related to serving Kubelet's external interface.
Index ¶
- func ListenAndServeKubeletReadOnlyServer(host HostInterface, address net.IP, port uint)
- func ListenAndServeKubeletServer(host HostInterface, address net.IP, port uint, tlsOptions *TLSOptions, ...)
- func ServePortForward(w http.ResponseWriter, req *http.Request, portForwarder PortForwarder, ...)
- type AuthInterface
- type Closer
- type HostInterface
- type KubeletAuth
- type PortForwarder
- type Server
- type StatsRequest
- type TLSOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServeKubeletReadOnlyServer ¶
func ListenAndServeKubeletReadOnlyServer(host HostInterface, address net.IP, port uint)
ListenAndServeKubeletReadOnlyServer initializes a server to respond to HTTP network requests on the Kubelet.
func ListenAndServeKubeletServer ¶
func ListenAndServeKubeletServer(host HostInterface, address net.IP, port uint, tlsOptions *TLSOptions, auth AuthInterface, enableDebuggingHandlers bool)
ListenAndServeKubeletServer initializes a server to respond to HTTP network requests on the Kubelet.
func ServePortForward ¶
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 ¶
type AuthInterface interface { authenticator.Request authorizer.RequestAttributesGetter authorizer.Authorizer }
AuthInterface contains all methods required by the auth filters
func NewKubeletAuth ¶
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 ¶
type HostInterface interface { GetContainerInfo(podFullName string, uid types.UID, containerName string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.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 LatestLoopEntryTime() time.Time }
HostInterface contains all the kubelet methods required by the server. For testablitiy.
type KubeletAuth ¶
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 ¶
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 ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a http.Handler which exposes kubelet functionality over HTTP.
func NewServer ¶
func NewServer(host HostInterface, auth AuthInterface, enableDebuggingHandlers bool) Server
NewServer initializes and configures a kubelet.Server object to handle HTTP requests.
func (*Server) InstallAuthFilter ¶
func (s *Server) InstallAuthFilter()
InstallAuthFilter installs authentication filters with the restful Container.
func (*Server) InstallDebuggingHandlers ¶
func (s *Server) InstallDebuggingHandlers()
InstallDeguggingHandlers registers the HTTP request patterns that serve logs or run commands/containers
func (*Server) InstallDefaultHandlers ¶
func (s *Server) InstallDefaultHandlers()
InstallDefaultHandlers registers the default set of supported HTTP request patterns with the restful Container.
type StatsRequest ¶
type StatsRequest struct { // The name of the container for which to request stats. // Default: / ContainerName string `json:"containerName,omitempty"` // Max number of stats to return. // If start and end time are specified this limit is ignored. // Default: 60 NumStats int `json:"num_stats,omitempty"` // Start time for which to query information. // If omitted, the beginning of time is assumed. Start time.Time `json:"start,omitempty"` // End time for which to query information. // If omitted, current time is assumed. End time.Time `json:"end,omitempty"` // Whether to also include information from subcontainers. // Default: false. Subcontainers bool `json:"subcontainers,omitempty"` }
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 stats handles exporting Kubelet and container stats.
|
Package stats handles exporting Kubelet and container stats. |