image

package
v0.19.7 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package image implements functions for manipulating images

Index

Constants

View Source
const LayoutKind = "layout"
View Source
const LocalKind = "docker"
View Source
const RemoteKind = "remote"

Variables

This section is empty.

Functions

func DecodeLabel added in v0.13.1

func DecodeLabel(image imgutil.Image, label string, v interface{}) error

func FromLayoutPath added in v0.17.0

func FromLayoutPath(parentPath string) (v1.Image, string, error)

FromLayoutPath takes a path to a directory (such as <layers>/extended/run) containing a single image in "sparse" OCI layout format, and returns a v1.Image along with the path of the image (such as <layers>/extended/run/sha256:<sha256>) or an error if the image cannot be loaded. The path is helpful for locating the image when we only know the digest of the config, such as for local images.

func GetInsecureOptions added in v0.18.0

func GetInsecureOptions(insecureRegistries []string) []imgutil.ImageOption

GetInsecureOptions returns a list of WithRegistrySetting imageOptions matching the specified imageRef prefix

TODO: This is a temporary solution in order to get insecure registries in other components too TODO: Ideally we should fix the `imgutil.options` struct visibility in order to mock and test the `remote.WithRegistrySetting` TODO: function correctly and use the RegistryHandler everywhere it is needed.

func SyncLabels added in v0.13.1

func SyncLabels(sourceImg imgutil.Image, destImage imgutil.Image, test func(string) bool) error

Types

type DefaultRegistryHandler added in v0.18.0

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

DefaultRegistryHandler is the struct that implements the RegistryHandler methods

func NewRegistryHandler added in v0.18.0

func NewRegistryHandler(keychain authn.Keychain, insecureRegistries []string) *DefaultRegistryHandler

NewRegistryHandler creates a new DefaultRegistryHandler

func (*DefaultRegistryHandler) EnsureReadAccess added in v0.18.0

func (rv *DefaultRegistryHandler) EnsureReadAccess(imageRefs ...string) error

EnsureReadAccess ensures that we can read from the registry

func (*DefaultRegistryHandler) EnsureWriteAccess added in v0.18.0

func (rv *DefaultRegistryHandler) EnsureWriteAccess(imageRefs ...string) error

EnsureWriteAccess ensures that we can write to the registry

type Handler added in v0.17.0

type Handler interface {
	InitImage(imageRef string) (imgutil.Image, error)
	Kind() string
}

Handler wraps initialization of an imgutil image.

imgutil: github.com/buildpacks/imgutil

func NewHandler added in v0.17.0

func NewHandler(docker client.CommonAPIClient, keychain authn.Keychain, layoutDir string, useLayout bool, insecureRegistries []string) Handler

NewHandler creates a new Handler according to the arguments provided, following these rules: - WHEN layoutDir is defined and useLayout is true then it returns a LayoutHandler - WHEN a docker client is provided then it returns a LocalHandler - WHEN an auth.Keychain is provided then it returns a RemoteHandler - Otherwise nil is returned

type LayoutHandler added in v0.17.0

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

func (*LayoutHandler) InitImage added in v0.17.0

func (h *LayoutHandler) InitImage(imageRef string) (imgutil.Image, error)

func (*LayoutHandler) Kind added in v0.17.0

func (h *LayoutHandler) Kind() string

type LocalHandler added in v0.17.0

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

func (*LocalHandler) InitImage added in v0.17.0

func (h *LocalHandler) InitImage(imageRef string) (imgutil.Image, error)

func (*LocalHandler) Kind added in v0.17.0

func (h *LocalHandler) Kind() string

type RegistryHandler added in v0.18.0

type RegistryHandler interface {
	EnsureReadAccess(imageRefs ...string) error
	EnsureWriteAccess(imageRefs ...string) error
}

RegistryHandler takes care of the registry settings and checks

type RemoteHandler added in v0.17.0

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

func (*RemoteHandler) InitImage added in v0.17.0

func (h *RemoteHandler) InitImage(imageRef string) (imgutil.Image, error)

func (*RemoteHandler) Kind added in v0.17.0

func (h *RemoteHandler) Kind() string

Jump to

Keyboard shortcuts

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