util

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 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
)

Variables

This section is empty.

Functions

func DigestOrImageMatch

func DigestOrImageMatch(image, imageID string) bool

DigestOrImageMatch matches the digest in the image name.

func DockerImageReferenceExact

func DockerImageReferenceExact(r imagev1.DockerImageReference) string

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

func DockerImageReferenceForImage

func DockerImageReferenceForImage(stream *imagev1.ImageStream, imageID string) (string, bool)

DockerImageReferenceForImage returns the docker reference for specified image. Assuming the image stream contains the image and the image has corresponding tag, this function will try to find this tag and take the reference policy into the account. If the image stream does not reference the image or the image does not have corresponding tag event, this function will return false.

func DockerImageReferenceForStream

func DockerImageReferenceForStream(stream *imagev1.ImageStream) (imagev1.DockerImageReference, error)

DockerImageReferenceForStream returns a DockerImageReference that represents the ImageStream or false, if no valid reference exists.

func DockerImageReferenceNameString

func DockerImageReferenceNameString(r imagev1.DockerImageReference) string

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

func DockerImageReferenceString

func DockerImageReferenceString(r imagev1.DockerImageReference) string

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

func HasAnnotationTag

func HasAnnotationTag(tagRef *imagev1.TagReference, searchTag string) bool

func ImageConfigMatchesImage

func ImageConfigMatchesImage(image *imageapi.Image, imageConfig []byte) (bool, error)

ImageConfigMatchesImage returns true if the provided image config matches a digest stored in the manifest of the image.

func ImageWithMetadata

func ImageWithMetadata(image *imagev1.Image) error

ImageWithMetadata mutates the given image. It parses raw DockerImageManifest data stored in the image and fills its DockerImageMetadata and other fields. Copied from github.com/openshift/image-registry/pkg/origin-common/util/util.go

func InternalImageWithMetadata

func InternalImageWithMetadata(image *imageapi.Image) error

InternalImageWithMetadata mutates the given image. It parses raw DockerImageManifest data stored in the image and fills its DockerImageMetadata and other fields.

func IsRegistryDockerHub

func IsRegistryDockerHub(registry string) bool

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

func LatestImageTagEvent

func LatestImageTagEvent(stream *imagev1.ImageStream, imageID string) (string, *imagev1.TagEvent)

LatestImageTagEvent returns the most recent TagEvent and the tag for the specified image. Copied from v3.7 github.com/openshift/origin/pkg/image/apis/image/v1/helpers.go

func LatestObservedTagGeneration

func LatestObservedTagGeneration(stream *imagev1.ImageStream, tag string) int64

LatestObservedTagGeneration returns the generation value for the given tag that has been observed by the controller monitoring the image stream. If the tag has not been observed, the generation is zero.

func LatestTaggedImage

func LatestTaggedImage(stream *imagev1.ImageStream, tag string) *imagev1.TagEvent

LatestTaggedImage returns the most recent TagEvent for the specified image repository and tag. Will resolve lookups for the empty tag. Returns nil if tag isn't present in stream.status.tags.

func ManifestMatchesImage

func ManifestMatchesImage(image *imageapi.Image, newManifest []byte) (bool, error)

ManifestMatchesImage returns true if the provided manifest matches the name of the image.

func ParseDockerImageReference

func ParseDockerImageReference(spec string) (imagev1.DockerImageReference, error)

ParseDockerImageReference parses a Docker pull spec string into a DockerImageReference.

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 ParseImageStreamTagName

func ParseImageStreamTagName(istag string) (name string, tag string, err error)

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

func ReorderImageLayers

func ReorderImageLayers(image *imageapi.Image)

ReorderImageLayers mutates the given image. It reorders the layers in ascending order. Ascending order matches the order of layers in schema 2. Schema 1 has reversed (descending) order of layers.

func ResolveImageID

func ResolveImageID(stream *imagev1.ImageStream, imageID string) (*imagev1.TagEvent, error)

ResolveImageID returns latest TagEvent for specified imageID and an error if there's more than one image matching the ID or when one does not exist.

func ResolveLatestTaggedImage

func ResolveLatestTaggedImage(stream *imagev1.ImageStream, tag string) (string, bool)

ResolveLatestTaggedImage returns the appropriate pull spec for a given tag in the image stream, handling the tag's reference policy if necessary to return a resolved image. Callers that transform an ImageStreamTag into a pull spec should use this method instead of LatestTaggedImage.

func ResolveReferenceForTagEvent

func ResolveReferenceForTagEvent(stream *imagev1.ImageStream, tag string, latest *imagev1.TagEvent) string

ResolveReferenceForTagEvent applies the tag reference rules for a stream, tag, and tag event for that tag.

func ResolveTagReference

func ResolveTagReference(stream *imagev1.ImageStream, tag string, latest *imagev1.TagEvent) (string, bool)

ResolveTagReference applies the tag reference rules for a stream, tag, and tag event for that tag. It returns true if the tag is

func SetDockerClientDefaults

func SetDockerClientDefaults(r *imagev1.DockerImageReference)

SetDockerClientDefaults set the default values used by the Docker client.

func SpecHasTag

func SpecHasTag(stream *imagev1.ImageStream, name string) (imagev1.TagReference, bool)

SpecHasTag returns named tag from image stream's spec and boolean whether one was found.

func StatusHasTag

func StatusHasTag(stream *imagev1.ImageStream, name string) (imagev1.NamedTagEventList, bool)

StatusHasTag returns named tag from image stream's status and boolean whether one was found.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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