image

package
v4.2.21+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DockerDefaultNamespace is the value for namespace when a single segment name is provided.
	DockerDefaultNamespace = "library"
	// DockerDefaultRegistry is the value for the registry when none was provided.
	DockerDefaultRegistry = "docker.io"
	// DockerDefaultV1Registry is the host name of the default v1 registry
	DockerDefaultV1Registry = "index." + DockerDefaultRegistry
	// DockerDefaultV2Registry is the host name of the default v2 registry
	DockerDefaultV2Registry = "registry-1." + DockerDefaultRegistry
)
View Source
const (

	// DefaultImageTag is used when an image tag is needed and the configuration does not specify a tag to use.
	DefaultImageTag = "latest"

	// ManagedByOpenShiftAnnotation indicates that an image is managed by OpenShift's registry.
	ManagedByOpenShiftAnnotation = "openshift.io/image.managed"

	// InsecureRepositoryAnnotation may be set true on an image stream to allow insecure access to pull content.
	InsecureRepositoryAnnotation = "openshift.io/image.insecureRepository"

	// DockerImageLayersOrderAnnotation describes layers order in the docker image.
	DockerImageLayersOrderAnnotation = "image.openshift.io/dockerLayersOrder"

	// DockerImageLayersOrderAscending indicates that image layers are sorted in
	// the order of their addition (from oldest to latest)
	DockerImageLayersOrderAscending = "ascending"

	// ImageManifestBlobStoredAnnotation indicates that manifest and config blobs of image are stored in on
	// storage of integrated Docker registry.
	ImageManifestBlobStoredAnnotation = "image.openshift.io/manifestBlobStored"

	// The supported type of image signature.
	ImageSignatureTypeAtomicImageV1 string = "AtomicImageV1"

	// DockerImageLayersOrderDescending indicates that layers are sorted in
	// reversed order of their addition (from newest to oldest).
	DockerImageLayersOrderDescending = "descending"

	// Limit that applies to images. Used with a max["storage"] LimitRangeItem to set
	// the maximum size of an image.
	LimitTypeImage corev1.LimitType = "openshift.io/Image"
)

Variables

This section is empty.

Functions

func DigestOrImageMatch

func DigestOrImageMatch(image, imageID string) bool

DigestOrImageMatch matches the digest in the image name.

func IsRegistryDockerHub

func IsRegistryDockerHub(registry string) bool

IsRegistryDockerHub returns true if the given registry name belongs to Docker hub.

func JoinImageStreamImage

func JoinImageStreamImage(name, id string) string

JoinImageStreamImage creates a name for image stream image object from an image stream name and an id.

func JoinImageStreamTag

func JoinImageStreamTag(name, tag string) string

JoinImageStreamTag turns a name and tag into the name of an ImageStreamTag

func ParseImageStreamImageName

func ParseImageStreamImageName(input string) (name string, id string, err error)

ParseImageStreamImageName splits a string into its name component and ID component, and returns an error if the string is not in the right form.

func SplitImageStreamTag

func SplitImageStreamTag(nameAndTag string) (name string, tag string, ok bool)

SplitImageStreamTag turns the name of an ImageStreamTag into Name and Tag. It returns false if the tag was not properly specified in the name.

Types

type Descriptor

type Descriptor struct {
	// MediaType describe the type of the content. All text based formats are
	// encoded as utf-8.
	MediaType string `json:"mediaType,omitempty"`

	// Size in bytes of content.
	Size int64 `json:"size,omitempty"`

	// Digest uniquely identifies the content. A byte stream can be verified
	// against against this digest.
	Digest string `json:"digest,omitempty"`
}

Descriptor describes targeted content. Used in conjunction with a blob store, a descriptor can be used to fetch, store and target any kind of blob. The struct also describes the wire protocol format. Fields should only be added but never changed.

type DockerConfig

