registry

package
v0.0.0-...-00ec399 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegistry = NewPlainRegistry()

Functions

func NewWWWAuthenticateRequest

func NewWWWAuthenticateRequest(wwwAuthenticate string) (string, *http.Request, error)

func RegistryLabeller

func RegistryLabeller(req *http.Request, resp *http.Response) prometheus.Labels

func WithAuthenticator

func WithAuthenticator(authenticator Authenticator) func(*PlainRegistry)

func WithDockerProxies

func WithDockerProxies(proxies []RegistryProxy) func(*PlainRegistry)

func WithRegistryMetricRegistry

func WithRegistryMetricRegistry(reg metrics.RegistererGatherer) func(*PlainRegistry)

func WithSchedulableArchitectures

func WithSchedulableArchitectures(archs []string) func(*PlainRegistry)

func WithTransport

func WithTransport(transport http.RoundTripper) func(*PlainRegistry)

Types

type AnonymousAuthenticator

type AnonymousAuthenticator struct{}

func (AnonymousAuthenticator) Authenticate

func (r AnonymousAuthenticator) Authenticate(ctx context.Context, imagePullSecret, registry, image, tag string, candidates chan AuthenticationToken)

type AuthenticationToken

type AuthenticationToken struct {
	Kind  string
	Token string
}

type Authenticator

type Authenticator interface {
	Authenticate(ctx context.Context, imagePullSecret, registry, image, tag string, candidates chan AuthenticationToken)
}

type AuthenticatorFunc

type AuthenticatorFunc func(ctx context.Context, imagePullSecret, registry, image, tag string, candidates chan AuthenticationToken)

func (AuthenticatorFunc) Authenticate

func (f AuthenticatorFunc) Authenticate(ctx context.Context, imagePullSecret, registry, image, tag string, candidates chan AuthenticationToken)

type Authenticators

type Authenticators []Authenticator

func NewAuthenticator

func NewAuthenticator() Authenticators

func (Authenticators) Authenticate

func (a Authenticators) Authenticate(ctx context.Context, imagePullSecret, registry, image, tag string, candidates chan AuthenticationToken)

type Cache

type Cache[T any] struct {
	CleanUpPeriod time.Duration
	CacheDuration time.Duration
	// contains filtered or unexported fields
}

func NewCache

func NewCache[T any](cacheDuration time.Duration) *Cache[T]

func (*Cache[T]) CleanUp

func (c *Cache[T]) CleanUp(now time.Time)

func (*Cache[T]) Load

func (c *Cache[T]) Load(cacheKey string) (*T, bool)

func (*Cache[T]) LoadOrCall

func (c *Cache[T]) LoadOrCall(cacheKey string, miss func() (T, error)) (T, bool, error)

func (*Cache[T]) Store

func (c *Cache[T]) Store(cacheKey string, value *T, mutations ...func(*CacheEntry[T]))

func (*Cache[T]) WithExpiry

func (c *Cache[T]) WithExpiry(expiry time.Time) func(*CacheEntry[T])

type CacheEntry

type CacheEntry[T any] struct {
	Value  *T
	Expiry time.Time
}

type CacheMetrics

type CacheMetrics struct {
	Requests  *prometheus.CounterVec
	Responses *prometheus.CounterVec
}

func NewCacheMetrics

func NewCacheMetrics(prefix, system string) *CacheMetrics

func (CacheMetrics) MustRegister

func (m CacheMetrics) MustRegister(reg metrics.RegistererGatherer)

type CacheOption

type CacheOption func(*CachedRegistry)

func WithCacheMetricsRegistry

func WithCacheMetricsRegistry(reg metrics.RegistererGatherer) CacheOption

type CachedRegistry

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

func NewCachedRegistry

func NewCachedRegistry(registry Registry, cacheDuration time.Duration, opts ...CacheOption) *CachedRegistry

func (*CachedRegistry) ListArchs

func (cr *CachedRegistry) ListArchs(ctx context.Context, imagePullSecret, image string) ([]Platform, error)

type ContainerDAuthenticator

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

func (ContainerDAuthenticator) Authenticate

func (r ContainerDAuthenticator) Authenticate(ctx context.Context, imagePullSecret, registry, image, tag string, candidates chan AuthenticationToken)

