registry

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RateLimitNone    = math.MaxInt32
	RateLimitDefault = 10
)
View Source
const (
	MaxMetadataConcurrency = 20
)

Variables

This section is empty.

Functions

func AddRegistryEndpoint

func AddRegistryEndpoint(prefix, name, apiUrl, credentials, defaultNS string, insecure bool, tagListSort TagListSort, limit int, credsExpire time.Duration) 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 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 {
	Tags(nameInRepository string) ([]string, error)
	ManifestV1(repository string, reference string) (*schema1.SignedManifest, error)
	ManifestV2(repository string, reference string) (*schema2.DeserializedManifest, error)
	TagMetadata(repository string, manifest distribution.Manifest) (*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"`
}

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
	// contains filtered or unexported fields
}

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

func GetRegistryEndpoint

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

GetRegistryEndpoint retrieves the endpoint information for the given prefix

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) 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

const (
	SortUnsorted    TagListSort = 0
	SortLatestFirst TagListSort = 1
	SortLatestLast  TagListSort = 2
)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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