docker_registry_watcher

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnonymousAuth = DockerConfigEntry{}

AnonymousAuth is an empty entry for unknown registries

View Source
var DockerCfgAuths = DockerConfig{}

DockerCfgAuths stores all available registries and their auths

View Source
var DockerImageDigestRe = regexp.MustCompile("(sha256:?)?[a-fA-F0-9]{64}")

DockerImageDigestRe regexp extracts docker image digest from string

View Source
var DockerPullableDigestRe = regexp.MustCompile("docker-pullable://.*@sha256:[a-fA-F0-9]{64}")

DockerPullableDigestRe detects if imageId field contains image digest

View Source
var KubeDigestRe = regexp.MustCompile(".*@sha256:[a-fA-F0-9]{64}")

KubeDigestRe detects if imageId field sha256 digest

Functions

func FindImageDigest

func FindImageDigest(imageID string) (image string, err error)

Поиск digest в строке. Учитывается специфика kubernetes — если есть префикс docker-pullable://, то в строке digest. Если префикс docker:// или нет префикса, то скорее всего там imageId, который нельзя применить для обновления, поэтому возвращается ошибка Пример строки с digest из kubernetes: docker-pullable://registry/repo:tag@sha256:DIGEST-HASH

func GetHTTPTransport

func GetHTTPTransport() (transport http.RoundTripper)

func GetImage

func GetImage(ref name.Reference) (v1.Image, error)

func ImageDigest

func ImageDigest(ref name.Reference) (string, error)

func IsValidImageDigest

func IsValidImageDigest(imageID string) bool

Проверка, что строка это docker digest

func LoadDockerRegistrySecret

func LoadDockerRegistrySecret(bytes []byte) error

func NewKeychain

func NewKeychain() authn.Keychain

func ParseReferenceOptions

func ParseReferenceOptions() []name.Option

Types

type DockerConfig

type DockerConfig map[string]DockerConfigEntry

DockerConfig represents the config file used by the docker CLI. This config that represents the credentials that should be used when pulling images from specific image repositories.

type DockerConfigEntry

type DockerConfigEntry struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Auth     string `json:"auth,omitempty"`

	// Email is an optional value associated with the username.
	// This field is deprecated and will be removed in a later
	// version of docker.
	Email string `json:"email,omitempty"`

	ServerAddress string `json:"serveraddress,omitempty"`

	// IdentityToken is used to authenticate the user and get
	// an access token for the registry.
	IdentityToken string `json:"identitytoken,omitempty"`

	// RegistryToken is a bearer token to be sent to a registry
	RegistryToken string `json:"registrytoken,omitempty"`
}

type DockerConfigJSON

type DockerConfigJSON struct {
	Auths DockerConfig `json:"auths"`

	XXX map[string]interface{} `yaml:",inline"`
}

DockerConfigJSON represents a local docker auth config file for pulling images.

type DockerRegistryWatcher

type DockerRegistryWatcher interface {
	WithContext(ctx context.Context)
	WithRegistrySecretPath(string)
	WithErrorCallback(errorCb func())
	WithFatalCallback(fatalCb func())
	WithSuccessCallback(successCb func())
	WithImageInfoCallback(imageInfoCb func() (string, string))
	WithImageUpdatedCallback(imageUpdatedCb func(string))
	Init() error
	Start()
	Stop()
}

func NewDockerRegistryWatcher

func NewDockerRegistryWatcher() DockerRegistryWatcher

InitRegistryManager получает имя образа по имени пода и запрашивает id этого образа.

Jump to

Keyboard shortcuts

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