registry

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package registry provides facilities for reading/writing v1.Images,Indexes from/to a remote image registry. Also exposes an implementation of the authn.Keychain interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keychain

func Keychain(keychainOpts auth.KeychainOpts, environFunc func() []string) (regauthn.Keychain, error)

Keychain implements an authn.Keychain interface by composing multiple keychains. It enforces an order, where the keychains that contain credentials for a specific target take precedence over keychains that contain credentials for 'any' target. i.e. env keychain takes precedence over the custom keychain. Since env keychain contains credentials per HOSTNAME, and custom keychain doesn't.

Types

type ImagesReader added in v0.23.0

type ImagesReader interface {
	Get(regname.Reference) (*regremote.Descriptor, error)
	Digest(regname.Reference) (regv1.Hash, error)
	Index(regname.Reference) (regv1.ImageIndex, error)
	Image(regname.Reference) (regv1.Image, error)
	FirstImageExists(digests []string) (string, error)
}

ImagesReader Interface for Reading Images

type ImagesReaderWriter added in v0.23.0

type ImagesReaderWriter interface {
	ImagesReader
	MultiWrite(imageOrIndexesToUpload map[regname.Reference]regremote.Taggable, concurrency int, updatesCh chan regv1.Update) error
	WriteImage(regname.Reference, regv1.Image, chan regv1.Update) error
	WriteIndex(regname.Reference, regv1.ImageIndex) error
	WriteTag(regname.Tag, regremote.Taggable) error

	CloneWithSingleAuth(imageRef regname.Tag) (Registry, error)
	CloneWithLogger(logger util.ProgressLogger) Registry
}

ImagesReaderWriter Interface for Reading and Writing Images

type MultiRoundTripperStorage added in v0.28.0

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

MultiRoundTripperStorage Maintains a storage of all the available RoundTripper for different registries and repositories

func NewMultiRoundTripperStorage added in v0.28.0

func NewMultiRoundTripperStorage(baseRoundTripper http.RoundTripper) *MultiRoundTripperStorage

NewMultiRoundTripperStorage Creates a struct that holds RoundTripper

func (MultiRoundTripperStorage) BaseRoundTripper added in v0.28.0

func (r MultiRoundTripperStorage) BaseRoundTripper() http.RoundTripper

BaseRoundTripper retrieves the base RoundTripper used by the store

func (*MultiRoundTripperStorage) CreateRoundTripper added in v0.28.0

func (r *MultiRoundTripperStorage) CreateRoundTripper(reg regname.Registry, auth authn.Authenticator, scope string) (http.RoundTripper, error)

CreateRoundTripper Creates a new RoundTripper scope field has the following format "repository:/org/suborg/repo_name:pull,push"

for more information check https://github.com/distribution/distribution/blob/263da70ea6a4e96f61f7a6770273ec6baac38941/docs/spec/auth/token.md#requesting-a-token

func (*MultiRoundTripperStorage) RoundTripper added in v0.28.0

func (r *MultiRoundTripperStorage) RoundTripper(repo regname.Repository, scope string) http.RoundTripper

RoundTripper Retrieve the RoundTripper to be used for a particular registry and repository or nil if it cannot be found

type Opts

type Opts struct {
	CACertPaths []string
	VerifyCerts bool
	Insecure    bool

	IncludeNonDistributableLayers bool

	Username string
	Password string
	Token    string
	Anon     bool

	ResponseHeaderTimeout time.Duration
	RetryCount            int

	EnvironFunc func() []string
}

type Registry

type Registry interface {
	Get(reference regname.Reference) (*regremote.Descriptor, error)
	Digest(reference regname.Reference) (regv1.Hash, error)
	Index(reference regname.Reference) (regv1.ImageIndex, error)
	Image(reference regname.Reference) (regv1.Image, error)
	FirstImageExists(digests []string) (string, error)

	MultiWrite(imageOrIndexesToUpload map[regname.Reference]regremote.Taggable, concurrency int, updatesCh chan regv1.Update) error
	WriteImage(regname.Reference, regv1.Image, chan regv1.Update) error
	WriteIndex(reference regname.Reference, index regv1.ImageIndex) error
	WriteTag(tag regname.Tag, taggable regremote.Taggable) error

	ListTags(repo regname.Repository) ([]string, error)

	CloneWithSingleAuth(imageRef regname.Tag) (Registry, error)
	CloneWithLogger(logger util.ProgressLogger) Registry
}

