virtual-kubelet: Index | Files

package api

import ""

Package api implements HTTP handlers for handling requests that the kubelet would normally implement, such as pod logs, exec, etc.


Package Files

doc.go exec.go helpers.go logs.go pods.go server.go stats.go

func AttachPodMetricsRoutes Uses

func AttachPodMetricsRoutes(p PodMetricsConfig, mux ServeMux)

AttachPodMetricsRoutes adds the http routes for pod/node metrics to the passed in serve mux.

Callers should take care to namespace the serve mux as they see fit, however these routes get called by the Kubernetes API server.

func AttachPodRoutes Uses

func AttachPodRoutes(p PodHandlerConfig, mux ServeMux, debug bool)

AttachPodRoutes adds the http routes for pod stuff to the passed in serve mux.

Callers should take care to namespace the serve mux as they see fit, however these routes get called by the Kubernetes API server.

func HandleContainerExec Uses

func HandleContainerExec(h ContainerExecHandlerFunc) http.HandlerFunc

HandleContainerExec makes an http handler func from a Provider which execs a command in a pod's container Note that this handler currently depends on gorrilla/mux to get url parts as variables. TODO(@cpuguy83): don't force gorilla/mux on consumers of this function

func HandleContainerLogs Uses

func HandleContainerLogs(h ContainerLogsHandlerFunc) http.HandlerFunc

HandleContainerLogs creates an http handler function from a provider to serve logs from a pod

func HandlePodStatsSummary Uses

func HandlePodStatsSummary(h PodStatsSummaryHandlerFunc) http.HandlerFunc

HandlePodStatsSummary makes an HTTP handler for implementing the kubelet summary stats endpoint

func HandleRunningPods Uses

func HandleRunningPods(getPods PodListerFunc) http.HandlerFunc

func InstrumentHandler Uses

func InstrumentHandler(h http.Handler) http.Handler

InstrumentHandler wraps an http.Handler and injects instrumentation into the request context.

func NotFound Uses

func NotFound(w http.ResponseWriter, r *http.Request)

NotFound provides a handler for cases where the requested endpoint doesn't exist

func NotImplemented Uses

func NotImplemented(w http.ResponseWriter, r *http.Request)

NotImplemented provides a handler for cases where a provider does not implement a given API

func PodHandler Uses

func PodHandler(p PodHandlerConfig, debug bool) http.Handler

PodHandler creates an http handler for interacting with pods/containers.

func PodStatsSummaryHandler Uses

func PodStatsSummaryHandler(f PodStatsSummaryHandlerFunc) http.Handler

PodStatsSummaryHandler creates an http handler for serving pod metrics.

If the passed in handler func is nil this will create handlers which only

serves http.StatusNotImplemented

type AttachIO Uses

type AttachIO interface {
    Stdin() io.Reader
    Stdout() io.WriteCloser
    Stderr() io.WriteCloser
    TTY() bool
    Resize() <-chan TermSize

AttachIO is used to pass in streams to attach to a container process

type ContainerExecHandlerFunc Uses

type ContainerExecHandlerFunc func(ctx context.Context, namespace, podName, containerName string, cmd []string, attach AttachIO) error

ContainerExecHandlerFunc defines the handler function used for "execing" into a container in a pod.

type ContainerLogOpts Uses

type ContainerLogOpts struct {
    Tail       int
    Since      time.Duration
    LimitBytes int
    Timestamps bool

ContainerLogOpts are used to pass along options to be set on the container log stream.

type ContainerLogsHandlerFunc Uses

type ContainerLogsHandlerFunc func(ctx context.Context, namespace, podName, containerName string, opts ContainerLogOpts) (io.ReadCloser, error)

ContainerLogsHandlerFunc is used in place of backend implementations for getting container logs

type PodHandlerConfig Uses

type PodHandlerConfig struct {
    RunInContainer   ContainerExecHandlerFunc
    GetContainerLogs ContainerLogsHandlerFunc
    GetPods          PodListerFunc

type PodListerFunc Uses

type PodListerFunc func(context.Context) ([]*v1.Pod, error)

type PodMetricsConfig Uses

type PodMetricsConfig struct {
    GetStatsSummary PodStatsSummaryHandlerFunc

PodMetricsConfig stores the handlers for pod metrics routes It is used by AttachPodMetrics.

The main reason for this struct is in case of expansion we do not need to break the package level API.

type PodStatsSummaryHandlerFunc Uses

type PodStatsSummaryHandlerFunc func(context.Context) (*stats.Summary, error)

PodStatsSummaryHandlerFunc defines the handler for getting pod stats summaries

type ServeMux Uses

type ServeMux interface {
    Handle(path string, h http.Handler)

ServeMux defines an interface used to attach routes to an existing http serve mux. It is used to enable callers creating a new server to completely manage their own HTTP server while allowing us to attach the required routes to satisfy the Kubelet HTTP interfaces.

type TermSize Uses

type TermSize struct {
    Width  uint16
    Height uint16

TermSize is used to set the terminal size from attached clients.

Package api imports 21 packages (graph) and is imported by 16 packages. Updated 2019-09-25. Refresh now. Tools for package owners.