kubernetes

package
v0.0.0-...-721006d Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

Container wraps a Kubernetes container in the common runtime container interface. Note that standalone containers do not exist in Kubernetes; all containers are wrapped in a pod.

func (*Container) Info

Info returns a container's details.

func (*Container) Logs

func (c *Container) Logs(ctx context.Context, since time.Time) (logging.LogReader, error)

Logs returns logging.LogReader which can be used to read log messages starting at the given time (inclusive). Set time to zero to read the full log.

func (*Container) Name

func (c *Container) Name() string

Name returns the container's unique ID.

func (*Container) Remove

func (c *Container) Remove(ctx context.Context) error

Remove removes a pod with no grace period.

func (*Container) Start

func (c *Container) Start(ctx context.Context) error

Start does nothing on Kubernetes since containers are automatically started on creation.

func (*Container) Stats

Stats scrapes stats information about the container and returns it. This includes information about memory, cpu, network and block IO.

func (*Container) Stop

func (c *Container) Stop(ctx context.Context, timeout *time.Duration) error

Stop sends a SIGTERM to a container to instruct it to exit. If a timeout is provided and elapses, the container is forcibly stopped with SIGKILL.

type Runtime

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

Runtime wraps the Kubernetes runtime in a common interface. The runtime must be used from within Kubernetes cluster. All methods are scoped to the current node.

func NewInClusterRuntime

func NewInClusterRuntime(ctx context.Context, namespace string, node string) (*Runtime, error)

NewInClusterRuntime creates a new Kubernetes-backed Runtime from a process running in a Kubernetes cluster. The runtime is scoped to the current node.

func (*Runtime) Close

func (r *Runtime) Close() error

Close implements the io.Closer interface.

func (*Runtime) CreateContainer

func (r *Runtime) CreateContainer(
	ctx context.Context,
	opts *runtime.ContainerOpts,
) (runtime.Container, error)

CreateContainer creates a new container. The container is started implicitly.

func (*Runtime) ListContainers

func (r *Runtime) ListContainers(ctx context.Context) ([]runtime.Container, error)

ListContainers enumerates all containers.

func (*Runtime) PullImage

func (r *Runtime) PullImage(
	ctx context.Context,
	image *runtime.DockerImage,
	policy runtime.PullPolicy,
	quiet bool,
) error

PullImage is a no-op on Kubernetes; images are pulled implicitly on container creation.

Jump to

Keyboard shortcuts

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