image

package
v0.5.1-rc.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatePlatformConstraint

func ValidatePlatformConstraint(platformStr string) bool

ValidatePlatformConstraint returns a boolean indicating whether the provided platform constraint string is valid.

Types

type Credentials

type Credentials struct {
	// Username identifies a principal, which combined with the value of the
	// Password field, can be used for reading from some image repository.
	Username string
	// Password, when combined with the principal identified by the Username
	// field, can be used for reading from some image repository.
	Password string
	// contains filtered or unexported fields
}

Credentials represents the credentials for connecting to a private image repository. It implements the distribution/V3/registry/client/auth.CredentialStore interface.

func (Credentials) Basic

func (c Credentials) Basic(*url.URL) (string, string)

Basic implements distribution/V3/registry/client/auth.CredentialStore.

func (Credentials) RefreshToken

func (c Credentials) RefreshToken(_ *url.URL, service string) string

RefreshToken implements distribution/V3/registry/client/auth.CredentialStore.

func (Credentials) SetRefreshToken

func (c Credentials) SetRefreshToken(_ *url.URL, service, token string)

SetRefreshToken implements distribution/V3/registry/client/auth.CredentialStore.

type Image added in v0.4.0

type Image struct {
	Tag       string
	Digest    digest.Digest
	CreatedAt *time.Time
	// contains filtered or unexported fields
}

Image is a representation of a container image.

type SelectionStrategy added in v0.4.0

type SelectionStrategy string

SelectionStrategy represents a strategy for selecting a single image from a container image repository.

const (
	// SelectionStrategyDigest represents an image selection strategy that is
	// useful for finding the digest of a container image that is currently
	// referenced by a mutable tag, e.g. latest. This strategy requires the use of
	// a constraint that must exactly match the name of a, presumably, mutable
	// tag.
	SelectionStrategyDigest SelectionStrategy = "Digest"
	// SelectionStrategyLexical represents an image selection strategy that is
	// useful for finding the the image referenced by the tag that is lexically
	// last among those matched by a regular expression and not explicitly
	// ignored. This strategy is useful for finding the images referenced by the
	// latest in a series of tag that are suffixed with a predictably formatted
	// timestamp.
	SelectionStrategyLexical SelectionStrategy = "Lexical"
	// SelectionStrategyNewestBuild represents an image selection strategy that is
	// useful for finding the image that was most recently pushed to the image
	// repository. This is the least efficient strategy because it can require the
	// retrieval of many manifests from the image repository. It is best to use
	// this strategy with caution and constrain the eligible tags as much as
	// possible using a regular expression.
	SelectionStrategyNewestBuild SelectionStrategy = "NewestBuild"
	// SelectionStrategySemVer represents an image selection strategy that is
	// useful for finding the images referenced by the tag is the highest among
	// tags from the repository that are valid semantic versions. An optional
	// constraint can limit the eligible range of semantic versions.
	SelectionStrategySemVer SelectionStrategy = "SemVer"
)

type Selector added in v0.4.0

type Selector interface {
	// Select selects a single image from a container image repository.
	Select(context.Context) (*Image, error)
}

Selector is an interface for selecting a single image from a container image repository.

func NewSelector added in v0.4.0

func NewSelector(
	repoURL string,
	strategy SelectionStrategy,
	opts *SelectorOptions,
) (Selector, error)

NewSelector returns some implementation of the Selector interface that selects a single image from a container image repository based on a selection strategy and a set of optional constraints.

type SelectorOptions added in v0.4.0

type SelectorOptions struct {
	// Constraint holds a selection strategy-specific value for constraining image
	// selection.
	Constraint string
	// AllowRegex is an optional regular expression that can be used to constrain
	// image selection based on eligible tags.
	AllowRegex string
	// Ignore is an optional list of tags that should explicitly be ignored when
	// selecting an image.
	Ignore []string
	// Platform is an optional platform constraint. If specified, the selected
	// image must match the platform constraint or Selector implementations will
	// return nil a image.
	Platform string
	// Creds holds optional credentials for authenticating to the image
	// repository.
	Creds *Credentials
	// InsecureSkipTLSVerify is an optional flag, that if set to true, will
	// disable verification of the image repository's TLS certificate.
	InsecureSkipTLSVerify bool
}

SelectorOptions represents options for creating a Selector.

Jump to

Keyboard shortcuts

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