images

package
v0.0.0-...-e27bbb9 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 66 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GzippedEmptyLayerDigest is a digest of GzippedEmptyLayer
	GzippedEmptyLayerDigest = "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
	// EmptyLayerDiffID is the tarsum of the GzippedEmptyLayer
	EmptyLayerDiffID = "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
	// DigestSha256EmptyTar is the canonical sha256 digest of empty data
	DigestSha256EmptyTar = "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
)
View Source
const (
	AcceptSchema2EnvVar = "REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ACCEPTSCHEMA2"
)
View Source
const BaseImageWith1Layer = `` /* 2161-byte string literal not displayed */
View Source
const BaseImageWith1LayerDigest = `sha256:c5207ce0f38da269ad2e58f143b5ea4b314c75ce1121384369f0db9015e10e82`

1 data layer of 128 B

View Source
const BaseImageWith2Layers = `` /* 2684-byte string literal not displayed */
View Source
const BaseImageWith2LayersDigest = "sha256:77371f61c054608a4bb1a96b99f9be69f0868340f5c924ecd8813172f7cf853d"

2 data layers, the first is shared with baseImageWith1Layer, total size of 240 B

View Source
const ChildImageWith2Layers = `` /* 3147-byte string literal not displayed */
View Source
const ChildImageWith2LayersDigest = "sha256:a9f073fbf2c9835711acd09081d87f5b7129ac6269e0df834240000f48abecd4"

based on baseImageWith1Layer, it adds a new data layer of 126 B

View Source
const ChildImageWith3Layers = `` /* 3662-byte string literal not displayed */
View Source
const ChildImageWith3LayersDigest = "sha256:2282a6d553353756fa43ba8672807d3fe81f8fdef54b0f6a360d64aaef2f243a"

based on baseImageWith2Layers, it adds a new data layer of 70 B

View Source
const InternalRegistryURL = "172.30.12.34:5000"

InternalRegistryURL is an url of internal docker registry for testing purposes.

View Source
const MiscImage = `` /* 2736-byte string literal not displayed */
View Source
const MiscImageDigest = "sha256:2643199e5ed5047eeed22da854748ed88b3a63ba0497601ba75852f7b92d4640"

another base image with unique data layer of 554 B

Variables

This section is empty.

Functions

func AssertDeletedStorageFiles

func AssertDeletedStorageFiles(deleted, expected *RegistryStorageFiles) error

AssertDeletedStorageFiles compares lists of deleted files against expected. An error will be generated for each entry present in just one of these sets.

func BuildAndPushChildImage

func BuildAndPushChildImage(
	oc *exutil.CLI,
	dClient *dockerclient.Client,
	parent string,
	name, tag string,
	numberOfNewLayers int,
	outSink io.Writer,
	removeBuiltImage bool,
) (string, string, error)

