image

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultVer effectively defines latest for the semver constraints
	DefaultVer = ">=v0.0.0"
)

Variables

This section is empty.

Functions

func FullTag

func FullTag(d v1beta1.Dependency) string

FullTag returns the full image tag "source:version" of the given dependency

Types

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)
	Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)
	Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)
}

Fetcher defines how we expect to intract with the Image repository.

type LocalFetcher

type LocalFetcher struct{}

LocalFetcher --

func NewLocalFetcher

func NewLocalFetcher() *LocalFetcher

NewLocalFetcher --

func (*LocalFetcher) Fetch

func (r *LocalFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)

Fetch fetches a package image.

func (*LocalFetcher) Head

func (r *LocalFetcher) Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)

Head fetches a package descriptor.

func (*LocalFetcher) Tags

func (r *LocalFetcher) Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)

Tags fetches a package's tags.

type MockFetcher

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

MockFetcher is an image fetcher that returns its configured values.

func NewMockFetcher

func NewMockFetcher(opts ...MockOption) *MockFetcher

NewMockFetcher constructs a new mock fetcher.

func (*MockFetcher) Fetch

func (m *MockFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)

Fetch returns the configured error.

func (*MockFetcher) Head

func (m *MockFetcher) Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)

Head returns the configured error.

func (*MockFetcher) Tags

func (m *MockFetcher) Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)

Tags returns the configured tags or if none exist then error.

type MockOption

type MockOption func(*MockFetcher)

MockOption modifies the mock fetcher.

func WithDescriptor

func WithDescriptor(dsc *v1.Descriptor) MockOption

WithDescriptor sets the descriptor for the mock fetcher.

func WithError

func WithError(err error) MockOption

WithError sets the error for the mock fetcher.

func WithImage

func WithImage(img v1.Image) MockOption

WithImage sets the image for the mock fetcher.

func WithTags

func WithTags(tags []string) MockOption

WithTags sets the tags for the mock fetcher.

type Resolver

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

Resolver --

func NewResolver

func NewResolver(opts ...ResolverOption) *Resolver

NewResolver returns a new Resolver.

func (*Resolver) ResolveDigest

func (r *Resolver) ResolveDigest(ctx context.Context, d v1beta1.Dependency) (string, error)

ResolveDigest performs a head request to the configured registry in order to determine if the provided version corresponds to a real tag and what the digest of that tag is.

func (*Resolver) ResolveImage

func (r *Resolver) ResolveImage(ctx context.Context, dep v1beta1.Dependency) (string, v1.Image, error)

ResolveImage resolves the image corresponding to the given v1beta1.Dependency.

func (*Resolver) ResolveTag

func (r *Resolver) ResolveTag(ctx context.Context, dep v1beta1.Dependency) (string, error)

ResolveTag resolves the tag corresponding to the given v1beta1.Dependency. TODO(@tnthornton) add a test that flexes resolving constraint versions to the expected target version

type ResolverOption

type ResolverOption func(*Resolver)

ResolverOption modifies the image resolver.

func WithFetcher

func WithFetcher(f Fetcher) ResolverOption

WithFetcher modifies the Resolver and adds the given fetcher.

Jump to

Keyboard shortcuts

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