Registry Interface to access the registry

type RoundTripperStorage added in v0.26.0

type RoundTripperStorage interface {
	RoundTripper(repo regname.Repository, scope string) http.RoundTripper
	CreateRoundTripper(reg regname.Registry, auth regauthn.Authenticator, scope string) (http.RoundTripper, error)
	BaseRoundTripper() http.RoundTripper
}

RoundTripperStorage Storage of RoundTripper that will be used to talk to the registry

type SimpleRegistry added in v0.23.0

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

SimpleRegistry Implements Registry interface

func NewSimpleRegistry added in v0.23.0

func NewSimpleRegistry(opts Opts) (*SimpleRegistry, error)

NewSimpleRegistry Builder for a Simple Registry

func NewSimpleRegistryWithTransport added in v0.29.0

func NewSimpleRegistryWithTransport(opts Opts, rTripper http.RoundTripper, regOpts ...regremote.Option) (*SimpleRegistry, error)

NewSimpleRegistryWithTransport Creates a new Simple Registry using the provided transport

func (SimpleRegistry) CloneWithLogger added in v0.31.0

func (r SimpleRegistry) CloneWithLogger(_ util.ProgressLogger) Registry

CloneWithLogger Clones the provided registry updating the progress logger to NoTTYLogger that does not display the progress bar

func (SimpleRegistry) CloneWithSingleAuth added in v0.23.0

func (r SimpleRegistry) CloneWithSingleAuth(imageRef regname.Tag) (Registry, error)

CloneWithSingleAuth Clones the provided registry replacing the Keychain with a Keychain that can only authenticate the image provided A Registry need to be provided as the first parameter or the function will panic

func (*SimpleRegistry) Digest added in v0.23.0

func (r *SimpleRegistry) Digest(ref regname.Reference) (regv1.Hash, error)

Digest Retrieve the Digest for an Image reference

func (*SimpleRegistry) FirstImageExists added in v0.23.0

func (r *SimpleRegistry) FirstImageExists(digests []string) (string, error)

FirstImageExists Returns the first of the provided Image Digests that exists in the Registry

func (*SimpleRegistry) Get added in v0.23.0

Get Retrieve Image descriptor for an Image reference

func (*SimpleRegistry) Image added in v0.23.0

func (r *SimpleRegistry) Image(ref regname.Reference) (regv1.Image, error)

Image Retrieve the regv1.Image struct for an Image reference

func (*SimpleRegistry) Index added in v0.23.0

Index Retrieve regv1.ImageIndex struct for an Index reference

func (*SimpleRegistry) ListTags added in v0.23.0

func (r *SimpleRegistry) ListTags(repo regname.Repository) ([]string, error)

ListTags Retrieve all tags associated with a Repository

func (*SimpleRegistry) MultiWrite added in v0.23.0

func (r *SimpleRegistry) MultiWrite(imageOrIndexesToUpload map[regname.Reference]regremote.Taggable, concurrency int, updatesCh chan regv1.Update) error

MultiWrite Upload multiple Images in Parallel to the Registry

func (*SimpleRegistry) WriteImage added in v0.23.0

func (r *SimpleRegistry) WriteImage(ref regname.Reference, img regv1.Image, updatesCh chan regv1.Update) error

WriteImage Upload Image to registry

func (*SimpleRegistry) WriteIndex added in v0.23.0

func (r *SimpleRegistry) WriteIndex(ref regname.Reference, idx regv1.ImageIndex) error

WriteIndex Uploads the Index manifest to the registry

func (*SimpleRegistry) WriteTag added in v0.23.0

func (r *SimpleRegistry) WriteTag(ref regname.Tag, taggagle regremote.Taggable) error

WriteTag Tag the referenced Image

