Skip to content

Registry quota reworked - #7930

Merged
openshift-bot merged 3 commits into
openshift:masterfrom
miminar:registry-quota-reworked
Mar 19, 2016
Merged

openshift-bot merged 3 commits into
openshift:masterfrom
miminar:registry-quota-reworked

Conversation

@miminar

@miminar miminar commented Mar 10, 2016

Copy link
Copy Markdown

Covers:

  • Removes size counting from quota evaluation
  • openshift.io/projectimagessize removed completely
  • openshift.io/imagestreamsize removed completely.
  • openshift.io/imagesize removed from quota evaluation.
  • Added a new resource openshift.io/images that allows to limit number of images tagged into a project.
  • Improves error messages of failed builds.

So instead of:

Error: build error: Failed to push image: unknown: requested access to the resource is denied

It will now show:

Error: build error: Failed to push image: Refusing to write blob exceeding quota: openshift.io/images limited to {4.000 DecimalSI} by {1.000 DecimalSI}~~

Improved error messages will come in another follow-up.

Does NOT cover:

  • openshift.io/imagesize being checked in limit range admission plugin
  • openshift.io/imagesize being checked in the registry

TODO:

  • - fix extended test
  • - remove openshift.io/projectimagessize as well

@miminar

miminar commented Mar 10, 2016

Copy link
Copy Markdown
Author

According to email discussion with @smarterclayton, I'll also remove the openshift.io/projectimagessize from quota evaluation and admission checks.

@miminar
miminar force-pushed the registry-quota-reworked branch from 1697db1 to fdc7593 Compare March 10, 2016 18:48
@miminar

miminar commented Mar 11, 2016

Copy link
Copy Markdown
Author

[test]

@miminar

miminar commented Mar 11, 2016

Copy link
Copy Markdown
Author

Found out an issue that needs to be addressed upstream. I'll submit there and update the commit message.

Update: upstream PR: kubernetes/kubernetes#22852

@miminar

miminar commented Mar 14, 2016

Copy link
Copy Markdown
Author

[test][extended:core(image resource quota)]

* TODO: this is now failing during the image import with following status:
* Reason:"Unauthorized", Message:"you may not have access to the Docker image \"172.30.163.69:5000/extended-test-imagequota-admission-6znr2-shared/src@sha256:bb08da7a0b99af72aebe0ead77009d28771a30dbe4d99f49bf3d29407c72e48f\""
* Uncomment once resolved (issue #7985).
* The import seems to be working when the source and destination namespaces are the same.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue #7985.

@miminar
miminar force-pushed the registry-quota-reworked branch from 329f573 to 0daf46e Compare March 14, 2016 13:03
@miminar miminar changed the title [WIP] Registry quota reworked Registry quota reworked Mar 14, 2016
}

// Usage returns a usage for an image stream tag.
func (c *imageStreamTagUsageComputer) Usage(object runtime.Object) kapi.ResourceList {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@derekwaynecarr This may be interesting to you.

miminar referenced this pull request in pweil-/origin Mar 14, 2016
@pweil- pweil- mentioned this pull request Mar 14, 2016
@miminar
miminar force-pushed the registry-quota-reworked branch 6 times, most recently from 9298350 to 1192d36 Compare March 16, 2016 11:07
@miminar

miminar commented Mar 16, 2016

Copy link
Copy Markdown
Author

Got successful run. @pweil-, @Kargakis could you please take a look?

},

{
name: "adding two new tags",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you also delete latest here, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I'll correct the description. Resolved.

…escribe is"

This reverts commit 469a082.

Signed-off-by: Michal Minar <[email protected]>
@miminar
miminar force-pushed the registry-quota-reworked branch from 1192d36 to 81ffbfe Compare March 16, 2016 14:27
@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/2303/) (Extended Tests: core(image resource quota))

@soltysh

soltysh commented Mar 18, 2016

Copy link
Copy Markdown
Contributor

