server

package
v1.28.0-alpha.3...-059ce4e Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: Apache-2.0 Imports: 67 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

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

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

func ListenAndServeKubeletServer

func ListenAndServeKubeletServer(
	host HostInterface,
	resourceAnalyzer stats.ResourceAnalyzer,
	kubeCfg *kubeletconfiginternal.KubeletConfiguration,
	tlsOptions *TLSOptions,
	auth AuthInterface,
	tp oteltrace.TracerProvider)

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

func ListenAndServePodResources

func ListenAndServePodResources(endpoint string, providers podresources.PodResourcesProviders)

ListenAndServePodResources initializes a gRPC server to serve the PodResources service

func NewNodeAuthorizerAttributesGetter

func NewNodeAuthorizerAttributesGetter(nodeName types.NodeName) authorizer.RequestAttributesGetter

NewNodeAuthorizerAttributesGetter creates a new authorizer.RequestAttributesGetter for the node.

Types

type AuthInterface

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 {
	stats.Provider
	GetVersionInfo() (*cadvisorapi.VersionInfo, error)
	GetCachedMachineInfo() (*cadvisorapi.MachineInfo, error)
	GetRunningPods(ctx context.Context) ([]*v1.Pod, error)
	RunInContainer(ctx context.Context, name string, uid types.UID, container string, cmd []string) ([]byte, error)
	CheckpointContainer(ctx context.Context, podUID types.UID, podFullName, containerName string, options *runtimeapi.CheckpointContainerRequest) error
	GetKubeletContainerLogs(ctx context.Context, podFullName, containerName string, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) error
	ServeLogs(w http.ResponseWriter, req *http.Request)
	ResyncInterval() time.Duration
	GetHostname() string
	LatestLoopEntryTime() time.Time
	GetExec(ctx context.Context, podFullName string, podUID types.UID, containerName string, cmd []string, streamOpts remotecommandserver.Options) (*url.URL, error)
	GetAttach(ctx context.Context, podFullName string, podUID types.UID, containerName string, streamOpts remotecommandserver.Options) (*url.URL, error)
	GetPortForward(ctx context.Context, podName, podNamespace string, podUID types.UID, portForwardOpts portforward.V4Options) (*url.URL, error)
	ListMetricDescriptors(ctx context.Context) ([]*runtimeapi.MetricDescriptor, error)
	ListPodSandboxMetrics(ctx context.Context) ([]*runtimeapi.PodSandboxMetrics, error)
}

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

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 Server

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

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

func NewServer

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) InstallDebugFlagsHandler

func (s *Server) InstallDebugFlagsHandler(enableDebugFlagsHandler bool)

InstallDebugFlagsHandler registers the HTTP request patterns for /debug/flags/v endpoint.

func (*Server) InstallDebuggingDisabledHandlers

func (s *Server) InstallDebuggingDisabledHandlers()

InstallDebuggingDisabledHandlers registers the HTTP request patterns that provide better error message

func (*Server) InstallDebuggingHandlers

func (s *Server) InstallDebuggingHandlers()

InstallDebuggingHandlers 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.

func (*Server) InstallProfilingHandler

func (s *Server) InstallProfilingHandler(enableProfilingLogHandler bool, enableContentionProfiling bool)

InstallProfilingHandler registers the HTTP request patterns for /debug/pprof endpoint.

func (*Server) InstallSystemLogHandler

func (s *Server) InstallSystemLogHandler(enableSystemLogHandler bool, enableSystemLogQuery bool)

InstallSystemLogHandler registers the HTTP request patterns for logs endpoint.

func (*Server) InstallTracingFilter

func (s *Server) InstallTracingFilter(tp oteltrace.TracerProvider)

InstallTracingFilter installs OpenTelemetry tracing filter with the restful Container.

func (*Server) ServeHTTP

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

ServeHTTP responds to HTTP requests on the Kubelet.

type TLSOptions

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

TLSOptions holds the TLS options.

Directories

Path Synopsis
Package stats handles exporting Kubelet and container stats.
Package stats handles exporting Kubelet and container stats.
testing
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.

Jump to

Keyboard shortcuts

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