image

package
v0.30.19 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationImageReferenceName = "org.opencontainers.image.ref.name"
	AnnotationImageShortTag      = "io.deckhouse.image.short_tag"
)

Variables

View Source
var ErrImageMetaNotFound = fmt.Errorf("image metadata not found")

Functions

func SplitImageRefByRepoAndTag

func SplitImageRefByRepoAndTag(imageReferenceString string) (string, string)

Types

type Image

type Image struct {
	v1.Image
	// contains filtered or unexported fields
}

func NewImage

func NewImage(img v1.Image, opts ...ImageOption) (*Image, error)

func (*Image) Extract

func (i *Image) Extract() io.ReadCloser

Extract flattens the image to a single layer and returns ReadCloser for fetching the content The repository is determined by the chained WithSegment() calls

func (*Image) GetDigestReference

func (i *Image) GetDigestReference() (string, error)

func (*Image) GetMetadata

func (i *Image) GetMetadata() (pkg.ImageMeta, error)

func (*Image) GetTagReference

func (i *Image) GetTagReference() (string, error)

func (*Image) SetMetadata

func (i *Image) SetMetadata(metadata pkg.ImageMeta)

type ImageLayout

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

func NewImageLayout

func NewImageLayout(path string) (*ImageLayout, error)

func (*ImageLayout) AddImage

func (l *ImageLayout) AddImage(img pkg.RegistryImage, tag string) error

AddImage stores img in the layout under tag.

AddImage is idempotent for the (tag, digest) pair: if a previous call already stored an image with the same tag and the same manifest digest, the second call is a no-op. This matters because layout.Path.AppendImage always appends a new descriptor to index.json — it has no notion of "update in place" — so without this guard, callers that legitimately iterate over the same image set more than once (for example, pulling the deckhouse image set, then merging extra digests discovered from an installer and pulling the union again) would silently produce duplicate descriptors with the same io.deckhouse.image.short_tag annotation. Those duplicates later surface in `mirror push` as the same tag being pushed multiple times.

When the tag already exists but with a different digest, AddImage falls through to AppendImage to preserve the previous re-tag behaviour; the push pipeline deduplicates such cases with last-wins semantics.

func (*ImageLayout) GetImage

func (l *ImageLayout) GetImage(tag string) (pkg.RegistryImage, error)

func (*ImageLayout) GetMeta

func (l *ImageLayout) GetMeta(tag string) (*ImageMeta, error)

func (*ImageLayout) Path

func (l *ImageLayout) Path() layout.Path

func (*ImageLayout) TagImage

func (l *ImageLayout) TagImage(imageDigest v1.Hash, tag string) error

type ImageMeta

type ImageMeta struct {
	TagReference    string
	DigestReference string

	Digest *v1.Hash
}

func NewImageMeta

func NewImageMeta(tagReference string, digestReference string, digest *v1.Hash) *ImageMeta

func (*ImageMeta) GetDigest

func (m *ImageMeta) GetDigest() *v1.Hash

func (*ImageMeta) GetDigestReference

func (m *ImageMeta) GetDigestReference() string

func (*ImageMeta) GetTagReference

func (m *ImageMeta) GetTagReference() string

type ImageOption

type ImageOption func(img *Image)

func WithFetchingMetadata

func WithFetchingMetadata(tagReference string) ImageOption

WithFetchingMetadata enables fetching and filling image metadata (digest, digest reference) during NewImage call

func WithMetadata

func WithMetadata(metadata *ImageMeta) ImageOption

Jump to

Keyboard shortcuts

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