image

package
v1.2.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package image implements evaluators of usage for images stored in an internal registry. They are supposed to be passed to resource quota controller and origin resource quota admission plugin. As opposed to kubernetes evaluators that can be used both with the controller and an admission plugin, these cannot. That's because they're counting a number of unique images which aren't namespaced. In order to do that they always need to enumerate all image streams in the project to see whether the newly tagged images are new to the project or not. The resource quota controller iterates over them implicitly while the admission plugin invokes the evaluator just once on a single object. Thus different usage implementations.

To instantiate a registry for use with the resource quota controller, use NewImageRegistry. To instantiate a registry for use with the origin resource quota admission plugin, use NewImageRegistryForAdmission.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewImageRegistry

func NewImageRegistry(osClient osclient.Interface) quota.Registry

NewImageRegistry returns a registry for quota evaluation of OpenShift resources related to images in internal registry. It evaluates only image streams. This registry is supposed to be used with resource quota controller. Contained evaluators aren't usable for admission because they assume the Usage method to be called on all images in the project.

func NewImageRegistryForAdmission added in v1.1.5

func NewImageRegistryForAdmission(osClient osclient.Interface) quota.Registry

NewImageRegistryForAdmission returns a registry for quota evaluation of OpenShift resources related to images in internal registry. Returned registry is supposed to be used with origin resource quota admission plugin. It evaluates image streams, image stream mappings and image stream tags. It cannot be passed to resource quota controller because contained evaluators return just usage increments.

func NewImageStreamAdmissionEvaluator added in v1.1.5

func NewImageStreamAdmissionEvaluator(osClient osclient.Interface) kquota.Evaluator

NewImageStreamAdmissionEvaluator computes resource usage of ImageStreams in the context of admission plugin.

func NewImageStreamEvaluator

func NewImageStreamEvaluator(osClient osclient.Interface) kquota.Evaluator

NewImageStreamEvaluator computes resource usage of ImageStreams. Instantiating this is necessary for resource quota admission controller to properly work on image stream related objects.

func NewImageStreamMappingEvaluator

func NewImageStreamMappingEvaluator(osClient osclient.Interface) kquota.Evaluator

NewImageStreamMappingEvaluator computes resource usage for ImageStreamMapping objects. This particular kind is a virtual resource. It depends on ImageStream usage evaluator to compute image numbers before the the admission can work.

func NewImageStreamTagEvaluator added in v1.1.5

func NewImageStreamTagEvaluator(osClient osclient.Interface) kquota.Evaluator

NewImageStreamTagEvaluator computes resource usage of ImageStreamsTags. Its sole purpose is to handle UPDATE admission operations on imageStreamTags resource.

Types

type GenericImageStreamUsageComputer added in v1.1.5

type GenericImageStreamUsageComputer struct {
	// contains filtered or unexported fields
}

GenericImageStreamUsageComputer allows to compute number of images stored in an internal registry in particular namespace.

func NewGenericImageStreamUsageComputer added in v1.1.5

func NewGenericImageStreamUsageComputer(osClient osclient.Interface, processSpec bool, fetchImagesFromImageStream bool) *GenericImageStreamUsageComputer

NewGenericImageStreamUsageComputer returns an instance of GenericImageStreamUsageComputer. Returned object can be used just once and must be thrown away afterwards.

func (*GenericImageStreamUsageComputer) GetImageStreamUsage added in v1.1.5

func (c *GenericImageStreamUsageComputer) GetImageStreamUsage(
	is *imageapi.ImageStream,
	processedImages sets.String,
) *resource.Quantity

GetImageStreamUsage counts number of unique internally managed images occupying given image stream. Each Images given in processedImages won't be taken into account. The set will be updated with new images found.

func (*GenericImageStreamUsageComputer) GetProjectImagesUsage added in v1.1.5

func (c *GenericImageStreamUsageComputer) GetProjectImagesUsage(namespace string) (*resource.Quantity, error)

GetProjectImagesUsage returns a number of internally managed images tagged in the given namespace.

func (*GenericImageStreamUsageComputer) GetProjectImagesUsageIncrement added in v1.1.5

func (c *GenericImageStreamUsageComputer) GetProjectImagesUsageIncrement(
	namespace string,
	is *imageapi.ImageStream,
	image *imageapi.Image,
) (images, imagesIncrement *resource.Quantity, err error)

GetProjectImagesUsageIncrement computes image count in the namespace for given image stream (new or updated) and new image. It returns:

  1. number of images currently tagged in the namespace; the image and images tagged in the given is don't count unless they are tagged in other is as well
  2. number of new internally managed images referenced either by the is or by the image
  3. an error if something goes wrong

Jump to

Keyboard shortcuts

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