Skip to content

Repository and image quota support - #7128

Merged
openshift-bot merged 6 commits into
openshift:masterfrom
miminar:image-quotas
Mar 2, 2016
Merged

openshift-bot merged 6 commits into
openshift:masterfrom
miminar:image-quotas

Conversation

@miminar

@miminar miminar commented Feb 8, 2016

Copy link
Copy Markdown

New resource quotas:

  1. openshift.io/projectimagessize
  2. openshift.io/imagestreamsize
  3. openshift.io/imagesize

The 1st allows to set a limit for a sum of sizes of all image layers
accross all repositories in a namespace.

The 2nd allows to set a limit for a sum of sizes of all image layers
in a single repository. Usage will always be 0 because we cannot store
different values for different repositories.

The 3rd allows to set a limit for a sum of sizes of all layers of
single image. Usage will always be 0.

Layers occuring multiple times in a single repository count just once.

TODO:

  • write godocs
  • avoid patching upstream GenericEvaluator, write our own instead
  • fix tests
  • write tests

@miminar

miminar commented Feb 8, 2016

Copy link
Copy Markdown
Author

cc @Kargakis, @soltysh, @derekwaynecarr

@derekwaynecarr

Copy link
Copy Markdown
Member

I actually did not find the names bad, but we can't patch upstream to allow non-namespace resource prefixes.

@derekwaynecarr

Copy link
Copy Markdown
Member

fwiw, I rebased the PR this builds on: kubernetes/kubernetes#20446

@derekwaynecarr

Copy link
Copy Markdown
Member

A number of questions, but for the most part, I think this validates I didn't waste my time with the upstream refactor.

@soltysh

soltysh commented Feb 10, 2016

Copy link
Copy Markdown
Contributor

@miminar I did first pass, it generally looks good, a few comments here and there, but most importantly the question that pops in my head after going through what about the origin update use-case, where you already have existing images. From looking at the code I see you'll apply the quota only to newly created images, is that intentional? Do we expect some migration/update tool to handle that?

@miminar

miminar commented Feb 10, 2016

Copy link
Copy Markdown
Author

@soltysh I doubt anyone would like resourcequota controller start deleting existing images when he updates or even when he set the quotas on existing project. Even if wanted to handle the case, how would we choose the images to delete?

I'd rather just let admins list images/repositories exceeding quotas and let them decide. We could also extend oadm prune images to recognize images exceeding openshift.io/imagesize quota.

That's something to do in a follow-up though.

@miminar

miminar commented Feb 11, 2016

Copy link
Copy Markdown
Author
  • rebased on newer 20446
  • renamed totalimagesize to projectimagessize
  • renamed repositorysize to imagestreamsize
  • added extended test
  • fixes

@miminar

miminar commented Feb 12, 2016

Copy link
Copy Markdown
Author

A number of questions, but for the most part, I think this validates I didn't waste my time with the upstream refactor.

@derekwaynecarr you certainly did not, thanks for the great job and suggestions.

* 1. Origin master calculates image sizes from the contents of the layers. Registry, on the other hand,
* deals with layers themselves which contain some overhead required to store file attributes, and the
* layers are compressed. Thus we compare apples with peers. The check is primarily useful when the
* quota is already almost reached.

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.

@ncdc can you please take a look? Does this makes sense?

@miminar
miminar force-pushed the image-quotas branch 2 times, most recently from 5a00f6f to d1920f6 Compare February 15, 2016 12:51
@miminar miminar changed the title WIP: Repository and image quota support Repository and image quota support Feb 15, 2016
@miminar

miminar commented Feb 15, 2016

Copy link
Copy Markdown
Author

[test]

@miminar

miminar commented Feb 15, 2016

Copy link
Copy Markdown
Author

@soltysh could you give it another look, please?

@soltysh

soltysh commented Feb 15, 2016

Copy link
Copy Markdown
Contributor

On it...

@soltysh

soltysh commented Feb 15, 2016

Copy link
Copy Markdown
Contributor

This LGTM, fix tests.

Squash following commits into one:

And these two into one as well (separate from previous):

  • Allow registry to fetch resourcequota (miminar@b9433ea)
  • Added additional quota check for layer upload in a registry (a831adf)

@miminar

miminar commented Feb 15, 2016

Copy link
Copy Markdown
Author

@soltysh Thanks! squashed. re-[test][extended:core(image resource quota)]

@soltysh

soltysh commented Feb 15, 2016

Copy link
Copy Markdown
Contributor

LGTM, although it looks like one of your extended tests is failing.

This PR will be merged once #7269 lands.

@miminar

miminar commented Feb 15, 2016

Copy link
Copy Markdown
Author

Hmm, it looks like Docker 1.8.2 rounds built layers to multiples of 2^10 B. I'll have to tune layer sizes.

@ncdc

ncdc commented Feb 15, 2016

Copy link
Copy Markdown
Contributor

Need to make sure things are good with 1.8.2, 1.9.x, 1.10.x if possible.

@miminar

miminar commented Feb 15, 2016

Copy link
Copy Markdown
Author

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

@miminar

miminar commented Feb 16, 2016

Copy link
Copy Markdown
Author

So the extended test is passing now, but there was also this flake:

Error from server: error when replacing "STDIN": error #0: client: etcd member https://172.18.9.140:4001 has no leader
!!! Error in /data/src/github.com/openshift/origin/hack/util.sh:592
    'oc replace scc privileged -f - --config="${ADMIN_KUBECONFIG}"' exited with status 0 0 1
