Help us shape the future of Go! Take the 2026 Go Developer Survey

resolver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRetryableClient

func CloneRetryableClient(retryClient *rhttp.Client) *rhttp.Client

CloneRetryableClient returns a clone of a given retryable client with the same set of retry policies and a new concrete http.Client.

func DefaultScheme

func DefaultScheme(host string) string

DefaultScheme returns the default scheme for a registry host.

Copied over from: https://github.com/containerd/containerd/blob/a901236bf00a6d0ef1fe299c9e5ae72a1dd67869/pkg/cri/server/images/image_pull.go#L474 Original Copyright the containerd Authors. Licensed under the Apache License, Version 2.0 (the "License").

func ParseAlphaAuth

func ParseAlphaAuth(auth *runtime_alpha.AuthConfig, host string) (string, string, error)

ParseAlphaAuth parses AuthConfig and returns username and password/secret required by containerd. Ported from https://github.com/containerd/containerd/blob/v1.5.2/pkg/cri/server/image_pull.go#L176-L214 TODO: import this from CRI package once we drop support to continerd v1.4.x

func ParseAuth

func ParseAuth(auth *runtime.AuthConfig, host string) (string, string, error)

ParseAuth parses AuthConfig and returns username and password/secret required by containerd. Ported from https://github.com/containerd/containerd/blob/v1.5.2/pkg/cri/server/image_pull.go#L176-L214 TODO: import this from CRI package once we drop support to continerd v1.4.x

Types

type AuthConfig

type AuthConfig struct {
	// Username is the username to login the registry.
	Username string `toml:"username" json:"username"`
	// Password is the password to login the registry.
	Password string `toml:"password" json:"password"`
	// Auth is a base64 encoded string from the concatenation of the username,
	// a colon, and the password.
	Auth string `toml:"auth" json:"auth"`
	// IdentityToken is used to authenticate the user and get
	// an access token for the registry.
	IdentityToken string `toml:"identitytoken" json:"identitytoken"`
}

AuthConfig contains the config related to authentication to a specific registry

type Credential

type Credential func(imgRefSpec reference.Spec, host string) (string, string, error)

Credential returns a set of credentials for a given image.

type Mirror

type Mirror struct {
	// Endpoints are endpoints for a namespace. CRI plugin will try the endpoints
	// one by one until a working one is found. The endpoint must be a valid url
	// with host specified.
	// The scheme, host and path from the endpoint URL will be used.
	Endpoints []string `toml:"endpoint" json:"endpoint"`
}

Mirror contains the config related to the registry mirror

type Registry

type Registry struct {
	// ConfigPath is a path to the root directory containing registry-specific
	// configurations.
	// If ConfigPath is set, the rest of the registry specific options are ignored.
	ConfigPath string `toml:"config_path" json:"configPath"`
	// Mirrors are namespace to mirror mapping for all namespaces.
	// This option will not be used when ConfigPath is provided.
	// DEPRECATED: Use ConfigPath instead. Remove in containerd 1.7.
	Mirrors map[string]Mirror `toml:"mirrors" json:"mirrors"`
	// Configs are configs for each registry.
	// The key is the domain name or IP of the registry.
	// This option will be fully deprecated for ConfigPath in the future.
	Configs map[string]RegistryConfig `toml:"configs" json:"configs"`
}

Registry is registry settings configured

type RegistryConfig

type RegistryConfig struct {
	// Auth contains information to authenticate to the registry.
	Auth *AuthConfig `toml:"auth" json:"auth"`
	// TLS is a pair of CA/Cert/Key which then are used when creating the transport
	// that communicates with the registry.
	// This field will not be used when ConfigPath is provided.
	// DEPRECATED: Use ConfigPath instead. Remove in containerd 1.7.
	TLS *TLSConfig `toml:"tls" json:"tls"`
}

RegistryConfig contains configuration used to communicate with the registry.

type RegistryHosts

type RegistryHosts func(imgRefSpec reference.Spec) ([]docker.RegistryHost, error)

RegistryHosts returns configurations for registry hosts that provide a given image.

func RegistryHostsFromCRIConfig

func RegistryHostsFromCRIConfig(ctx context.Context, config Registry, credsFuncs ...Credential) RegistryHosts

RegistryHostsFromCRIConfig creates RegistryHosts (a set of registry configuration) from CRI-plugin-compatible config. NOTE: ported from https://github.com/containerd/containerd/blob/v1.5.2/pkg/cri/server/image_pull.go#L332-L405 TODO: import this from CRI package once we drop support to continerd v1.4.x

type RegistryManager

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

RegistryManager contains the configurations that outline how remote registry operations should behave. It contains a global retryable client that will be used for all registry requests.

func NewRegistryManager

func NewRegistryManager(httpConfig config.RetryableHTTPClientConfig, registryConfig config.ResolverConfig, credsFuncs []Credential) *RegistryManager

NewRegistryManager returns a new RegistryManager

func (*RegistryManager) AsRegistryHosts

func (rm *RegistryManager) AsRegistryHosts() RegistryHosts

AsRegistryHosts returns a RegistryHosts type responsible for returning configurations for registries that contain a given image with respect to the configurations present in RegistryManager.

type TLSConfig

type TLSConfig struct {
	InsecureSkipVerify bool   `toml:"insecure_skip_verify" json:"insecure_skip_verify"`
	CAFile             string `toml:"ca_file" json:"caFile"`
	CertFile           string `toml:"cert_file" json:"certFile"`
	KeyFile            string `toml:"key_file" json:"keyFile"`
}

TLSConfig contains the CA/Cert/Key used for a registry

Jump to

Keyboard shortcuts

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