Documentation
¶
Index ¶
- Constants
- func AssertDeletedStorageFiles(deleted, expected *RegistryStorageFiles) error
- func BuildAndPushChildImage(oc *exutil.CLI, dClient *dockerclient.Client, parent string, name, tag string, ...) (string, string, error)
- func BuildAndPushImageOfSizeWithBuilder(oc *exutil.CLI, dClient *dockerclient.Client, namespace, name, tag string, ...) error
- func BuildAndPushImageOfSizeWithDocker(oc *exutil.CLI, dClient *dockerclient.Client, name, tag string, size uint64, ...) (string, string, error)
- func ConfigureRegistry(oc *exutil.CLI, desiredState RegistryConfiguration) (bool, error)
- func DoesRegistryAcceptSchema2(oc *exutil.CLI) (bool, error)
- func EnsureRegistryAcceptsSchema2(oc *exutil.CLI, accept bool) (bool, error)
- func GetDockerRegistryURL(oc *exutil.CLI) (string, error)
- func GetImageLabels(c imagev1typedclient.ImageStreamImageInterface, imageRepoName, imageRef string) (map[string]string, error)
- func GetRegistryPod(podsGetter kcoreclient.PodsGetter) (*kapiv1.Pod, error)
- func GetRegistryStorageSize(oc *exutil.CLI) (int64, error)
- func IsBlobStoredInRegistry(oc *exutil.CLI, dgst godigest.Digest, repository string) (bool, bool, error)
- func IsEmptyDigest(dgst godigest.Digest) bool
- func LogRegistryPod(oc *exutil.CLI) error
- func MakeDockerImageReference(ns, isName, imageID string) string
- func MirrorBlobInRegistry(oc *exutil.CLI, dgst godigest.Digest, repository string, timeout time.Duration) error
- func NewTestPod(oc *exutil.CLI, name, spec string) *testPod
- func RecordConfigEvent(client corev1client.EventsGetter, deployment *corev1.ReplicationController, ...)
- func RecordConfigWarnings(client corev1client.EventsGetter, rc *corev1.ReplicationController, ...)
- func RedeployRegistry(oc *exutil.CLI) (bool, error)
- func TestImageConfigImageStreamImportModeLegacy(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImageConfigImageStreamImportModePreserveOriginal(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImageStreamAdmitSpecUpdate(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImageStreamAdmitStatusUpdate(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImageStreamImportMode(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImageStreamMappingCreate(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImageStreamTagLifecycleHook(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImageStreamTagsAdmission(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImageStreamWithoutDockerImageConfig(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestImportImageFromBlockedRegistry(oc *exutil.CLI)
- func TestImportImageFromInsecureRegistry(oc *exutil.CLI)
- func TestImportRepositoryFromBlockedRegistry(oc *exutil.CLI)
- func TestImportRepositoryFromInsecureRegistry(oc *exutil.CLI)
- func TestMultipleImageChangeBuildTriggers(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustom(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustomWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestSimpleImageChangeBuildTriggerFromImageStreamTagDocker(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestSimpleImageChangeBuildTriggerFromImageStreamTagDockerWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTI(t g.GinkgoTInterface, oc *exutil.CLI)
- func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTIWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)
- type CleanUpContainer
- type HookExecutor
- type RegistryConfiguration
- type RegistryStorageFiles
- type RepoLinks
Constants ¶
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" )
const (
AcceptSchema2EnvVar = "REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ACCEPTSCHEMA2"
)
const BaseImageWith1Layer = `` /* 2161-byte string literal not displayed */
const BaseImageWith1LayerDigest = `sha256:c5207ce0f38da269ad2e58f143b5ea4b314c75ce1121384369f0db9015e10e82`
1 data layer of 128 B
const BaseImageWith2Layers = `` /* 2684-byte string literal not displayed */
const BaseImageWith2LayersDigest = "sha256:77371f61c054608a4bb1a96b99f9be69f0868340f5c924ecd8813172f7cf853d"
2 data layers, the first is shared with baseImageWith1Layer, total size of 240 B
const ChildImageWith2Layers = `` /* 3147-byte string literal not displayed */
const ChildImageWith2LayersDigest = "sha256:a9f073fbf2c9835711acd09081d87f5b7129ac6269e0df834240000f48abecd4"
based on baseImageWith1Layer, it adds a new data layer of 126 B
const ChildImageWith3Layers = `` /* 3662-byte string literal not displayed */
const ChildImageWith3LayersDigest = "sha256:2282a6d553353756fa43ba8672807d3fe81f8fdef54b0f6a360d64aaef2f243a"
based on baseImageWith2Layers, it adds a new data layer of 70 B
const InternalRegistryURL = "172.30.12.34:5000"
InternalRegistryURL is an url of internal docker registry for testing purposes.
const MiscImage = `` /* 2736-byte string literal not displayed */
const MiscImageDigest = "sha256:2643199e5ed5047eeed22da854748ed88b3a63ba0497601ba75852f7b92d4640"
another base image with unique data layer of 554 B
Variables ¶
This section is empty.
Functions ¶
func AssertDeletedStorageFiles ¶ added in v1.5.2
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 ¶ added in v1.5.2
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 ¶ added in v1.3.0
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 ¶ added in v1.3.0
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 ¶ added in v1.5.2
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 ¶ added in v1.5.2
DoesRegistryAcceptSchema2 returns true if the integrated registry is configured to accept manifest V2 schema 2.
func EnsureRegistryAcceptsSchema2 ¶ added in v1.5.2
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 ¶ added in v1.3.0
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 ¶ added in v1.5.2
func GetRegistryPod(podsGetter kcoreclient.PodsGetter) (*kapiv1.Pod, error)
GetRegistryPod returns the youngest registry pod deployed.
func GetRegistryStorageSize ¶ added in v1.5.2
GetRegistryStorageSize returns a number of bytes occupied by registry's data on its filesystem.
func IsBlobStoredInRegistry ¶ added in v1.5.2
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 ¶ added in v1.5.2
IsEmptyDigest returns true if the given digest matches one of empty blobs.
func LogRegistryPod ¶ added in v1.5.2
LogRegistryPod attempts to write registry log to a file in artifacts directory.
func MakeDockerImageReference ¶ added in v1.5.2
MakeDockerImageReference makes a docker image reference string referencing testing internal docker registry.
func MirrorBlobInRegistry ¶ added in v1.5.2
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 ¶ added in v1.5.2
func RecordConfigEvent ¶ added in v1.5.2
func RecordConfigEvent(client corev1client.EventsGetter, deployment *corev1.ReplicationController, eventType, reason, msg string)
deployment.
func RecordConfigWarnings ¶ added in v1.5.2
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 TestImageConfigImageStreamImportModeLegacy ¶ added in v1.5.2
func TestImageConfigImageStreamImportModeLegacy(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImageConfigImageStreamImportModePreserveOriginal ¶ added in v1.5.2
func TestImageConfigImageStreamImportModePreserveOriginal(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImageStreamAdmitSpecUpdate ¶ added in v1.5.2
func TestImageStreamAdmitSpecUpdate(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImageStreamAdmitStatusUpdate ¶ added in v1.5.2
func TestImageStreamAdmitStatusUpdate(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImageStreamImportMode ¶ added in v1.5.2
func TestImageStreamImportMode(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImageStreamMappingCreate ¶ added in v1.5.2
func TestImageStreamMappingCreate(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImageStreamTagLifecycleHook ¶ added in v1.5.2
func TestImageStreamTagLifecycleHook(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImageStreamTagsAdmission ¶ added in v1.5.2
func TestImageStreamTagsAdmission(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImageStreamWithoutDockerImageConfig ¶ added in v1.5.2
func TestImageStreamWithoutDockerImageConfig(t g.GinkgoTInterface, oc *exutil.CLI)
func TestImportImageFromBlockedRegistry ¶ added in v1.5.2
TestImportImageFromBlockedRegistry verifies users can't import images from a registry that is configured as blocked through images.config.openshift.io/cluster.
func TestImportImageFromInsecureRegistry ¶ added in v1.5.2
TestImportImageFromInsecureRegistry verifies api capability of importing images from insecure remote image registries. We support two ways of setting a registry as inscure: by setting it as insecure directly on an ImageStreamImport request or by setting it as insecure globally by adding it to InsecureRegistry on images.config.openshift.io/cluster.
func TestImportRepositoryFromBlockedRegistry ¶ added in v1.5.2
TestImportRepositoryFromBlockedRegistry verifies users can't import repositories from a registry that is configured as blocked through images.config.openshift.io/cluster.
func TestImportRepositoryFromInsecureRegistry ¶ added in v1.5.2
TestImportRepositoryFromInsecureRegistry verifies api capability of importing a repository from insecure remote registries. We support two ways of setting a registry as insecure: by setting it as insecure directly on an ImageStreamImport request or by setting it as insecure globally by adding it to InsecureRegistry config on images.config.openshift.io/cluster.
func TestMultipleImageChangeBuildTriggers ¶ added in v1.5.2
func TestMultipleImageChangeBuildTriggers(t g.GinkgoTInterface, oc *exutil.CLI)
func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustom ¶ added in v1.5.2
func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustom(t g.GinkgoTInterface, oc *exutil.CLI)
func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustomWithConfigChange ¶ added in v1.5.2
func TestSimpleImageChangeBuildTriggerFromImageStreamTagCustomWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)
func TestSimpleImageChangeBuildTriggerFromImageStreamTagDocker ¶ added in v1.5.2
func TestSimpleImageChangeBuildTriggerFromImageStreamTagDocker(t g.GinkgoTInterface, oc *exutil.CLI)
func TestSimpleImageChangeBuildTriggerFromImageStreamTagDockerWithConfigChange ¶ added in v1.5.2
func TestSimpleImageChangeBuildTriggerFromImageStreamTagDockerWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)
func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTI ¶ added in v1.5.2
func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTI(t g.GinkgoTInterface, oc *exutil.CLI)
func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTIWithConfigChange ¶ added in v1.5.2
func TestSimpleImageChangeBuildTriggerFromImageStreamTagSTIWithConfigChange(t g.GinkgoTInterface, oc *exutil.CLI)
Types ¶
type CleanUpContainer ¶ added in v1.5.2
CleanUpContainer holds names of image names, container image IDs, imagestreamtags and imagestreams that shall be deleted at the end of the test.
func NewCleanUpContainer ¶ added in v1.5.2
func NewCleanUpContainer(oc *exutil.CLI) *CleanUpContainer
NewCleanUpContainer creates a new instance of CleanUpContainer.
func (*CleanUpContainer) AddImage ¶ added in v1.5.2
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 ¶ added in v1.5.2
func (c *CleanUpContainer) AddImageStream(isName string)
AddImageStream marks the given image stream name for removal.
func (*CleanUpContainer) Run ¶ added in v1.5.2
func (c *CleanUpContainer) Run()
Run deletes all the marked objects.
type HookExecutor ¶ added in v1.5.2
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 ¶ added in v1.5.2
func NewHookExecutor(kubeClient kubernetes.Interface, imageClient imageclienttyped.ImageStreamTagsGetter, out io.Writer) HookExecutor
NewHookExecutor makes a HookExecutor from a client.
type RegistryConfiguration ¶ added in v1.5.2
RegistriConfiguration holds desired configuration options for the integrated registry. *nil* stands for "no change".
type RegistryStorageFiles ¶ added in v1.5.2
type RegistryStorageFiles struct {
Repos []string
ManifestLinks RepoLinks
LayerLinks RepoLinks
Blobs []string
}
func RunHardPrune ¶ added in v1.5.2
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 ¶ added in v1.5.2
func (sfs *RegistryStorageFiles) Len() int
Len returns a number of files contained in the sfs container.
func (*RegistryStorageFiles) ToPaths ¶ added in v1.5.2
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.