Upstream is merged, tests are green.
[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/2303/) (Image: devenv-rhel7_3782)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 61b56fa

openshift-bot pushed a commit that referenced this pull request Mar 19, 2016
@openshift-bot
openshift-bot merged commit 5fa8a74 into openshift:master Mar 19, 2016
Comment thread pkg/quota/image/usage.go
// Returned object can be used just once and must be thrown away afterwards.
func NewGenericImageStreamUsageComputer(osClient osclient.Interface, processSpec bool, fetchImagesFromImageStream bool) *GenericImageStreamUsageComputer {
return &GenericImageStreamUsageComputer{
osClient,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always initialize structs with field names

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@smarterclayton

Copy link
Copy Markdown
Contributor

I responded to one of the earlier commits regarding enforcement of image stream tag count.

Comment thread pkg/quota/image/usage.go
) error {
processedImages := sets.NewString()

for tag, history := range is.Status.Tags {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop is poorly structured - it would be better to identify a full set of tags (unique) first, group them by their registry, and process them in order. As is you will fetch the same image multiple times if it is tagged, potentially list the same image streams multiple times, etc.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why the cache is utilized. But your idea makes sense and will improve readibility.

@smarterclayton

Copy link
Copy Markdown
Contributor

On a large set of images and image streams, what performance impact does enabling this have? Given the number of outstanding issues, the fact that we aren't sharing a cache, and the scope of the change, I'm not sure this is ready for use. I'd like an assessment of the memory and request impact when we have >100 images or image streams (this looks O(n^2) in places) and a follow up on the lines of the refactoring I mentioned, specifically the reuse of caches.

@smarterclayton

Copy link
Copy Markdown
Contributor

Judging by the queries you have to make in order for this to work, I'm starting to consider whether we need to implement the indices that stef requested for layer and image lookup per namespace and have the quota evaluator call that for calculating # of unique images per namespace.

@smarterclayton

Copy link
Copy Markdown
Contributor

Also, see my comment to the older commit that given the problems with this check in practice (that you don't know for sure on virtual resources whether they will result in a count change) we should not try to be precise here - have quota replenish consult for an accurate check post creation, and then simply fail if you are over quota (meaning you could get to some number of images more than that, but in practice it's almost impossible).

@smarterclayton

Copy link
Copy Markdown
Contributor

If no quota references this value, will we still construct these caches? If so, I think 1.2 needs to disable this by default and add a flag somewhere (admission?) to allow opt in enablement.

@miminar

miminar commented Mar 21, 2016

Copy link
Copy Markdown
Author

@smarterclayton

On a large set of images and image streams, what performance impact does enabling this have?

As mentioned earlier, the caches are thrownaway right after the use. The cache lasts only until an admission check or resource quota controller sync is finished.

Having 10 image streams in the namespace, each having 8 images plus 2 pointing to other project (each time different) will result in:

  • 1 list ImageStreams request
  • (8*10 + 2*10) get Image requests
  • 2*10 get ImageStream requests (in reality many of istags or isimages will refer to some common IS, so the O(n) << n).

When a single IS is being updated either with a CREATE ImageStreamMapping, UPDATE ImageStreamTag, or CREATE/UPDATE ImageStream.

Which is a lot indeed. It would make sense to share image cache because Image objects don't change that much and it would safe us a lot of bandwidth.

I'm starting to consider whether we need to implement the indices that stef requested for layer and image lookup per namespace and have the quota evaluator call that for calculating # of unique images per namespace.

👍

have quota replenish consult for an accurate check post creation, and then simply fail if you are over quota

I think the precise admission check is fine for ImageStreamImage references. ImageStreamTag should be IMHO treated the way you suggest.

If no quota references this value, will we still construct these caches?

No, caches are one shot only and will be constructed for some project only if the openshift.io/images quota is defined and IS is being created or modified.

@miminar miminar mentioned this pull request Mar 22, 2016
4 tasks done
@miminar
miminar deleted the registry-quota-reworked branch June 20, 2016 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants