runtime

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 15 Imported by: 55

Documentation

Overview

Package runtime provides the kubeadm container runtime implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectCRISocket added in v1.14.0

func DetectCRISocket() (string, error)

DetectCRISocket uses a list of known CRI sockets to detect one. If more than one or none is discovered, an error is returned.

Types

type CRIRuntime

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

CRIRuntime is a struct that interfaces with the CRI

func (*CRIRuntime) Close added in v1.35.0

func (runtime *CRIRuntime) Close()

Close closes the connections to the runtime and image services.

func (*CRIRuntime) Connect added in v1.31.0

func (runtime *CRIRuntime) Connect() error

Connect establishes a connection with the CRI runtime.

func (*CRIRuntime) ImageExists

func (runtime *CRIRuntime) ImageExists(image string) bool

ImageExists checks to see if the image exists on the system

func (*CRIRuntime) IsRunning

func (runtime *CRIRuntime) IsRunning() error

IsRunning checks if runtime is running.

func (*CRIRuntime) IsRuntimeConfigImplemented added in v1.35.0

func (runtime *CRIRuntime) IsRuntimeConfigImplemented() (bool, error)

IsRuntimeConfigImplemented checks if the container runtime supports the RuntimeConfig gRPC method

func (*CRIRuntime) ListKubeContainers

func (runtime *CRIRuntime) ListKubeContainers() ([]string, error)

ListKubeContainers lists running k8s CRI pods

func (*CRIRuntime) PullImage

func (runtime *CRIRuntime) PullImage(image string) (err error)

PullImage pulls the image

func (*CRIRuntime) PullImagesInParallel added in v1.30.0

func (runtime *CRIRuntime) PullImagesInParallel(images []string, ifNotPresent bool) error

PullImagesInParallel pulls a list of images in parallel

func (*CRIRuntime) RemoveContainers

func (runtime *CRIRuntime) RemoveContainers(containers []string) error

RemoveContainers removes running k8s pods

func (*CRIRuntime) SandboxImage added in v1.27.0

func (runtime *CRIRuntime) SandboxImage() (string, error)

SandboxImage returns the sandbox image used by the container runtime

func (*CRIRuntime) SetImpl added in v1.31.0

func (runtime *CRIRuntime) SetImpl(impl Impl)

SetImpl can be used to set the internal implementation for testing purposes.

type ContainerRuntime

type ContainerRuntime interface {
	Connect() error
	Close()
	SetImpl(Impl)
	IsRunning() error
	ListKubeContainers() ([]string, error)
	RemoveContainers(containers []string) error
	PullImage(image string) error
	PullImagesInParallel(images []string, ifNotPresent bool) error
	ImageExists(image string) bool
	SandboxImage() (string, error)
	IsRuntimeConfigImplemented() (bool, error)
}

ContainerRuntime is an interface for working with container runtimes

func NewContainerRuntime

func NewContainerRuntime(criSocket string) ContainerRuntime

NewContainerRuntime sets up and returns a ContainerRuntime struct

type FakeImpl added in v1.35.0

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

FakeImpl is a fake implementation of the impl interface.

func (*FakeImpl) ImageStatus added in v1.35.0

ImageStatus returns the status of the image.

func (*FakeImpl) ImageStatusReturns added in v1.35.0

func (fake *FakeImpl) ImageStatusReturns(res *v1.ImageStatusResponse, err error)

ImageStatusReturns sets the return values for the ImageStatus method.

func (*FakeImpl) ListPodSandbox added in v1.35.0

ListPodSandbox returns the list of pod sandboxes.

func (*FakeImpl) ListPodSandboxReturns added in v1.35.0

func (fake *FakeImpl) ListPodSandboxReturns(res []*v1.PodSandbox, err error)

ListPodSandboxReturns sets the return values for the ListPodSandbox method.

func (*FakeImpl) NewRemoteImageService added in v1.35.0

