registry

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagListSortUnknown           TagListSort = -1
	TagListSortUnsorted          TagListSort = 0
	TagListSortLatestFirst       TagListSort = 1
	TagListSortLatestLast        TagListSort = 2
	TagListSortUnsortedString    string      = "unsorted"
	TagListSortLatestFirstString string      = "latest-first"
	TagListSortLatestLastString  string      = "latest-last"
	TagListSortUnknownString     string      = "unknown"
)
View Source
const (
	RateLimitNone    = math.MaxInt32
	RateLimitDefault = 10
)
View Source
const (
	MaxMetadataConcurrency = 20
)

Variables

This section is empty.

Functions

func AddRegistryEndpoint

func AddRegistryEndpoint(ep *RegistryEndpoint) error

AddRegistryEndpoint adds registry endpoint information with the given details

func AddRegistryEndpointFromConfig added in v0.8.0

func AddRegistryEndpointFromConfig(epc RegistryConfiguration) error

func ConfiguredEndpoints added in v0.5.0

func ConfiguredEndpoints() []string

ConfiguredEndpoints returns a list of prefixes that are configured

func LoadRegistryConfiguration

func LoadRegistryConfiguration(path string, clear bool) error

LoadRegistryConfiguration loads a YAML-formatted registry configuration from a given file at path.

func RestoreDefaultRegistryConfiguration added in v0.4.0

func RestoreDefaultRegistryConfiguration()

RestRestoreDefaultRegistryConfiguration restores the registry configuration to the default values.

func SetDefaultRegistry added in v0.12.0

func SetDefaultRegistry(ep *RegistryEndpoint)

SetDefaultRegistry sets a given registry endpoint as the default

func SetRegistryEndpointCredentials

func SetRegistryEndpointCredentials(prefix, credentials string) error

SetRegistryEndpointCredentials allows to change the credentials used for endpoint access for existing RegistryEndpoint configuration

Types

type NewRegistryClient added in v0.4.0

type NewRegistryClient func(*RegistryEndpoint, string, string) (RegistryClient, error)

type RegistryClient added in v0.4.0

type RegistryClient interface {
	NewRepository(nameInRepository string) error
	Tags() ([]string, error)
	ManifestForTag(tagStr string) (distribution.Manifest, error)
	ManifestForDigest(dgst digest.Digest) (distribution.Manifest, error)
	TagMetadata(manifest distribution.Manifest, opts *options.ManifestOptions) (*tag.TagInfo, error)
}

RegistryClient defines the methods we need for querying container registries

func NewClient added in v0.4.0

func NewClient(endpoint *RegistryEndpoint, username, password string) (RegistryClient, error)

NewClient returns a new RegistryClient for the given endpoint information

type RegistryConfiguration

type RegistryConfiguration struct {
	Name        string        `yaml:"name"`
	ApiURL      string        `yaml:"api_url"`
	Ping        bool          `yaml:"ping,omitempty"`
	Credentials string        `yaml:"credentials,omitempty"`
	CredsExpire time.Duration `yaml:"credsexpire,omitempty"`
	TagSortMode string        `yaml:"tagsortmode,omitempty"`
	Prefix      string        `yaml:"prefix,omitempty"`
	Insecure    bool          `yaml:"insecure,omitempty"`
	DefaultNS   string        `yaml:"defaultns,omitempty"`
	Limit       int           `yaml:"limit,omitempty"`
	IsDefault   bool          `yaml:"default,omitempty"`
}

RegistryConfiguration represents a single repository configuration for being unmarshaled from YAML.

type RegistryEndpoint

type RegistryEndpoint struct {
	RegistryName   string
	RegistryPrefix string
	RegistryAPI    string
	Username       string
	Password       string
	Ping           bool
	Credentials    string
	Insecure       bool
	DefaultNS      string
	CredsExpire    time.Duration
	CredsUpdated   time.Time
	TagListSort    TagListSort
	Cache          cache.ImageTagCache
	Limiter        ratelimit.Limiter
	IsDefault      bool
	// contains filtered or unexported fields
}

RegistryEndpoint holds information on how to access any specific registry API endpoint.

func GetDefaultRegistry added in v0.12.0

func GetDefaultRegistry() *RegistryEndpoint

GetDefaultRegistry returns the registry endpoint that is set as default, or nil if no default registry endpoint is set

func GetRegistryEndpoint

func GetRegistryEndpoint(prefix string) (*RegistryEndpoint, error)

GetRegistryEndpoint retrieves the endpoint information for the given prefix

func NewRegistryEndpoint added in v0.12.0

func NewRegistryEndpoint(prefix, name, apiUrl, credentials, defaultNS string, insecure bool, tagListSort TagListSort, limit int, credsExpire time.Duration) *RegistryEndpoint

NewRegistryEndpoint returns an endpoint object with the given configuration pre-populated and a fresh cache.

func (*RegistryEndpoint) DeepCopy added in v0.4.0

func (ep *RegistryEndpoint) DeepCopy() *RegistryEndpoint

DeepCopy copies the endpoint to a new object, but creating a new Cache

func (*RegistryEndpoint) GetTags

func (endpoint *RegistryEndpoint) GetTags(img *image.ContainerImage, regClient RegistryClient, vc *image.VersionConstraint) (*tag.ImageTagList, error)

GetTags returns a list of available tags for the given image

func (*RegistryEndpoint) GetTransport added in v0.11.0

func (ep *RegistryEndpoint) GetTransport() *http.Transport

GetTransport returns a transport object for this endpoint

func (*RegistryEndpoint) SetEndpointCredentials added in v0.4.0

func (ep *RegistryEndpoint) SetEndpointCredentials(kubeClient *kube.KubernetesClient) error

Sets endpoint credentials for this registry from a reference to a K8s secret

type RegistryList

type RegistryList struct {
	Items []RegistryConfiguration `yaml:"registries"`
}

RegistryList contains multiple RegistryConfiguration items

func ParseRegistryConfiguration

func ParseRegistryConfiguration(yamlSource string) (RegistryList, error)

Parses a registry configuration from a YAML input string and returns a list of registries.

type TagListSort added in v0.4.0

type TagListSort int

TagListSort defines how the registry returns the list of tags

func TagListSortFromString added in v0.4.0

func TagListSortFromString(tls string) TagListSort

TagListSortFromString gets the TagListSort value from a given string

func (TagListSort) IsTimeSorted added in v0.4.0

func (tls TagListSort) IsTimeSorted() bool

IsTimeSorted returns whether a tag list is time sorted

func (TagListSort) String added in v0.12.0

func (tls TagListSort) String() string

String returns the string representation of a TagListSort value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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