BuildAndPushChildImage tries to build and push an image of given name and number of layers. It instructs Docker daemon directly. Built image is stored as an image stream tag <name>:<tag>. Returned is an image digest, its ID (docker daemon's internal representation) and an error if any.

func BuildAndPushImageOfSizeWithBuilder

func BuildAndPushImageOfSizeWithBuilder(
	oc *exutil.CLI,
	dClient *dockerclient.Client,
	namespace, name, tag string,
	size uint64,
	numberOfLayers int,
	shouldSucceed bool,
) error

BuildAndPushImageOfSizeWithBuilder tries to build an image of wanted size and number of layers. Built image is stored as an image stream tag <name>:<tag>. If shouldSucceed is false, a build is expected to fail with a denied error. Note the size is only approximate. Resulting image size will be different depending on used compression algorithm and metadata overhead.

func BuildAndPushImageOfSizeWithDocker

func BuildAndPushImageOfSizeWithDocker(
	oc *exutil.CLI,
	dClient *dockerclient.Client,
	name, tag string,
	size uint64,
	numberOfLayers int,
	outSink io.Writer,
	shouldSucceed bool,
	removeBuiltImage bool,
) (string, string, error)

BuildAndPushImageOfSizeWithDocker tries to build an image of wanted size and number of layers. It instructs Docker daemon directly. Built image is stored as an image stream tag <name>:<tag>. If shouldSucceed is false, a push is expected to fail with a denied error. Note the size is only approximate. Resulting image size will be different depending on used compression algorithm and metadata overhead. Returned is an image digest, its ID (docker daemon's internal representation) and an error if any.

func ConfigureRegistry

func ConfigureRegistry(oc *exutil.CLI, desiredState RegistryConfiguration) (bool, error)

ConfigureRegistry re-deploys the registry pod if its configuration doesn't match the desiredState. The function blocks until the registry is ready.

func DoesRegistryAcceptSchema2

func DoesRegistryAcceptSchema2(oc *exutil.CLI) (bool, error)

DoesRegistryAcceptSchema2 returns true if the integrated registry is configured to accept manifest V2 schema 2.

func EnsureRegistryAcceptsSchema2

func EnsureRegistryAcceptsSchema2(oc *exutil.CLI, accept bool) (bool, error)

EnsureRegistryAcceptsSchema2 checks whether the registry is configured to accept manifests V2 schema 2 or not. If the result doesn't match given accept argument, registry's deployment config will be updated accordingly and the function will block until the registry have been re-deployed and ready for new requests.

func GetDockerRegistryURL

func GetDockerRegistryURL(oc *exutil.CLI) (string, error)

GetDockerRegistryURL returns a cluster URL of internal container image registry if available.

func GetImageLabels

func GetImageLabels(c imagev1typedclient.ImageStreamImageInterface, imageRepoName, imageRef string) (map[string]string, error)

GetImageLabels retrieves Docker labels from image from image repository name and image reference

func GetRegistryPod

func GetRegistryPod(podsGetter kcoreclient.PodsGetter) (*kapiv1.Pod, error)

GetRegistryPod returns the youngest registry pod deployed.

func GetRegistryStorageSize

func GetRegistryStorageSize(oc *exutil.CLI) (int64, error)

GetRegistryStorageSize returns a number of bytes occupied by registry's data on its filesystem.

func IsBlobStoredInRegistry

func IsBlobStoredInRegistry(
	oc *exutil.CLI,
	dgst godigest.Digest,
	repository string,
) (bool, bool, error)

IsBlobStoredInRegistry verifies a presence of the given blob on registry's storage. The registry must be deployed with a filesystem storage driver. If repository is given, the presence will be verified also for layer link inside the ${repository}/_layers directory. First returned bool says whether the blob is present globally in the registry's storage. The second says whether the blob is linked in the given repository.

func IsEmptyDigest

func IsEmptyDigest(dgst godigest.Digest) bool

IsEmptyDigest returns true if the given digest matches one of empty blobs.

func LogRegistryPod

func LogRegistryPod(oc *exutil.CLI) error

LogRegistryPod attempts to write registry log to a file in artifacts directory.

func MakeDockerImageReference

func MakeDockerImageReference(ns, isName, imageID string) string

MakeDockerImageReference makes a docker image reference string referencing testing internal docker registry.

func MirrorBlobInRegistry

func MirrorBlobInRegistry(oc *exutil.CLI, dgst godigest.Digest, repository string, timeout time.Duration) error

MirrorBlobInRegistry forces a blob of external image to be mirrored in the registry. The function expects the blob not to exist before a GET request is issued. The function blocks until the blob is mirrored or the given timeout passes.

func NewTestPod

func NewTestPod(oc *exutil.CLI, name, spec string) *testPod

func RecordConfigEvent

func RecordConfigEvent(client corev1client.EventsGetter, deployment *corev1.ReplicationController, eventType, reason,
	msg string)

deployment.

func RecordConfigWarnings

func RecordConfigWarnings(client corev1client.EventsGetter, rc *corev1.ReplicationController, out io.Writer)

RecordConfigWarnings records all warning events from the replication controller to the associated deployment config.

func RedeployRegistry

func RedeployRegistry(oc *exutil.CLI) (bool, error)

func TestImageStreamAdmitSpecUpdate

func TestImageStreamAdmitSpecUpdate(t g.GinkgoTInterface, oc *exutil.CLI)

func TestImageStreamAdmitStatusUpdate

func TestImageStreamAdmitStatusUpdate(t g.GinkgoTInterface, oc *exutil.CLI)

func TestImageStreamMappingCreate

func TestImageStreamMappingCreate(t g.GinkgoTInterface, oc *exutil.CLI)

func TestImageStreamTagLifecycleHook

func TestImageStreamTagLifecycleHook(t g.GinkgoTInterface, oc *exutil.CLI)

func TestImageStreamTagsAdmission

func TestImageStreamTagsAdmission(t g.GinkgoTInterface, oc *exutil.CLI)

func TestImageStreamWithoutDockerImageConfig

func TestImageStreamWithoutDockerImageConfig(t g.GinkgoTInterface, oc *exutil.CLI)

func TestMultipleImageChangeBuildTriggers

func TestMultipleImageChangeBuildTriggers(t g.GinkgoTInterface, oc *exutil.CLI)

func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustom

func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustom(t g.GinkgoTInterface, oc *exutil.CLI)

func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustomWithConfigChange

func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustomWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)

func TestSimpleImageChangeBuildTriggerFromImageStreamTagDocker

func TestSimpleImageChangeBuildTriggerFromImageStreamTagDocker(t g.GinkgoTInterface, oc *exutil.CLI)

func TestSimpleImageChangeBuildTriggerFromImageStreamTagDockerWithConfigChange

func TestSimpleImageChangeBuildTriggerFromImageStreamTagDockerWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)

