registry

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 24 Imported by: 2

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

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

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 ImgpkgRoundTripper added in v0.40.0

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

ImgpkgRoundTripper RoundTripper that adds headers to request

func NewImgpkgRoundTripper added in v0.40.0

func NewImgpkgRoundTripper(parent http.RoundTripper, sessionID string) *ImgpkgRoundTripper

NewImgpkgRoundTripper creates a RoundTripper that will add headers to the request

func (*ImgpkgRoundTripper) RoundTrip added in v0.40.0

func (i *ImgpkgRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip changes the request to add headers and calls the parent RoundTrip

type MultiRoundTripperStorage

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

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

func NewMultiRoundTripperStorage

func NewMultiRoundTripperStorage(baseRoundTripper http.RoundTripper) *MultiRoundTripperStorage

NewMultiRoundTripperStorage Creates a struct that holds RoundTripper

func (MultiRoundTripperStorage) BaseRoundTripper

func (r MultiRoundTripperStorage) BaseRoundTripper() http.RoundTripper

BaseRoundTripper retrieves the base RoundTripper used by the store

func (*MultiRoundTripperStorage) CreateRoundTripper

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

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 NoopRoundTripperStorage

type NoopRoundTripperStorage struct{}

NoopRoundTripperStorage does not store any http.RoundTripper

func NewNoopRoundTripperStorage

func NewNoopRoundTripperStorage() *NoopRoundTripperStorage

NewNoopRoundTripperStorage Creates a struct that does not save any RoundTripper

func (NoopRoundTripperStorage) BaseRoundTripper

func (n NoopRoundTripperStorage) BaseRoundTripper() http.RoundTripper

BaseRoundTripper returns nil to all invocations

func (NoopRoundTripperStorage) CreateRoundTripper

CreateRoundTripper does nothing

func (NoopRoundTripperStorage) RoundTripper

RoundTripper returns nil to all invocations

type Opts

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

	IncludeNonDistributableLayers bool

	Username string
	Password string
	Token    string
	Anon     bool

	EnableIaasAuthProviders bool

	ResponseHeaderTimeout time.Duration
	RetryCount            int

	EnvironFunc     func() []string
	ActiveKeychains []auth.IAASKeychain

	SessionID string
}

func (Opts) DeepCopy

func (o Opts) DeepCopy() Opts

DeepCopy the options to a new struct

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

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

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

SimpleRegistry Implements Registry interface

func NewBasicRegistry

func NewBasicRegistry(regOpts ...regremote.Option) (*SimpleRegistry, error)

NewBasicRegistry does not provide any special behavior and all the options as passed as is to the underlying library

func NewSimpleRegistry

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

NewSimpleRegistry Builder for a Simple Registry

func NewSimpleRegistryWithTransport

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

NewSimpleRegistryWithTransport Creates a new Simple Registry using the provided transport

func (SimpleRegistry) CloneWithLogger

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

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

CloneWithSingleAuth produces a copy of this Registry whose keychain has exactly one auth — the one that can be used to access imageRef. If no keychain is explicitly configured on this Registry, the copy is a BasicRegistry. A Registry need to be provided as the first parameter or the function will panic

func (*SimpleRegistry) Digest

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

Digest Retrieve the Digest for an Image reference

func (*SimpleRegistry) FirstImageExists

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

Get Retrieve Image descriptor for an Image reference

func (*SimpleRegistry) Image

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

Image Retrieve the regv1.Image struct for an Image reference

func (*SimpleRegistry) Index

Index Retrieve regv1.ImageIndex struct for an Index reference

func (*SimpleRegistry) ListTags

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

ListTags Retrieve all tags associated with a Repository

func (*SimpleRegistry) MultiWrite

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

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

WriteImage Upload Image to registry

func (*SimpleRegistry) WriteIndex

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

WriteIndex Uploads the Index manifest to the registry

func (*SimpleRegistry) WriteTag

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

WriteTag Tag the referenced Image

type SingleTripperStorage

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

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

func NewSingleTripperStorage

func NewSingleTripperStorage(baseRoundTripper http.RoundTripper) *SingleTripperStorage

NewSingleTripperStorage Creates a struct that holds RoundTripper

func (SingleTripperStorage) BaseRoundTripper

func (r SingleTripperStorage) BaseRoundTripper() http.RoundTripper

BaseRoundTripper retrieves the base RoundTripper used by the store

func (*SingleTripperStorage) CreateRoundTripper

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

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

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

CloneWithLogger Clones the provided registry updating the progress

func (WithProgress) CloneWithSingleAuth

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

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 provides different keychains used in imgpkg
Package auth provides different keychains used in imgpkg
credentialprovider
Package credentialprovider contains helper functions used in auth package
Package credentialprovider contains helper functions used in auth package
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