type ContainerdConfig

type ContainerdConfig struct {
	Server string                          `toml:"server"`
	Hosts  map[string]ContainerdHostConfig `toml:"host"`
}

type ContainerdHeader

type ContainerdHeader struct {
	Authorization string `toml:"authorization"`
}

type ContainerdHostConfig

type ContainerdHostConfig struct {
	Capabilities []string         `toml:"capabilities"`
	Header       ContainerdHeader `toml:"header"`
}

type ContainerdServerHeader

type ContainerdServerHeader struct {
	Server string
	Header string
}

type DockerAuth

type DockerAuth struct {
	Auth string `json:"auth"`
}

type DockerAuths

type DockerAuths map[string]DockerAuth

type DockerConfig

type DockerConfig struct {
	Auths      DockerAuths `json:"auths"`
	CredsStore string      `json:"credsStore"`
}

type DockerConfigAuthenticator

type DockerConfigAuthenticator struct {
	KubeletAuthenticator Authenticator
	// contains filtered or unexported fields
}

func (DockerConfigAuthenticator) Authenticate

func (r DockerConfigAuthenticator) Authenticate(ctx context.Context, cfg DockerConfig, registry, image, tag string, candidates chan AuthenticationToken)

type DockerConfigFileAuthenticator

type DockerConfigFileAuthenticator struct {
	DockerConfigAuthenticator
	// contains filtered or unexported fields
}

func (DockerConfigFileAuthenticator) Authenticate

func (r DockerConfigFileAuthenticator) Authenticate(ctx context.Context, imagePullSecret, registry, image, tag string, candidates chan AuthenticationToken)

type ImagePullSecretAuthenticator

type ImagePullSecretAuthenticator struct {
	DockerConfigAuthenticator
}

func (ImagePullSecretAuthenticator) Authenticate

func (r ImagePullSecretAuthenticator) Authenticate(ctx context.Context, imagePullSecret, registry, image, tag string, candidates chan AuthenticationToken)

type PlainRegistry

type PlainRegistry struct {
	Scheme        string
	Transport     http.RoundTripper
	Authenticator Authenticator
	Proxies       []RegistryProxy

	Metrics                  *RegistryMetrics
	SchedulableArchitectures []string
	// contains filtered or unexported fields
}

func NewPlainRegistry

func NewPlainRegistry(builders ...func(*PlainRegistry)) *PlainRegistry

func (*PlainRegistry) ListArchs

func (r *PlainRegistry) ListArchs(ctx context.Context, imagePullSecret, image string) ([]Platform, error)

type Platform

type Platform struct {
	Architecture string `json:"architecture"`
	OS           string `json:"os"`
	Variant      string `json:"variant"`
}

type Registry

type Registry interface {
	ListArchs(ctx context.Context, imagePullSecret, image string) ([]Platform, error)
}

type RegistryFunc

type RegistryFunc func(ctx context.Context, imagePullSecret, image string) ([]Platform, error)

func (RegistryFunc) ListArchs

func (f RegistryFunc) ListArchs(ctx context.Context, imagePullSecret, image string) ([]Platform, error)

type RegistryMetrics

type RegistryMetrics struct {
	Requests           *prometheus.CounterVec
	Errors             *prometheus.CounterVec
	Responses          *prometheus.CounterVec
	RateLimitRemaining *prometheus.GaugeVec
	RateLimitLimit     *prometheus.GaugeVec
	RateLimitWindow    *prometheus.GaugeVec
}

func NewRegistryMetrics

func NewRegistryMetrics(prefix string) *RegistryMetrics

func (RegistryMetrics) MustRegister

func (m RegistryMetrics) MustRegister(reg metrics.RegistererGatherer)

type RegistryProxy

type RegistryProxy struct {
	Registry string
	Proxy    string
}

func ParseRegistryProxies

func ParseRegistryProxies(proxies string) []RegistryProxy

type WWWAuthenticateTransport

type WWWAuthenticateTransport struct {
	Transport http.RoundTripper
	// contains filtered or unexported fields
}

func (*WWWAuthenticateTransport) RoundTrip

func (t *WWWAuthenticateTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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