Call stack:
    1: /data/src/github.com/openshift/origin/hack/util.sh:592 install_router(...)
    2: test/extended/core.sh:71 main(...)
Exiting with status 1

In job 10939. Flake #7243.

@miminar

miminar commented Mar 2, 2016

Copy link
Copy Markdown
Author

Looks like a new flake #7729 in both runs. re-[test].

Running hack/../test/cmd/builds.sh:52: executing 'oc new-build -D $'FROM openshift/origin:v1.1\nENV ok=1' --to origin-test:v1.1' expecting success...
FAILURE after 2.031s: hack/../test/cmd/builds.sh:52: executing 'oc new-build -D $'FROM openshift/origin:v1.1\nENV ok=1' --to origin-test:v1.1' expecting success: the command returned the wrong error code
There was no output from the command.
Standard error from the command:
error: multiple images or templates matched "openshift/origin:v1.1": 27

@soltysh

soltysh commented Mar 2, 2016

Copy link
Copy Markdown
Contributor

Flakes from #7662 and #7355, I wonder it it's possible to have clean run on this one :/ I will retest and merg after next tests if it get at least one clean run out of the two.

re-[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 0ab320b

@miminar

miminar commented Mar 2, 2016

Copy link
Copy Markdown
Author

Actually, there was a SUCCESS run at 10:11 AM CET 😄

@openshift-bot

Copy link
Copy Markdown
Contributor

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

@soltysh

soltysh commented Mar 2, 2016

Copy link
Copy Markdown
Contributor

ALL GREEN!!!
[merge]

@pweil-

pweil- commented Mar 2, 2016

Copy link
Copy Markdown

🎉 🍰

@soltysh

soltysh commented Mar 2, 2016

Copy link
Copy Markdown
Contributor

Flake #7734:
re-[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 0ab320b

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5170/) (Image: devenv-rhel7_3588)

openshift-bot pushed a commit that referenced this pull request Mar 2, 2016
@openshift-bot
openshift-bot merged commit 528263a into openshift:master Mar 2, 2016
@soltysh

soltysh commented Mar 2, 2016

Copy link
Copy Markdown
Contributor

🎉

@smarterclayton

Copy link
Copy Markdown
Contributor

The 1st allows to set a limit for a sum of sizes of all image layers all repositories in a namespace.

How is this enforced when images are tagged via image stream (imagestreamtag)? We don't call admission controllers then.

@miminar

miminar commented Mar 3, 2016

Copy link
Copy Markdown
Author

@smarterclayton do we want to count imagestreamtags at all? The layers are not created in the registry because the image isn't pushed. If we delete the image, it won't be available under any istag. We can't even pull an image manually from an istag:

$ oc tag -n tmp tmp/hello-world@sha256:bb5c16ecd58633d4088140acb6ee386c5c3b09a8f03c517a288093415f0c09d1 mybase:latest
$ docker pull 172.30.150.240:5000/tmp/mybase:latest
Trying to pull repository 172.30.150.240:5000/tmp/mybase-world ... latest: Pulling from tmp/mybase
b901d36b6f2f: Pulling fs layer 
0a6ba66e537a: Pulling fs layer 
not found
Error: image tmp/mybase:latest not found

Currently the istag is being added to the project's usage although it doesn't go through the admission check. Which is clearly wrong. The question is do we want to count it and admit it or ignore it completely? I'm in favor of the latter.

Actually, wouldn't it be better to re-push the tagged image into the internal registry under a new name if we refer to an internally managed image?

@smarterclayton

smarterclayton commented Mar 3, 2016 via email

Copy link
Copy Markdown
Contributor

@miminar

miminar commented Mar 3, 2016

Copy link
Copy Markdown
Author

docker-1.9.1-16.el7.x86_64

@ncdc

ncdc commented Mar 3, 2016

Copy link
Copy Markdown
Contributor

@miminar was that a copy/paste error? You asked docker to pull tmp/mybase:latest and it says it's pulling tmp/mybase-world?

@miminar

miminar commented Mar 3, 2016

Copy link
Copy Markdown
Author

@ncdc no, I changed the repo names and missed one -world occurence. I'll re-paste without modification with docker 1.8.

@ncdc

ncdc commented Mar 3, 2016

Copy link
Copy Markdown
Contributor

It might also be worthwhile running docker in debug mode (-D) to capture more verbose output from the daemon.

@miminar

miminar commented Mar 3, 2016

Copy link
Copy Markdown
Author

Instead of posting it here, see the gist.

I don't understand, how the pull could succeed for a tag created with oc tag if the layers aren't linked in to the repository of registry's storage.

Here is the debug log of Docker for the failed pull from ist.

@smarterclayton

smarterclayton commented Mar 3, 2016 via email

Copy link
Copy Markdown
Contributor

@miminar

miminar commented Mar 3, 2016

Copy link
Copy Markdown
Author

@smarterclayton yes, but you won't be able to pull it.

Update: so actually no... I don't consider it a quota abuse or work around. No new data are stored in the registry when just tagged and if the original image or imagestream is deleted, access to the image is lost.

@smarterclayton

Copy link
Copy Markdown
Contributor

You should be able to pull it - if not, that's a bug.

On Mar 3, 2016, at 10:53 AM, Michal Minar [email protected] wrote:

@smarterclayton https://github.com/smarterclayton yes, but you won't be
able to pull it.

—
Reply to this email directly or view it on GitHub
#7128 (comment).

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.

8 participants