imgutil

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 29 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FilterBeforeType    = "before"
	FilterSinceType     = "since"
	FilterLabelType     = "label"
	FilterReferenceType = "reference"
	FilterDanglingType  = "dangling"
)

Filter types supported to filter images.

Functions

func FilterByLabel added in v1.2.1

func FilterByLabel(ctx context.Context, client *containerd.Client, imageList []images.Image, filters map[string]string) ([]images.Image, error)

FilterByLabel filters images based on labels given in `filters`.

func FilterByReference added in v1.2.1

func FilterByReference(imageList []images.Image, filters []string) ([]images.Image, error)

FilterByReference filters images using references given in `filters`.

func FilterDangling added in v1.2.1

func FilterDangling(imageList []images.Image, dangling bool) []images.Image

FilterDangling filters dangling images (or keeps if `dangling` == false).

func FilterImages added in v0.23.0

func FilterImages(labelImages []images.Image, beforeImages []images.Image, sinceImages []images.Image) []images.Image

FilterImages returns images in `labelImages` that are created before MAX(beforeImages.CreatedAt) and after MIN(sinceImages.CreatedAt).

func ParseRepoTag added in v0.9.0

func ParseRepoTag(imgName string) (string, string)

ParseRepoTag parses raw `imgName` to repository and tag.

func ReadImageConfig added in v0.9.0

func ReadImageConfig(ctx context.Context, img containerd.Image) (ocispec.Image, ocispec.Descriptor, error)

ReadImageConfig reads the config spec (`application/vnd.oci.image.config.v1+json`) for img.platform from content store.

func ReadIndex added in v0.13.0

ReadIndex returns image index, or nil for non-indexed image.

func ReadManifest added in v0.13.0

func ReadManifest(ctx context.Context, img containerd.Image) (*ocispec.Manifest, *ocispec.Descriptor, error)

ReadManifest returns the manifest for img.platform, or nil if no manifest was found.

func ResolveDigest added in v0.15.0

func ResolveDigest(ctx context.Context, rawRef string, insecure bool, hostsDirs []string) (string, error)

ResolveDigest resolves `rawRef` and returns its descriptor digest.

func UnpackedImageSize added in v1.2.1

func UnpackedImageSize(ctx context.Context, s snapshots.Snapshotter, img containerd.Image) (int64, error)

UnpackedImageSize is the size of the unpacked snapshots. Does not contain the size of the blobs in the content store. (Corresponds to Docker).

Types

type EnsuredImage

type EnsuredImage struct {
	Ref         string
	Image       containerd.Image
	ImageConfig ocispec.ImageConfig
	Snapshotter string
	Remote      bool // true for stargz or overlaybd
}

EnsuredImage contains the image existed in containerd and its metadata.

func EnsureImage

func EnsureImage(ctx context.Context, client *containerd.Client, stdout, stderr io.Writer, snapshotter, rawRef string, mode PullMode, insecure bool, hostsDirs []string, ocispecPlatforms []ocispec.Platform, unpack *bool, quiet bool, rFlags RemoteSnapshotterFlags) (*EnsuredImage, error)

EnsureImage ensures the image.

When insecure is set, skips verifying certs, and also falls back to HTTP when the registry does not speak HTTPS

FIXME: this func has too many args

func GetExistingImage added in v0.14.0

func GetExistingImage(ctx context.Context, client *containerd.Client, snapshotter, rawRef string, platform ocispec.Platform) (*EnsuredImage, error)

GetExistingImage returns the specified image if exists in containerd. Return errdefs.NotFound() if not exists.

func PullImage added in v0.14.0

func PullImage(ctx context.Context, client *containerd.Client, stdout, stderr io.Writer, snapshotter string, resolver remotes.Resolver, ref string, ocispecPlatforms []ocispec.Platform, unpack *bool, quiet bool, rFlags RemoteSnapshotterFlags) (*EnsuredImage, error)

PullImage pulls an image using the specified resolver.

type Filters added in v1.1.0

type Filters struct {
	Before    []string
	Since     []string
	Labels    map[string]string
	Reference []string
	Dangling  *bool
}

Filters contains all types of filters to filter images.

func ParseFilters added in v0.23.0

func ParseFilters(filters []string) (*Filters, error)

ParseFilters parse filter strings.

type PullMode

type PullMode = string

PullMode is either one of "always", "missing", "never"

type RemoteSnapshotterFlags added in v1.7.1

type RemoteSnapshotterFlags struct {
	SociIndexDigest string
}

Directories

Path Synopsis
Package pull forked from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/content/fetch.go
Package pull forked from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/content/fetch.go
Package push derived from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/images/push.go
Package push derived from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/images/push.go

Jump to

Keyboard shortcuts

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