Documentation ¶
Overview ¶
Package server contains functions related to serving Kubelet's external interface.
Index ¶
- func ListenAndServeKubeletReadOnlyServer(host HostInterface, resourceAnalyzer stats.ResourceAnalyzer, address net.IP, ...)
- func ListenAndServeKubeletServer(host HostInterface, resourceAnalyzer stats.ResourceAnalyzer, ...)
- func ListenAndServePodResources(endpoint string, providers podresources.PodResourcesProviders)
- type AuthInterface
- type HostInterface
- type KubeletAuth
- type NodeRequestAttributesGetter
- type Server
- func (s *Server) InstallAuthFilter()
- func (s *Server) InstallDebugFlagsHandler(enableDebugFlagsHandler bool)
- func (s *Server) InstallDebuggingDisabledHandlers()
- func (s *Server) InstallDebuggingHandlers()
- func (s *Server) InstallDefaultHandlers()
- func (s *Server) InstallProfilingHandler(enableProfilingLogHandler bool, enableContentionProfiling bool)
- func (s *Server) InstallSystemLogHandler(enableSystemLogHandler bool, enableSystemLogQuery bool)
- func (s *Server) InstallTracingFilter(tp oteltrace.TracerProvider, opts ...otelrestful.Option)
- func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
- type TLSOptions
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, tp oteltrace.TracerProvider)
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, 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 ¶ added in v1.13.0
func ListenAndServePodResources(endpoint string, providers podresources.PodResourcesProviders)
ListenAndServePodResources initializes a gRPC server to serve the PodResources service
Types ¶
type AuthInterface ¶ added in v1.2.0
type AuthInterface interface { authenticator.Request NodeRequestAttributesGetter authorizer.Authorizer }
AuthInterface contains all methods required by the auth filters
func NewKubeletAuth ¶ added in v1.2.0
func NewKubeletAuth(authenticator authenticator.Request, authorizerAttributeGetter NodeRequestAttributesGetter, 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 { 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) GetHostname() string SyncLoopHealthCheck(req *http.Request) error 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 ¶ added in v1.2.0
type KubeletAuth struct { // authenticator identifies the user for requests to the Kubelet API authenticator.Request // KubeletRequestAttributesGetter builds authorization.Attributes for a request to the Kubelet API NodeRequestAttributesGetter // authorizer determines whether a given authorization.Attributes is allowed authorizer.Authorizer }
KubeletAuth implements AuthInterface
type NodeRequestAttributesGetter ¶ added in v1.32.0
type NodeRequestAttributesGetter interface {
GetRequestAttributes(u user.Info, r *http.Request) []authorizer.Attributes
}
func NewNodeAuthorizerAttributesGetter ¶ added in v1.5.0
func NewNodeAuthorizerAttributesGetter(nodeName types.NodeName) NodeRequestAttributesGetter
NewNodeAuthorizerAttributesGetter creates a new authorizer.RequestAttributesGetter for the node.
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, kubeCfg *kubeletconfiginternal.KubeletConfiguration) 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) InstallDebugFlagsHandler ¶ added in v1.21.0
InstallDebugFlagsHandler registers the HTTP request patterns for /debug/flags/v endpoint.
func (*Server) InstallDebuggingDisabledHandlers ¶ added in v1.9.0
func (s *Server) InstallDebuggingDisabledHandlers()
InstallDebuggingDisabledHandlers registers the HTTP request patterns that provide better error message
func (*Server) InstallDebuggingHandlers ¶ added in v1.2.0
func (s *Server) InstallDebuggingHandlers()
InstallDebuggingHandlers 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) InstallProfilingHandler ¶ added in v1.21.0
func (s *Server) InstallProfilingHandler(enableProfilingLogHandler bool, enableContentionProfiling bool)
InstallProfilingHandler registers the HTTP request patterns for /debug/pprof endpoint.
func (*Server) InstallSystemLogHandler ¶ added in v1.19.0
InstallSystemLogHandler registers the HTTP request patterns for logs endpoint.
func (*Server) InstallTracingFilter ¶ added in v1.25.0
func (s *Server) InstallTracingFilter(tp oteltrace.TracerProvider, opts ...otelrestful.Option)
InstallTracingFilter installs OpenTelemetry tracing filter with the restful Container.