registry

package
v1.11.0-cni-plu...-aa3fb74 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuayRegistry   = "quay.io"
	DockerRegistry = "docker.io"
)

Variables

View Source
var ImageMap = map[string]string{
	"typha":                     "calico/typha",
	"calicoctl":                 "calico/ctl",
	"flannel":                   "coreos/flannel",
	"flexvol":                   "calico/pod2daemon-flexvol",
	"key-cert-provisioner":      "calico/key-cert-provisioner",
	"csi-node-driver-registrar": "calico/node-driver-registrar",
}

ImageMap maps the image name to the repository.

Functions

func ImageExists

func ImageExists(img ImageRef) (bool, error)

ImageExists checks if an image exists in a registry.

Types

type Component

type Component struct {
	Version  string `yaml:"version"`
	Image    string `yaml:"image,omitempty"`
	Registry string `yaml:"registry,omitempty"`
}

Component represents a component in the pinned version file.

func (Component) ImageRef

func (c Component) ImageRef() ImageRef

ImageRef returns the image reference of the component.

func (Component) String

func (c Component) String() string

String returns the string representation of the component. The string representation is in the format of registry/image:version.

type Docker

type Docker struct{}

Docker represents the Docker registry

func (*Docker) ManifestURL

func (d *Docker) ManifestURL(img ImageRef) string

ManifestURL returns the manifest URL for the Docker registry

func (*Docker) TokenURL

func (d *Docker) TokenURL(scope string) string

TokenURL returns the token URL for the Docker registry

func (*Docker) URL

func (d *Docker) URL() string

URL returns the URL for the Docker registry

type DockerConfig

type DockerConfig struct {
	Auths map[string]registry.AuthConfig `json:"auths"`
}

type DockerRunner

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

DockerRunner is a struct for running docker commands

func MustDockerRunner

func MustDockerRunner() *DockerRunner

MustDockerRunner returns a new DockerRunner or exits the program

func NewDockerRunner

func NewDockerRunner() (d *DockerRunner, err error)

NewDockerRunner returns a new DockerRunner

func (*DockerRunner) ExecInContainer

func (d *DockerRunner) ExecInContainer(containerID string, cmd ...string) (container.ExecInspect, error)

ExecInContainer executes a command in the container

func (*DockerRunner) ManifestPush

func (d *DockerRunner) ManifestPush(manifestListName string, images []string) error

ManifestPush pushes the manifest list to the registry.

Since "docker manifest create/push" is considered experimental, it is not supported in the docker client library. As a workaround, we can use the docker command to create and push the manifest list.

func (*DockerRunner) PullImage

func (d *DockerRunner) PullImage(img string) error

PullImage pulls the image if it does not exist

func (*DockerRunner) PushImage

func (d *DockerRunner) PushImage(img string) error

PushImage pushes the image to the registry

func (*DockerRunner) RemoveContainer

func (d *DockerRunner) RemoveContainer(containerID string) error

RemoveContainer removes the container

func (*DockerRunner) RemoveImage

func (d *DockerRunner) RemoveImage(img string) error

RemoveImage removes the image if it exists

func (*DockerRunner) RunContainer

func (d *DockerRunner) RunContainer(containerConfig *container.Config, hostConfig *container.HostConfig) (container.CreateResponse, error)

RunContainer runs a container with the given config and host config

func (*DockerRunner) StopContainer

func (d *DockerRunner) StopContainer(containerID string) error

StopContainer stops the container

func (*DockerRunner) TagImage

func (d *DockerRunner) TagImage(currentTag, newTag string) error

TagImage tags the image with the new tag

type ImageRef

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

ImageRef represents a container image.

func ParseImage

func ParseImage(img string) ImageRef

func (ImageRef) Registry

func (i ImageRef) Registry() Registry

func (ImageRef) Repository

func (i ImageRef) Repository() string

Repository returns the repository part of the image.

func (ImageRef) RequiresAuth

func (i ImageRef) RequiresAuth() bool

func (ImageRef) Tag

func (i ImageRef) Tag() string

Tag returns the tag part of the image.

type ManifestList

type ManifestList struct {
	SchemaVersion int                               `json:"schemaVersion"`
	MediaType     string                            `json:"mediaType"`
	Manifests     []manifestlist.ManifestDescriptor `json:"manifests"`
}

ManifestList represents a Docker Manifest List

type OperatorComponent

type OperatorComponent struct {
	Component
}

func (OperatorComponent) InitImage

func (c OperatorComponent) InitImage() Component

type Quay

type Quay struct{}

Quay represents the Quay registry

func (*Quay) ManifestURL

func (q *Quay) ManifestURL(img ImageRef) string

ManifestURL returns the manifest URL for the Quay registry

func (*Quay) TokenURL

func (q *Quay) TokenURL(scope string) string

TokenURL returns the token URL for the Quay registry

func (*Quay) URL

func (q *Quay) URL() string

URL returns the URL for the Quay registry

type Registry

type Registry interface {
	URL() string
	TokenURL(scope string) string
	ManifestURL(img ImageRef) string
}

Registry represents a container registry.

func GetRegistry

func GetRegistry(registry string) Registry

GetRegistry returns a Registry based on the registry string.

type TagsResponse

type TagsResponse struct {
	Name string   `json:"name"`
	Tags []string `json:"tags"`
}

TagsResponse is a struct for the response from the docker registry API for tags

Jump to

Keyboard shortcuts

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