type DockerConfig struct {
	Hostname        string              `json:"Hostname,omitempty"`
	Domainname      string              `json:"Domainname,omitempty"`
	User            string              `json:"User,omitempty"`
	Memory          int64               `json:"Memory,omitempty"`
	MemorySwap      int64               `json:"MemorySwap,omitempty"`
	CPUShares       int64               `json:"CpuShares,omitempty"`
	CPUSet          string              `json:"Cpuset,omitempty"`
	AttachStdin     bool                `json:"AttachStdin,omitempty"`
	AttachStdout    bool                `json:"AttachStdout,omitempty"`
	AttachStderr    bool                `json:"AttachStderr,omitempty"`
	PortSpecs       []string            `json:"PortSpecs,omitempty"`
	ExposedPorts    map[string]struct{} `json:"ExposedPorts,omitempty"`
	Tty             bool                `json:"Tty,omitempty"`
	OpenStdin       bool                `json:"OpenStdin,omitempty"`
	StdinOnce       bool                `json:"StdinOnce,omitempty"`
	Env             []string            `json:"Env,omitempty"`
	Cmd             []string            `json:"Cmd,omitempty"`
	DNS             []string            `json:"Dns,omitempty"` // For Docker API v1.9 and below only
	Image           string              `json:"Image,omitempty"`
	Volumes         map[string]struct{} `json:"Volumes,omitempty"`
	VolumesFrom     string              `json:"VolumesFrom,omitempty"`
	WorkingDir      string              `json:"WorkingDir,omitempty"`
	Entrypoint      []string            `json:"Entrypoint,omitempty"`
	NetworkDisabled bool                `json:"NetworkDisabled,omitempty"`
	SecurityOpts    []string            `json:"SecurityOpts,omitempty"`
	OnBuild         []string            `json:"OnBuild,omitempty"`
	Labels          map[string]string   `json:"Labels,omitempty"`
}

DockerConfig is the list of configuration options used when creating a container.

type DockerConfigHistory

type DockerConfigHistory struct {
	Created    metav1.Time `json:"created"`
	Author     string      `json:"author,omitempty"`
	CreatedBy  string      `json:"created_by,omitempty"`
	Comment    string      `json:"comment,omitempty"`
	EmptyLayer bool        `json:"empty_layer,omitempty"`
}

DockerConfigHistory stores build commands that were used to create an image

type DockerConfigRootFS

type DockerConfigRootFS struct {
	Type    string   `json:"type"`
	DiffIDs []string `json:"diff_ids,omitempty"`
}

DockerConfigRootFS describes images root filesystem

type DockerFSLayer

type DockerFSLayer struct {
	// DockerBlobSum is the tarsum of the referenced filesystem image layer
	// TODO make this digest.Digest once docker/distribution is in Godeps
	DockerBlobSum string `json:"blobSum"`
}

DockerFSLayer is a container struct for BlobSums defined in an image manifest

type DockerHistory

type DockerHistory struct {
	// DockerV1Compatibility is the raw v1 compatibility information
	DockerV1Compatibility string `json:"v1Compatibility"`
}

DockerHistory stores unstructured v1 compatibility information

type DockerImage

type DockerImage struct {
	metav1.TypeMeta `json:",inline"`

	ID              string        `json:"Id"`
	Parent          string        `json:"Parent,omitempty"`
	Comment         string        `json:"Comment,omitempty"`
	Created         metav1.Time   `json:"Created,omitempty"`
	Container       string        `json:"Container,omitempty"`
	ContainerConfig DockerConfig  `json:"ContainerConfig,omitempty"`
	DockerVersion   string        `json:"DockerVersion,omitempty"`
	Author          string        `json:"Author,omitempty"`
	Config          *DockerConfig `json:"Config,omitempty"`
	Architecture    string        `json:"Architecture,omitempty"`
	Size            int64         `json:"Size,omitempty"`
}

DockerImage is the type representing a docker image and its various properties when retrieved from the Docker client API.

type DockerImageConfig

type DockerImageConfig struct {
	ID              string                `json:"id"`
	Parent          string                `json:"parent,omitempty"`
	Comment         string                `json:"comment,omitempty"`
	Created         metav1.Time           `json:"created"`
	Container       string                `json:"container,omitempty"`
	ContainerConfig DockerConfig          `json:"container_config,omitempty"`
	DockerVersion   string                `json:"docker_version,omitempty"`
	Author          string                `json:"author,omitempty"`
	Config          *DockerConfig         `json:"config,omitempty"`
	Architecture    string                `json:"architecture,omitempty"`
	Size            int64                 `json:"size,omitempty"`
	RootFS          *DockerConfigRootFS   `json:"rootfs,omitempty"`
	History         []DockerConfigHistory `json:"history,omitempty"`
	OSVersion       string                `json:"os.version,omitempty"`
	OSFeatures      []string              `json:"os.features,omitempty"`
}

DockerImageConfig stores the image configuration

type DockerImageManifest

type DockerImageManifest struct {
	SchemaVersion int    `json:"schemaVersion"`
	MediaType     string `json:"mediaType,omitempty"`

	// schema1
	Name         string          `json:"name"`
	Tag          string          `json:"tag"`
	Architecture string          `json:"architecture"`
	FSLayers     []DockerFSLayer `json:"fsLayers"`
	History      []DockerHistory `json:"history"`

	// schema2
	Layers []Descriptor `json:"layers"`
	Config Descriptor   `json:"config"`
}

DockerImageManifest represents the Docker v2 image format.

type DockerImageReference

type DockerImageReference struct {
	Registry  string
	Namespace string
	Name      string
	Tag       string
	ID        string
}

DockerImageReference points to a Docker image.

func ParseDockerImageReference

func ParseDockerImageReference(spec string) (DockerImageReference, error)

ParseDockerImageReference parses a Docker pull spec string into a DockerImageReference.

func (DockerImageReference) AsRepository

func (r DockerImageReference) AsRepository() DockerImageReference

AsRepository returns the reference without tags or IDs.

func (DockerImageReference) AsV2

func (DockerImageReference) DockerClientDefaults

func (r DockerImageReference) DockerClientDefaults() DockerImageReference

DockerClientDefaults sets the default values used by the Docker client.

func (DockerImageReference) Exact

func (r DockerImageReference) Exact() string

Exact returns a string representation of the set fields on the DockerImageReference

func (DockerImageReference) NameString

func (r DockerImageReference) NameString() string

NameString returns the name of the reference with its tag or ID.

func (DockerImageReference) RegistryURL

func (r DockerImageReference) RegistryURL() *url.URL

RepositoryName returns the registry relative name

func (DockerImageReference) RepositoryName

func (r DockerImageReference) RepositoryName() string

RepositoryName returns the registry relative name

func (DockerImageReference) String

func (r DockerImageReference) String() string

String converts a DockerImageReference to a Docker pull spec (which implies a default namespace according to V1 Docker registry rules). Use Exact() if you want no defaulting.

type DockerV1CompatibilityImage

type DockerV1CompatibilityImage struct {
	ID              string        `json:"id"`
	Parent          string        `json:"parent,omitempty"`
	Comment         string        `json:"comment,omitempty"`
	Created         metav1.Time   `json:"created"`
	Container       string        `json:"container,omitempty"`
	ContainerConfig DockerConfig  `json:"container_config,omitempty"`
	DockerVersion   string        `json:"docker_version,omitempty"`
	Author          string        `json:"author,omitempty"`
	Config          *DockerConfig `json:"config,omitempty"`
	Architecture    string        `json:"architecture,omitempty"`
	Size            int64         `json:"size,omitempty"`
}

DockerV1CompatibilityImage represents the structured v1 compatibility information.

type DockerV1CompatibilityImageSize

type DockerV1CompatibilityImageSize struct {
	Size int64 `json:"size,omitempty"`
}

DockerV1CompatibilityImageSize represents the structured v1 compatibility information for size

type Image

type Image struct {
	metav1.TypeMeta
	metav1.ObjectMeta

	// The string that can be used to pull this image.
	DockerImageReference string
	// Metadata about this image
	DockerImageMetadata DockerImage
	// This attribute conveys the version of docker metadata the JSON should be stored in, which if empty defaults to "1.0"
	DockerImageMetadataVersion string
	// The raw JSON of the manifest
	DockerImageManifest string
	// DockerImageLayers represents the layers in the image. May not be set if the image does not define that data.
	DockerImageLayers []ImageLayer
	// Signatures holds all signatures of the image.
	Signatures []ImageSignature
	// DockerImageSignatures provides the signatures as opaque blobs. This is a part of manifest schema v1.
	DockerImageSignatures [][]byte
	// DockerImageManifestMediaType specifies the mediaType of manifest. This is a part of manifest schema v2.
	DockerImageManifestMediaType string
	// DockerImageConfig is a JSON blob that the runtime uses to set up the container. This is a part of manifest schema v2.
	DockerImageConfig string
}

Image is an immutable representation of a Docker image and metadata at a point in time.

type ImageLayer

type ImageLayer struct {
	// Name of the layer as defined by the underlying store.
	Name string
	// LayerSize of the layer as defined by the underlying store.
	LayerSize int64
	// MediaType of the referenced object.
	MediaType string
}

ImageLayer represents a single layer of the image. Some images may have multiple layers. Some may have none.

type ImageSignature

type ImageSignature struct {
	metav1.TypeMeta
	metav1.ObjectMeta

	// Required: Describes a type of stored blob.
	Type string
	// Required: An opaque binary string which is an image's signature.
	Content []byte
	// Conditions represent the latest available observations of a signature's current state.
	Conditions []SignatureCondition

	// A human readable string representing image's identity. It could be a product name and version, or an
	// image pull spec (e.g. "registry.access.redhat.com/rhel7/rhel:7.2").
	ImageIdentity string
	// Contains claims from the signature.
	SignedClaims map[string]string
	// If specified, it is the time of signature's creation.
	Created *metav1.Time
	// If specified, it holds information about an issuer of signing certificate or key (a person or entity
	// who signed the signing certificate or key).
	IssuedBy *SignatureIssuer
	// If specified, it holds information about a subject of signing certificate or key (a person or entity
	// who signed the image).
	IssuedTo *SignatureSubject
}

ImageSignature holds a signature of an image. It allows to verify image identity and possibly other claims as long as the signature is trusted. Based on this information it is possible to restrict runnable images to those matching cluster-wide policy. Mandatory fields should be parsed by clients doing image verification. The others are parsed from signature's content by the server. They serve just an informative purpose.

type SignatureCondition

type SignatureCondition struct {
	// Type of signature condition, Complete or Failed.
	Type SignatureConditionType
	// Status of the condition, one of True, False, Unknown.
	Status corev1.ConditionStatus
	// Last time the condition was checked.
	LastProbeTime metav1.Time
	// Last time the condition transit from one status to another.
	LastTransitionTime metav1.Time
	// (brief) reason for the condition's last transition.
	Reason string
	// Human readable message indicating details about last transition.
	Message string
}

SignatureCondition describes an image signature condition of particular kind at particular probe time.

type SignatureConditionType

type SignatureConditionType string

SignatureConditionType is a type of image signature condition.

type SignatureGenericEntity

type SignatureGenericEntity struct {
	// Organization name.
	Organization string
	// Common name (e.g. openshift-signing-service).
	CommonName string
}

SignatureGenericEntity holds a generic information about a person or entity who is an issuer or a subject of signing certificate or key.

type SignatureIssuer

type SignatureIssuer struct {
	SignatureGenericEntity
}

SignatureIssuer holds information about an issuer of signing certificate or key.

type SignatureSubject

type SignatureSubject struct {
	SignatureGenericEntity
	// If present, it is a human readable key id of public key belonging to the subject used to verify image
	// signature. It should contain at least 64 lowest bits of public key's fingerprint (e.g.
	// 0x685ebe62bf278440).
	PublicKeyID string
}

SignatureSubject holds information about a person or entity who created the signature.

Jump to

Keyboard shortcuts

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