server

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Overview

Package server contains the kwok server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.2.0

type Config struct {
	TypedKwokClient versioned.Interface
	EnableCRDs      []string

	ClusterPortForwards   []*internalversion.ClusterPortForward
	PortForwards          []*internalversion.PortForward
	ClusterExecs          []*internalversion.ClusterExec
	Execs                 []*internalversion.Exec
	ClusterLogs           []*internalversion.ClusterLogs
	Logs                  []*internalversion.Logs
	ClusterAttaches       []*internalversion.ClusterAttach
	Attaches              []*internalversion.Attach
	ClusterResourceUsages []*internalversion.ClusterResourceUsage
	ResourceUsages        []*internalversion.ResourceUsage
	Metrics               []*internalversion.Metric

	DataSource      DataSource
	NodeCacheGetter informer.Getter[*corev1.Node]
	PodCacheGetter  informer.Getter[*corev1.Pod]
}

Config holds configurations needed by the server handlers.

type DataSource added in v0.4.0

type DataSource interface {
	metrics.DataSource
	ListNodes() []string
	StartedContainersTotal(nodeName string) int64
}

DataSource is the interface that provides data for the server handlers.

type Server

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

Server is a server that can serve HTTP/HTTPS requests.

func NewServer

func NewServer(conf Config) (*Server, error)

NewServer creates a new Server.

func (*Server) AttachContainer

func (s *Server) AttachContainer(ctx context.Context, name string, uid types.UID, containerName string, in io.Reader, out, errOut io.WriteCloser, tty bool, resize <-chan remotecommandclient.TerminalSize) error

AttachContainer attaches to a container in a pod, copying data between in/out/err and the container's stdin/stdout/stderr.

func (*Server) ExecInContainer

func (s *Server) ExecInContainer(ctx context.Context, name string, uid types.UID, container string, cmd []string, in io.Reader, out, errOut io.WriteCloser, tty bool, resize <-chan remotecommandclient.TerminalSize, timeout time.Duration) error

ExecInContainer executes a command in a container.

func (*Server) GetContainerLogs

func (s *Server) GetContainerLogs(ctx context.Context, podName, podNamespace, container string, logOptions *corev1.PodLogOptions, stdout, stderr io.Writer) error

GetContainerLogs returns logs for a container in a pod. If follow is true, it streams the logs until the connection is closed by the client.

func (*Server) InstallCRD added in v0.4.0

func (s *Server) InstallCRD(ctx context.Context) error

InstallCRD installs the CRD resources

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 provide debugging functionality

func (*Server) InstallHealthz

func (s *Server) InstallHealthz()

InstallHealthz installs the healthz handler.

func (*Server) InstallMetrics

func (s *Server) InstallMetrics(ctx context.Context) error

InstallMetrics registers the metrics handler on the given mux.

func (*Server) InstallProfilingHandler

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

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

func (*Server) InstallServiceDiscovery added in v0.4.0

func (s *Server) InstallServiceDiscovery()

InstallServiceDiscovery installs the service discovery handler.

func (*Server) PortForward

func (s *Server) PortForward(ctx context.Context, name string, uid types.UID, port int32, stream io.ReadWriteCloser) error

PortForward handles a port forwarding request.

func (*Server) Run

func (s *Server) Run(ctx context.Context, address string, certFile, privateKeyFile string) error

Run runs the specified Server. This should never exit.

Jump to

Keyboard shortcuts

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