func (fake *FakeImpl) NewRemoteImageService(string, time.Duration) (cri.ImageManagerService, error)

NewRemoteImageService returns the new remote image service.

func (*FakeImpl) NewRemoteImageServiceReturns added in v1.35.0

func (fake *FakeImpl) NewRemoteImageServiceReturns(res cri.ImageManagerService, err error)

NewRemoteImageServiceReturns sets the return values for the NewRemoteImageService method.

func (*FakeImpl) NewRemoteRuntimeService added in v1.35.0

func (fake *FakeImpl) NewRemoteRuntimeService(string, time.Duration) (cri.RuntimeService, error)

NewRemoteRuntimeService returns the new remote runtime service.

func (*FakeImpl) NewRemoteRuntimeServiceReturns added in v1.35.0

func (fake *FakeImpl) NewRemoteRuntimeServiceReturns(res cri.RuntimeService, err error)

NewRemoteRuntimeServiceReturns sets the return values for the NewRemoteRuntimeService method.

func (*FakeImpl) PullImage added in v1.35.0

PullImage returns the pull image.

func (*FakeImpl) PullImageReturns added in v1.35.0

func (fake *FakeImpl) PullImageReturns(res string, err error)

PullImageReturns sets the return values for the PullImage method.

func (*FakeImpl) RemovePodSandbox added in v1.35.0

func (fake *FakeImpl) RemovePodSandbox(context.Context, cri.RuntimeService, string) error

RemovePodSandbox removes the pod sandbox.

func (*FakeImpl) RemovePodSandboxReturns added in v1.35.0

func (fake *FakeImpl) RemovePodSandboxReturns(res error)

RemovePodSandboxReturns sets the return values for the RemovePodSandbox method.

func (*FakeImpl) RuntimeConfig added in v1.35.0

RuntimeConfig returns the runtime config.

func (*FakeImpl) RuntimeConfigReturns added in v1.35.0

func (fake *FakeImpl) RuntimeConfigReturns(res *v1.RuntimeConfigResponse, err error)

RuntimeConfigReturns sets the return values for the RuntimeConfig method.

func (*FakeImpl) Status added in v1.35.0

Status returns the status of the runtime.

func (*FakeImpl) StatusReturns added in v1.35.0

func (fake *FakeImpl) StatusReturns(res *v1.StatusResponse, err error)

StatusReturns sets the return values for the Status method.

func (*FakeImpl) StopPodSandbox added in v1.35.0

func (fake *FakeImpl) StopPodSandbox(context.Context, cri.RuntimeService, string) error

StopPodSandbox stops the pod sandbox.

func (*FakeImpl) StopPodSandboxReturns added in v1.35.0

func (fake *FakeImpl) StopPodSandboxReturns(res error)

StopPodSandboxReturns sets the return values for the StopPodSandbox method.

type Impl added in v1.35.0

type Impl interface {
	NewRemoteRuntimeService(endpoint string, connectionTimeout time.Duration) (criapi.RuntimeService, error)
	NewRemoteImageService(endpoint string, connectionTimeout time.Duration) (criapi.ImageManagerService, error)
	RuntimeConfig(ctx context.Context, runtimeService criapi.RuntimeService) (*runtimeapi.RuntimeConfigResponse, error)
	Status(ctx context.Context, runtimeService criapi.RuntimeService, verbose bool) (*runtimeapi.StatusResponse, error)
	ListPodSandbox(ctx context.Context, runtimeService criapi.RuntimeService, filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
	StopPodSandbox(ctx context.Context, runtimeService criapi.RuntimeService, sandboxID string) error
	RemovePodSandbox(ctx context.Context, runtimeService criapi.RuntimeService, podSandboxID string) error
	PullImage(ctx context.Context, imageService criapi.ImageManagerService, image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
	ImageStatus(ctx context.Context, imageService criapi.ImageManagerService, image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error)
}

Impl is an interface for the container runtime implementation.

Jump to

Keyboard shortcuts

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