type SingleTripperStorage added in v0.28.0

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

SingleTripperStorage Maintains a storage of all the available RoundTripper for different registries and repositories

func NewSingleTripperStorage added in v0.28.0

func NewSingleTripperStorage(baseRoundTripper http.RoundTripper) *SingleTripperStorage

NewSingleTripperStorage Creates a struct that holds RoundTripper

func (SingleTripperStorage) BaseRoundTripper added in v0.28.0

func (r SingleTripperStorage) BaseRoundTripper() http.RoundTripper

BaseRoundTripper retrieves the base RoundTripper used by the store

func (*SingleTripperStorage) CreateRoundTripper added in v0.28.0

func (r *SingleTripperStorage) CreateRoundTripper(reg regname.Registry, auth authn.Authenticator, scope string) (http.RoundTripper, error)

CreateRoundTripper Creates a new RoundTripper scope field has the following format "repository:/org/suborg/repo_name:pull,push"

for more information check https://github.com/distribution/distribution/blob/263da70ea6a4e96f61f7a6770273ec6baac38941/docs/spec/auth/token.md#requesting-a-token

func (*SingleTripperStorage) RoundTripper added in v0.28.0

RoundTripper Retrieve the RoundTripper to be used for a particular registry and repository or nil if it cannot be found

type WithProgress

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

WithProgress Implements Registry interface and provides progress updates to the logger

func NewRegistryWithProgress

func NewRegistryWithProgress(reg Registry, logger util.ProgressLogger) *WithProgress

func (WithProgress) CloneWithLogger added in v0.31.0

func (w WithProgress) CloneWithLogger(logger util.ProgressLogger) Registry

CloneWithLogger Clones the provided registry updating the progress

func (WithProgress) CloneWithSingleAuth added in v0.23.0

func (w WithProgress) CloneWithSingleAuth(imageRef regname.Tag) (Registry, error)

CloneWithSingleAuth Clones the provided registry replacing the Keychain with a Keychain that can only authenticate the image provided A Registry need to be provided as the first parameter or the function will panic

func (*WithProgress) Digest

func (w *WithProgress) Digest(reference regname.Reference) (regv1.Hash, error)

Digest Retrieve the Digest for an Image reference

func (*WithProgress) FirstImageExists

func (w *WithProgress) FirstImageExists(digests []string) (string, error)

FirstImageExists Returns the first of the provided Image Digests that exists in the Registry

func (*WithProgress) Get

func (w *WithProgress) Get(reference regname.Reference) (*remote.Descriptor, error)

Get Retrieve Image descriptor for an Image reference

func (*WithProgress) Image

func (w *WithProgress) Image(reference regname.Reference) (regv1.Image, error)

Image Retrieve the regv1.Image struct for an Image reference

func (*WithProgress) Index

func (w *WithProgress) Index(reference regname.Reference) (regv1.ImageIndex, error)

Index Retrieve regv1.ImageIndex struct for an Index reference

func (*WithProgress) ListTags added in v0.23.0

func (w *WithProgress) ListTags(repo regname.Repository) ([]string, error)

ListTags Retrieve all tags associated with a Repository

func (*WithProgress) MultiWrite

func (w *WithProgress) MultiWrite(imageOrIndexesToUpload map[regname.Reference]remote.Taggable, concurrency int, _ chan regv1.Update) error

MultiWrite Upload multiple Images in Parallel to the Registry

func (*WithProgress) WriteImage

func (w *WithProgress) WriteImage(reference regname.Reference, image regv1.Image, _ chan regv1.Update) error

WriteImage Upload Image to registry

func (*WithProgress) WriteIndex

func (w *WithProgress) WriteIndex(reference regname.Reference, index regv1.ImageIndex) error

WriteIndex Uploads the Index manifest to the registry

func (*WithProgress) WriteTag

func (w *WithProgress) WriteTag(tag regname.Tag, taggable remote.Taggable) error

WriteTag Tag the referenced Image

Directories

Path Synopsis
Package auth contains authentication methods to talk to the registry
Package auth contains authentication methods to talk to the registry
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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