images

package
v2.0.0-rc.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAuth

func ParseAuth(auth *runtime.AuthConfig, host string) (string, string, error)

ParseAuth parses AuthConfig and returns username and password/secret required by containerd.

Types

type CRIImageService

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

func NewService

func NewService(config criconfig.ImageConfig, options *CRIImageServiceOptions) (*CRIImageService, error)

NewService creates a new CRI Image Service

TODO:

  1. Generalize the image service and merge with a single higher level image service
  2. Update the options to remove client and imageFSPath - Platform configuration with Array/Map of snapshotter names + filesystem ID + platform matcher + runtime to snapshotter - Transfer service implementation - Image Service (from metadata) - Content store (from metadata)
  3. Separate image cache and snapshot cache to first class plugins, make the snapshot cache much more efficient and intelligent

func (*CRIImageService) CheckImages

func (c *CRIImageService) CheckImages(ctx context.Context) error

LoadImages checks all existing images to ensure they are ready to be used for CRI. It may try to recover images which are not ready but will only log errors, not return any.

func (*CRIImageService) GRPCService

func (c *CRIImageService) GRPCService() runtime.ImageServiceServer

GRPCService returns a new CRI Image Service grpc server.

func (*CRIImageService) GetImage

func (c *CRIImageService) GetImage(id string) (imagestore.Image, error)

GetImage gets image metadata by image id.

func (*CRIImageService) GetSnapshot

func (c *CRIImageService) GetSnapshot(key, snapshotter string) (snapshotstore.Snapshot, error)

GetSnapshot returns the snapshot with specified key.

func (*CRIImageService) ImageFSPaths

func (c *CRIImageService) ImageFSPaths() map[string]string

func (*CRIImageService) ImageFsInfo

ImageFsInfo returns information of the filesystem that is used to store images. TODO(windows): Usage for windows is always 0 right now. Support this for windows. TODO(random-liu): Handle storage consumed by content store

func (*CRIImageService) ImageStatus

ImageStatus returns the status of the image, returns nil if the image isn't present. TODO(random-liu): We should change CRI to distinguish image id and image spec. (See kubernetes/kubernetes#46255)

func (*CRIImageService) LocalResolve

func (c *CRIImageService) LocalResolve(refOrID string) (imagestore.Image, error)

LocalResolve resolves image reference locally and returns corresponding image metadata. It returns errdefs.ErrNotFound if the reference doesn't exist.

func (*CRIImageService) PinnedImage

func (c *CRIImageService) PinnedImage(name string) string

PinnedImage is used to lookup a pinned image by name. Most often used to get the "sandbox" image.

func (*CRIImageService) PullImage

func (c *CRIImageService) PullImage(ctx context.Context, name string, credentials func(string) (string, string, error), sandboxConfig *runtime.PodSandboxConfig, runtimeHandler string) (_ string, err error)

func (*CRIImageService) RemoveImage

func (c *CRIImageService) RemoveImage(ctx context.Context, imageSpec *runtime.ImageSpec) error

func (*CRIImageService) RuntimeSnapshotter

func (c *CRIImageService) RuntimeSnapshotter(ctx context.Context, ociRuntime criconfig.Runtime) string

RuntimeSnapshotter overrides the default snapshotter if Snapshotter is set for this runtime. See https://github.com/containerd/containerd/issues/6657 TODO: Pass in name and get back runtime platform

func (*CRIImageService) UpdateImage

func (c *CRIImageService) UpdateImage(ctx context.Context, r string) error

updateImage updates image store to reflect the newest state of an image reference in containerd. If the reference is not managed by the cri plugin, the function also generates necessary metadata for the image and make it managed.

type CRIImageServiceOptions

type CRIImageServiceOptions struct {
	Content content.Store

	Images images.Store

	ImageFSPaths map[string]string

	RuntimePlatforms map[string]ImagePlatform

	Snapshotters map[string]snapshots.Snapshotter

	Client imageClient
}

type GRPCCRIImageService

type GRPCCRIImageService struct {
	*CRIImageService
}

func (*GRPCCRIImageService) ListImages

ListImages lists existing images. TODO(random-liu): Add image list filters after CRI defines this more clear, and kubelet actually needs it.

func (*GRPCCRIImageService) PullImage

PullImage pulls an image with authentication config.

func (*GRPCCRIImageService) RemoveImage

RemoveImage removes the image. TODO(random-liu): Update CRI to pass image reference instead of ImageSpec. (See kubernetes/kubernetes#46255) TODO(random-liu): We should change CRI to distinguish image id and image spec. Remove the whole image no matter the it's image id or reference. This is the semantic defined in CRI now.

type ImagePlatform

type ImagePlatform struct {
	Snapshotter string
	Platform    platforms.Platform
}

Jump to

Keyboard shortcuts

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