Documentation
¶
Overview ¶
Package runtime provides the kubeadm container runtime implementation.
Index ¶
- func DetectCRISocket() (string, error)
- type CRIRuntime
- func (runtime *CRIRuntime) Close()
- func (runtime *CRIRuntime) Connect() error
- func (runtime *CRIRuntime) ImageExists(image string) bool
- func (runtime *CRIRuntime) IsRunning() error
- func (runtime *CRIRuntime) IsRuntimeConfigImplemented() (bool, error)
- func (runtime *CRIRuntime) ListKubeContainers() ([]string, error)
- func (runtime *CRIRuntime) PullImage(image string) (err error)
- func (runtime *CRIRuntime) PullImagesInParallel(images []string, ifNotPresent bool) error
- func (runtime *CRIRuntime) RemoveContainers(containers []string) error
- func (runtime *CRIRuntime) SandboxImage() (string, error)
- func (runtime *CRIRuntime) SetImpl(impl Impl)
- type ContainerRuntime
- type FakeImpl
- func (fake *FakeImpl) ImageStatus(context.Context, cri.ImageManagerService, *v1.ImageSpec, bool) (*v1.ImageStatusResponse, error)
- func (fake *FakeImpl) ImageStatusReturns(res *v1.ImageStatusResponse, err error)
- func (fake *FakeImpl) ListPodSandbox(context.Context, cri.RuntimeService, *v1.PodSandboxFilter) ([]*v1.PodSandbox, error)
- func (fake *FakeImpl) ListPodSandboxReturns(res []*v1.PodSandbox, err error)
- func (fake *FakeImpl) NewRemoteImageService(string, time.Duration) (cri.ImageManagerService, error)
- func (fake *FakeImpl) NewRemoteImageServiceReturns(res cri.ImageManagerService, err error)
- func (fake *FakeImpl) NewRemoteRuntimeService(string, time.Duration) (cri.RuntimeService, error)
- func (fake *FakeImpl) NewRemoteRuntimeServiceReturns(res cri.RuntimeService, err error)
- func (fake *FakeImpl) PullImage(context.Context, cri.ImageManagerService, *v1.ImageSpec, *v1.AuthConfig, ...) (string, error)
- func (fake *FakeImpl) PullImageReturns(res string, err error)
- func (fake *FakeImpl) RemovePodSandbox(context.Context, cri.RuntimeService, string) error
- func (fake *FakeImpl) RemovePodSandboxReturns(res error)
- func (fake *FakeImpl) RuntimeConfig(context.Context, cri.RuntimeService) (*v1.RuntimeConfigResponse, error)
- func (fake *FakeImpl) RuntimeConfigReturns(res *v1.RuntimeConfigResponse, err error)
- func (fake *FakeImpl) Status(context.Context, cri.RuntimeService, bool) (*v1.StatusResponse, error)
- func (fake *FakeImpl) StatusReturns(res *v1.StatusResponse, err error)
- func (fake *FakeImpl) StopPodSandbox(context.Context, cri.RuntimeService, string) error
- func (fake *FakeImpl) StopPodSandboxReturns(res error)
- type Impl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectCRISocket ¶ added in v1.14.0
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 ¶
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 ¶
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 ¶
type FakeImpl struct {
// contains filtered or unexported fields
}
FakeImpl is a fake implementation of the impl interface.
func (*FakeImpl) ImageStatus ¶
func (fake *FakeImpl) ImageStatus(context.Context, cri.ImageManagerService, *v1.ImageSpec, bool) (*v1.ImageStatusResponse, error)
ImageStatus returns the status of the image.
func (*FakeImpl) ImageStatusReturns ¶
func (fake *FakeImpl) ImageStatusReturns(res *v1.ImageStatusResponse, err error)
ImageStatusReturns sets the return values for the ImageStatus method.
func (*FakeImpl) ListPodSandbox ¶
func (fake *FakeImpl) ListPodSandbox(context.Context, cri.RuntimeService, *v1.PodSandboxFilter) ([]*v1.PodSandbox, error)
ListPodSandbox returns the list of pod sandboxes.
func (*FakeImpl) ListPodSandboxReturns ¶
func (fake *FakeImpl) ListPodSandboxReturns(res []*v1.PodSandbox, err error)
ListPodSandboxReturns sets the return values for the ListPodSandbox method.
func (*FakeImpl) NewRemoteImageService ¶
NewRemoteImageService returns the new remote image service.
func (*FakeImpl) NewRemoteImageServiceReturns ¶
func (fake *FakeImpl) NewRemoteImageServiceReturns(res cri.ImageManagerService, err error)
NewRemoteImageServiceReturns sets the return values for the NewRemoteImageService method.
func (*FakeImpl) NewRemoteRuntimeService ¶
NewRemoteRuntimeService returns the new remote runtime service.
func (*FakeImpl) NewRemoteRuntimeServiceReturns ¶
func (fake *FakeImpl) NewRemoteRuntimeServiceReturns(res cri.RuntimeService, err error)
NewRemoteRuntimeServiceReturns sets the return values for the NewRemoteRuntimeService method.
func (*FakeImpl) PullImage ¶
func (fake *FakeImpl) PullImage(context.Context, cri.ImageManagerService, *v1.ImageSpec, *v1.AuthConfig, *v1.PodSandboxConfig) (string, error)
PullImage returns the pull image.
func (*FakeImpl) PullImageReturns ¶
PullImageReturns sets the return values for the PullImage method.
func (*FakeImpl) RemovePodSandbox ¶
RemovePodSandbox removes the pod sandbox.
func (*FakeImpl) RemovePodSandboxReturns ¶
RemovePodSandboxReturns sets the return values for the RemovePodSandbox method.
func (*FakeImpl) RuntimeConfig ¶
func (fake *FakeImpl) RuntimeConfig(context.Context, cri.RuntimeService) (*v1.RuntimeConfigResponse, error)
RuntimeConfig returns the runtime config.
func (*FakeImpl) RuntimeConfigReturns ¶
func (fake *FakeImpl) RuntimeConfigReturns(res *v1.RuntimeConfigResponse, err error)
RuntimeConfigReturns sets the return values for the RuntimeConfig method.
func (*FakeImpl) Status ¶
func (fake *FakeImpl) Status(context.Context, cri.RuntimeService, bool) (*v1.StatusResponse, error)
Status returns the status of the runtime.
func (*FakeImpl) StatusReturns ¶
func (fake *FakeImpl) StatusReturns(res *v1.StatusResponse, err error)
StatusReturns sets the return values for the Status method.
func (*FakeImpl) StopPodSandbox ¶
StopPodSandbox stops the pod sandbox.
func (*FakeImpl) StopPodSandboxReturns ¶
StopPodSandboxReturns sets the return values for the StopPodSandbox method.
type Impl ¶
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.