prune

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobPruneFunc

type BlobPruneFunc func(registryURL, blob string) error

func DeletingBlobPruneFunc

func DeletingBlobPruneFunc(registryClient *http.Client) BlobPruneFunc

DeletingBlobPruneFunc returns a BlobPruneFunc that uses registryClient to send a blob deletion request to the registry.

type ImagePruneFunc

type ImagePruneFunc func(image *imageapi.Image) error

ImagePruneFunc is a function that is invoked for each image that is prunable.

func DeletingImagePruneFunc

func DeletingImagePruneFunc(images client.ImageInterface) ImagePruneFunc

DeletingImagePruneFunc returns an ImagePruneFunc that deletes the image.

type ImagePruner

type ImagePruner interface {
	// Run prunes images and layers.
	Run(pruneImage ImagePruneFunc, pruneStream ImageStreamPruneFunc, pruneLayer LayerPruneFunc, pruneBlob BlobPruneFunc, pruneManifest ManifestPruneFunc)
}

ImagePruner knows how to prune images and layers.

func NewImagePruner

func NewImagePruner(keepYoungerThan time.Duration, tagRevisionsToKeep int, images *imageapi.ImageList, streams *imageapi.ImageStreamList, pods *kapi.PodList, rcs *kapi.ReplicationControllerList, bcs *buildapi.BuildConfigList, builds *buildapi.BuildList, dcs *deployapi.DeploymentConfigList) ImagePruner

NewImagePruner creates a new ImagePruner.

Images younger than keepYoungerThan and images referenced by image streams and/or pods younger than keepYoungerThan are preserved. All other images are candidates for pruning. For example, if keepYoungerThan is 60m, and an ImageStream is only 59 minutes old, none of the images it references are eligible for pruning.

tagRevisionsToKeep is the number of revisions per tag in an image stream's status.tags that are preserved and ineligible for pruning. Any revision older than tagRevisionsToKeep is eligible for pruning.

images, streams, pods, rcs, bcs, builds, and dcs are the resources used to run the pruning algorithm. These should be the full list for each type from the cluster; otherwise, the pruning algorithm might result in incorrect calculations and premature pruning.

The ImagePruner performs the following logic: remove any image contaning the annotation openshift.io/image.managed=true that was created at least *n* minutes ago and is *not* currently referenced by:

- any pod created less than *n* minutes ago - any image stream created less than *n* minutes ago - any running pods - any pending pods - any replication controllers - any deployment configs - any build configs - any builds - the n most recent tag revisions in an image stream's status.tags

When removing an image, remove all references to the image from all ImageStreams having a reference to the image in `status.tags`.

Also automatically remove any image layer that is no longer referenced by any images.

type ImageStreamPruneFunc

type ImageStreamPruneFunc func(stream *imageapi.ImageStream, image *imageapi.Image) (*imageapi.ImageStream, error)

func DeletingImageStreamPruneFunc

func DeletingImageStreamPruneFunc(streams client.ImageStreamsNamespacer) ImageStreamPruneFunc

DeletingImageStreamPruneFunc returns an ImageStreamPruneFunc that deletes the imageStream.

type LayerPruneFunc

type LayerPruneFunc func(registryURL, repo, layer string) error

func DeletingLayerPruneFunc

func DeletingLayerPruneFunc(registryClient *http.Client) LayerPruneFunc

DeletingLayerPruneFunc returns a LayerPruneFunc that uses registryClient to send a layer deletion request to the registry.

The request URL is http://registryURL/admin/<repo>/layers/<digest> and it is a DELETE request.

type ManifestPruneFunc

type ManifestPruneFunc func(registryURL, repo, manifest string) error

func DeletingManifestPruneFunc

func DeletingManifestPruneFunc(registryClient *http.Client) ManifestPruneFunc

DeletingManifestPruneFunc returns a ManifestPruneFunc that uses registryClient to send a manifest deletion request to the registry.

Jump to

Keyboard shortcuts

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