images

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const NoDefaultRegistry = "xxx-no-reg"

Variables

View Source
var (
	DigestPattern = regexp.MustCompile(`^sha256:[a-f\d]{64}$`)
)

Functions

func FindImageMatch

func FindImageMatch(images apiv1.ImageList, search string) (*apiv1.Image, string, error)

findImageMatch matches images by digest, digest prefix, or tag name:

- digest (raw): sha256:<digest> or <digest> (exactly 64 chars) - digest (image): <registry>/<repo>@sha256:<digest> or <repo>@sha256:<digest> - digest prefix: sha256:<digest prefix> (min. 3 chars) - tag name: <registry>/<repo>:<tag> or <repo>:<tag> - tag name (with default): <registry>/<repo> or <repo> -> Will be matched against the default tag (:latest)

  • Note: if we get some string here, that matches the SHAPermissivePrefixPattern, it could be both a digest or a name without a tag so we will try to match it against the default tag (:latest) first and if that fails, we treat it as a digest(-prefix)

func ForwardUpdates

func ForwardUpdates(progress chan<- ImageProgress, updates chan SimpleUpdate)

func GetAuthenticationRemoteOptions

func GetAuthenticationRemoteOptions(ctx context.Context, client client.Reader, namespace string, additionalOpts ...remote.Option) ([]remote.Option, error)

func GetAuthenticationRemoteOptionsWithLocalAuth

func GetAuthenticationRemoteOptionsWithLocalAuth(ctx context.Context, registry authn.Resource, localAuth *apiv1.RegistryAuth, client client.Reader, namespace string, additionalOpts ...remote.Option) ([]remote.Option, error)

func GetImageReference

func GetImageReference(ctx context.Context, c client.Reader, namespace, image string) (imagename.Reference, error)

func GetRuntimePullableImageReference

func GetRuntimePullableImageReference(ctx context.Context, c client.Reader, namespace, image string) (imagename.Reference, error)

GetRuntimePullableImageReference is similar to GetImageReference but will return 127.0.0.1:NODEPORT instead of registry.acorn-image-system.svc.cluster.local:5000, only use this method if you are passing the image string to a PodSpec that will be pulled by the container runtime, otherwise use GetImageReference if you will be pulling the image from the apiserver/controller

func ImageDigest

func ImageDigest(ctx context.Context, c client.Reader, namespace, image string, opts ...remote.Option) (string, error)

func IsImageRemote

func IsImageRemote(ctx context.Context, c client.Reader, namespace, image string, noDefaultRegistry bool, opts ...remote.Option) bool

IsImageRemote checks the remote registry to see if the given image name exists. If noDefaultRegistry is true, and the image does not have a specified registry, this function will return false without attempting to check any remote registries.

func ListTags

func ListTags(ctx context.Context, c client.Reader, namespace, image string, opts ...remote.Option) (imagename.Reference, []string, error)

func ParseReferenceNoDefault

func ParseReferenceNoDefault(name string) (imagename.Reference, error)

func PullAppImage

func PullAppImage(ctx context.Context, c client.Client, namespace, image, nestedDigest string, opts ...remote.Option) (*v1.AppImage, error)

func RemoteWrite

func RemoteWrite(progress chan<- SimpleUpdate, destRef name.Reference, source any, description string, postWriteFn func() error, opts ...remote.Option)

func ResolveTag

func ResolveTag(tag imagename.Reference, image string) string

func ResolveTagForApp

func ResolveTagForApp(ctx context.Context, c client.Client, app *v1.AppInstance, image string) (string, error)

Types

type AppImageWithData

type AppImageWithData struct {
	AppImage   *v1.AppImage `json:"appImage,omitempty"`
	Readme     []byte       `json:"readme,omitempty"`
	Icon       []byte       `json:"icon,omitempty"`
	IconSuffix string       `json:"iconSuffix,omitempty"`
}

func PullAppImageWithDataFiles

func PullAppImageWithDataFiles(ctx context.Context, c client.Client, namespace, image, nestedDigest string, opts ...remote.Option) (*AppImageWithData, error)

type ErrImageIdentifierNotUnique

type ErrImageIdentifierNotUnique struct {
	ImageSearch string
}

func (ErrImageIdentifierNotUnique) Error

type ErrImageNotFound

type ErrImageNotFound struct {
	ImageSearch string
}

func (ErrImageNotFound) Error

func (e ErrImageNotFound) Error() string

type ImageProgress

type ImageProgress struct {
	Total       int64  `json:"total,omitempty"`
	Complete    int64  `json:"complete,omitempty"`
	Error       string `json:"error,omitempty"`
	CurrentTask string `json:"currentTask,omitempty"`
}

type SimpleKeychain

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

func NewSimpleKeychain

func NewSimpleKeychain(resource authn.Resource, auth apiv1.RegistryAuth, next authn.Keychain) *SimpleKeychain

func (*SimpleKeychain) Authorization

func (s *SimpleKeychain) Authorization() (*authn.AuthConfig, error)

func (*SimpleKeychain) Resolve

func (s *SimpleKeychain) Resolve(resource authn.Resource) (authn.Authenticator, error)

type SimpleUpdate

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

Jump to

Keyboard shortcuts

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