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 ¶
- func NewImageRegistry(osClient osclient.Interface) quota.Registry
- func NewImageRegistryForAdmission(osClient osclient.Interface) quota.Registry
- func NewImageStreamAdmissionEvaluator(osClient osclient.Interface) kquota.Evaluator
- func NewImageStreamEvaluator(osClient osclient.Interface) kquota.Evaluator
- func NewImageStreamMappingEvaluator(osClient osclient.Interface) kquota.Evaluator
- func NewImageStreamTagEvaluator(osClient osclient.Interface) kquota.Evaluator
- type GenericImageStreamUsageComputer
- func (c *GenericImageStreamUsageComputer) GetImageStreamUsage(is *imageapi.ImageStream, processedImages sets.String) *resource.Quantity
- func (c *GenericImageStreamUsageComputer) GetProjectImagesUsage(namespace string) (*resource.Quantity, error)
- func (c *GenericImageStreamUsageComputer) GetProjectImagesUsageIncrement(namespace string, is *imageapi.ImageStream, image *imageapi.Image) (images, imagesIncrement *resource.Quantity, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewImageRegistry ¶
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
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
NewImageStreamAdmissionEvaluator computes resource usage of ImageStreams in the context of admission plugin.
func NewImageStreamEvaluator ¶
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 ¶
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.
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:
- 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
- number of new internally managed images referenced either by the is or by the image
- an error if something goes wrong