Documentation ¶
Index ¶
- Constants
- Variables
- func ImageExists(img ImageRef) (bool, error)
- type Component
- type Docker
- type DockerConfig
- type DockerRunner
- func (d *DockerRunner) ExecInContainer(containerID string, cmd ...string) (container.ExecInspect, error)
- func (d *DockerRunner) ManifestPush(manifestListName string, images []string) error
- func (d *DockerRunner) PullImage(img string) error
- func (d *DockerRunner) PushImage(img string) error
- func (d *DockerRunner) RemoveContainer(containerID string) error
- func (d *DockerRunner) RemoveImage(img string) error
- func (d *DockerRunner) RunContainer(containerConfig *container.Config, hostConfig *container.HostConfig) (container.CreateResponse, error)
- func (d *DockerRunner) StopContainer(containerID string) error
- func (d *DockerRunner) TagImage(currentTag, newTag string) error
- type ImageRef
- type ManifestList
- type OperatorComponent
- type Quay
- type Registry
- type TagsResponse
Constants ¶
const ( QuayRegistry = "quay.io" DockerRegistry = "docker.io" )
Variables ¶
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 ¶
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.
type Docker ¶
type Docker struct{}
Docker represents the Docker registry
func (*Docker) ManifestURL ¶
ManifestURL returns the manifest 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 (ImageRef) Repository ¶
Repository returns the repository part of the image.
func (ImageRef) RequiresAuth ¶
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 ¶
ManifestURL returns the manifest 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 ¶
GetRegistry returns a Registry based on the registry string.
type TagsResponse ¶
TagsResponse is a struct for the response from the docker registry API for tags