func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTI

func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTI(t g.GinkgoTInterface, oc *exutil.CLI)

func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTIWithConfigChange

func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTIWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)

Types

type CleanUpContainer

type CleanUpContainer struct {
	OC *exutil.CLI
	// contains filtered or unexported fields
}

CleanUpContainer holds names of image names, container image IDs, imagestreamtags and imagestreams that shall be deleted at the end of the test.

func NewCleanUpContainer

func NewCleanUpContainer(oc *exutil.CLI) *CleanUpContainer

NewCleanUpContainer creates a new instance of CleanUpContainer.

func (*CleanUpContainer) AddImage

func (c *CleanUpContainer) AddImage(name, id, isTag string)

AddImage marks given image name, container image id and imagestreamtag as candidates for deletion.

func (*CleanUpContainer) AddImageStream

func (c *CleanUpContainer) AddImageStream(isName string)

AddImageStream marks the given image stream name for removal.

func (*CleanUpContainer) Run

func (c *CleanUpContainer) Run()

Run deletes all the marked objects.

type HookExecutor

type HookExecutor interface {
	Execute(hook *appsv1.LifecycleHook, rc *corev1.ReplicationController, suffix, label string) error
}

HookExecutor knows how to execute a deployment lifecycle hook.

func NewHookExecutor

func NewHookExecutor(kubeClient kubernetes.Interface, imageClient imageclienttyped.ImageStreamTagsGetter, out io.Writer) HookExecutor

NewHookExecutor makes a HookExecutor from a client.

type RegistryConfiguration

type RegistryConfiguration struct {
	ReadOnly      *bool
	AcceptSchema2 *bool
}

RegistriConfiguration holds desired configuration options for the integrated registry. *nil* stands for "no change".

type RegistryStorageFiles

type RegistryStorageFiles struct {
	Repos         []string
	ManifestLinks RepoLinks
	LayerLinks    RepoLinks
	Blobs         []string
}

func RunHardPrune

func RunHardPrune(oc *exutil.CLI, dryRun bool) (*RegistryStorageFiles, error)

RunHardPrune executes into a docker-registry pod and runs a garbage collector. The docker-registry is assumed to be in a read-only mode and using filesystem as a storage driver. It returns lists of deleted files.

func (*RegistryStorageFiles) Len

func (sfs *RegistryStorageFiles) Len() int

Len returns a number of files contained in the sfs container.

func (*RegistryStorageFiles) ToPaths

func (sfs *RegistryStorageFiles) ToPaths(root string) []string

ToPaths returns a list of paths of files contained in _sfs_ corresponding to their location in registry pod's storage under _root_ directory.

type RepoLinks map[string][]string

RepoLinks maps digests of layer links to a repository

func (RepoLinks) Add

func (rl RepoLinks) Add(repo string, links ...string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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