{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/56743941","id":56743941,"diff_hunk":"@@ -0,0 +1,135 @@\n+package image\n+\n+import (\n+\t\"fmt\"\n+\t\"strings\"\n+\n+\t\"github.com/golang/glog\"\n+\n+\t\"k8s.io/kubernetes/pkg/admission\"\n+\tkapi \"k8s.io/kubernetes/pkg/api\"\n+\tkerrors \"k8s.io/kubernetes/pkg/api/errors\"\n+\t\"k8s.io/kubernetes/pkg/api/resource\"\n+\tkquota \"k8s.io/kubernetes/pkg/quota\"\n+\t\"k8s.io/kubernetes/pkg/runtime\"\n+\n+\tosclient \"github.com/openshift/origin/pkg/client\"\n+\timageapi \"github.com/openshift/origin/pkg/image/api\"\n+\tquotautil \"github.com/openshift/origin/pkg/quota/util\"\n+)\n+\n+const imageStreamTagEvaluatorName = \"Evaluator.ImageStreamTag\"\n+\n+// NewImageStreamTagEvaluator computes resource usage of ImageStreamsTags. It's sole purpose is to handle\n+// UPDATE admission operations on imageStreamTags resource.\n+func NewImageStreamTagEvaluator(osClient osclient.Interface) kquota.Evaluator {\n+\tcomputeResources := []kapi.ResourceName{\n+\t\timageapi.ResourceImages,\n+\t}\n+\n+\tmatchesScopeFunc := func(kapi.ResourceQuotaScope, runtime.Object) bool { return true }\n+\tgetFuncByNamespace := func(namespace, id string) (runtime.Object, error) {\n+\t\tnameParts := strings.SplitN(id, \":\", 2)\n+\t\tif len(nameParts) != 2 {\n+\t\t\treturn nil, fmt.Errorf(\"%q is an invalid id for an imagestreamtag. Must be in form <name>:<tag>.\", id)\n+\t\t}\n+\n+\t\tobj, err := osClient.ImageStreamTags(namespace).Get(nameParts[0], nameParts[1])\n+\t\tif err != nil {\n+\t\t\tif !kerrors.IsNotFound(err) {\n+\t\t\t\treturn nil, err\n+\t\t\t}\n+\t\t\tobj = &imageapi.ImageStreamTag{\n+\t\t\t\tObjectMeta: kapi.ObjectMeta{\n+\t\t\t\t\tNamespace: namespace,\n+\t\t\t\t\tName:      id,\n+\t\t\t\t},\n+\t\t\t}\n+\t\t}\n+\t\treturn obj, nil\n+\t}\n+\n+\treturn quotautil.NewSharedContextEvaluator(","path":"pkg/quota/image/imagestreamtag_evaluator.go","position":52,"original_position":52,"commit_id":"61b56fa4ebd754527d69bc308ed60c75e3d14acc","original_commit_id":"61b56fa4ebd754527d69bc308ed60c75e3d14acc","user":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","gravatar_id":"","url":"https://api.github.com/users/smarterclayton","html_url":"https://github.com/smarterclayton","followers_url":"https://api.github.com/users/smarterclayton/followers","following_url":"https://api.github.com/users/smarterclayton/following{/other_user}","gists_url":"https://api.github.com/users/smarterclayton/gists{/gist_id}","starred_url":"https://api.github.com/users/smarterclayton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarterclayton/subscriptions","organizations_url":"https://api.github.com/users/smarterclayton/orgs","repos_url":"https://api.github.com/users/smarterclayton/repos","events_url":"https://api.github.com/users/smarterclayton/events{/privacy}","received_events_url":"https://api.github.com/users/smarterclayton/received_events","type":"User","site_admin":false},"body":"This method has too many arguments, @derekwaynecarr should be a struct ","created_at":"2016-03-19T04:30:43Z","updated_at":"2016-03-19T04:30:43Z","html_url":"https://github.com/openshift/origin/pull/7930#discussion_r56743941","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/7930","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/56743941"},"html":{"href":"https://github.com/openshift/origin/pull/7930#discussion_r56743941"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/7930"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/7930","id":62425315,"html_url":"https://github.com/openshift/origin/pull/7930","diff_url":"https://github.com/openshift/origin/pull/7930.diff","patch_url":"https://github.com/openshift/origin/pull/7930.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/7930","number":7930,"state":"closed","locked":false,"title":"Registry quota reworked","user":{"login":"miminar","id":1478803,"avatar_url":"https://avatars.githubusercontent.com/u/1478803?v=3","gravatar_id":"","url":"https://api.github.com/users/miminar","html_url":"https://github.com/miminar","followers_url":"https://api.github.com/users/miminar/followers","following_url":"https://api.github.com/users/miminar/following{/other_user}","gists_url":"https://api.github.com/users/miminar/gists{/gist_id}","starred_url":"https://api.github.com/users/miminar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miminar/subscriptions","organizations_url":"https://api.github.com/users/miminar/orgs","repos_url":"https://api.github.com/users/miminar/repos","events_url":"https://api.github.com/users/miminar/events{/privacy}","received_events_url":"https://api.github.com/users/miminar/received_events","type":"User","site_admin":false},"body":"Covers:\r\n\r\n- Removes size counting from quota evaluation\r\n- `openshift.io/projectimagessize` removed completely\r\n- `openshift.io/imagestreamsize` removed completely.\r\n- `openshift.io/imagesize` removed from quota evaluation.\r\n- Added a new resource `openshift.io/images` that allows to limit number of images tagged into a project.\r\n- ~~Improves error messages of failed builds.~~\r\n\r\n~~So instead of:~~\r\n\r\n    Error: build error: Failed to push image: unknown: requested access to the resource is denied\r\n\r\n~~It will now show:~~\r\n\r\n    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}~~\r\n\r\nImproved error messages will come in another follow-up.\r\n\r\nDoes **NOT** cover:\r\n\r\n- `openshift.io/imagesize` being checked in limit range admission plugin\r\n- `openshift.io/imagesize` being checked in the registry\r\n\r\nTODO:\r\n\r\n- [x] - fix extended test\r\n- [x] - remove `openshift.io/projectimagessize` as well","created_at":"2016-03-10T17:25:03Z","updated_at":"2016-03-19T04:30:43Z","closed_at":"2016-03-19T00:08:30Z","merged_at":"2016-03-19T00:08:30Z","merge_commit_sha":"67e9e50f15b8c477931345ede6eeeefaf2be7053","assignee":{"login":"soltysh","id":576341,"avatar_url":"https://avatars.githubusercontent.com/u/576341?v=3","gravatar_id":"","url":"https://api.github.com/users/soltysh","html_url":"https://github.com/soltysh","followers_url":"https://api.github.com/users/soltysh/followers","following_url":"https://api.github.com/users/soltysh/following{/other_user}","gists_url":"https://api.github.com/users/soltysh/gists{/gist_id}","starred_url":"https://api.github.com/users/soltysh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soltysh/subscriptions","organizations_url":"https://api.github.com/users/soltysh/orgs","repos_url":"https://api.github.com/users/soltysh/repos","events_url":"https://api.github.com/users/soltysh/events{/privacy}","received_events_url":"https://api.github.com/users/soltysh/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/7930/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/7930/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/7930/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/61b56fa4ebd754527d69bc308ed60c75e3d14acc","head":{"label":"miminar:registry-quota-reworked","ref":"registry-quota-reworked","sha":"61b56fa4ebd754527d69bc308ed60c75e3d14acc","user":{"login":"miminar","id":1478803,"avatar_url":"https://avatars.githubusercontent.com/u/1478803?v=3","gravatar_id":"","url":"https://api.github.com/users/miminar","html_url":"https://github.com/miminar","followers_url":"https://api.github.com/users/miminar/followers","following_url":"https://api.github.com/users/miminar/following{/other_user}","gists_url":"https://api.github.com/users/miminar/gists{/gist_id}","starred_url":"https://api.github.com/users/miminar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miminar/subscriptions","organizations_url":"https://api.github.com/users/miminar/orgs","repos_url":"https://api.github.com/users/miminar/repos","events_url":"https://api.github.com/users/miminar/events{/privacy}","received_events_url":"https://api.github.com/users/miminar/received_events","type":"User","site_admin":false},"repo":{"id":36652057,"name":"origin","full_name":"miminar/origin","owner":{"login":"miminar","id":1478803,"avatar_url":"https://avatars.githubusercontent.com/u/1478803?v=3","gravatar_id":"","url":"https://api.github.com/users/miminar","html_url":"https://github.com/miminar","followers_url":"https://api.github.com/users/miminar/followers","following_url":"https://api.github.com/users/miminar/following{/other_user}","gists_url":"https://api.github.com/users/miminar/gists{/gist_id}","starred_url":"https://api.github.com/users/miminar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miminar/subscriptions","organizations_url":"https://api.github.com/users/miminar/orgs","repos_url":"https://api.github.com/users/miminar/repos","events_url":"https://api.github.com/users/miminar/events{/privacy}","received_events_url":"https://api.github.com/users/miminar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miminar/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/miminar/origin","forks_url":"https://api.github.com/repos/miminar/origin/forks","keys_url":"https://api.github.com/repos/miminar/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miminar/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miminar/origin/teams","hooks_url":"https://api.github.com/repos/miminar/origin/hooks","issue_events_url":"https://api.github.com/repos/miminar/origin/issues/events{/number}","events_url":"https://api.github.com/repos/miminar/origin/events","assignees_url":"https://api.github.com/repos/miminar/origin/assignees{/user}","branches_url":"https://api.github.com/repos/miminar/origin/branches{/branch}","tags_url":"https://api.github.com/repos/miminar/origin/tags","blobs_url":"https://api.github.com/repos/miminar/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miminar/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miminar/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/miminar/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miminar/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/miminar/origin/languages","stargazers_url":"https://api.github.com/repos/miminar/origin/stargazers","contributors_url":"https://api.github.com/repos/miminar/origin/contributors","subscribers_url":"https://api.github.com/repos/miminar/origin/subscribers","subscription_url":"https://api.github.com/repos/miminar/origin/subscription","commits_url":"https://api.github.com/repos/miminar/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/miminar/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/miminar/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/miminar/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/miminar/origin/contents/{+path}","compare_url":"https://api.github.com/repos/miminar/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miminar/origin/merges","archive_url":"https://api.github.com/repos/miminar/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miminar/origin/downloads","issues_url":"https://api.github.com/repos/miminar/origin/issues{/number}","pulls_url":"https://api.github.com/repos/miminar/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/miminar/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/miminar/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miminar/origin/labels{/name}","releases_url":"https://api.github.com/repos/miminar/origin/releases{/id}","deployments_url":"https://api.github.com/repos/miminar/origin/deployments","created_at":"2015-06-01T09:53:10Z","updated_at":"2016-01-14T09:43:02Z","pushed_at":"2016-03-18T15:16:00Z","git_url":"git://github.com/miminar/origin.git","ssh_url":"git@github.com:miminar/origin.git","clone_url":"https://github.com/miminar/origin.git","svn_url":"https://github.com/miminar/origin","homepage":"http://www.openshift.org","size":231642,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"79e75d17e52191718c88cdc262f4e93b5d6610d1","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"The Continuous Application Platform - build, deploy, and manage cloud-native and legacy applications on Kubernetes and Docker","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/origin/deployments","created_at":"2014-07-30T20:04:05Z","updated_at":"2016-03-18T14:43:23Z","pushed_at":"2016-03-19T04:24:27Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":308538,"stargazers_count":1132,"watchers_count":1132,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":703,"mirror_url":null,"open_issues_count":965,"forks":703,"open_issues":965,"watchers":1132,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/7930"},"html":{"href":"https://github.com/openshift/origin/pull/7930"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/7930"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/7930/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/7930/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/7930/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/61b56fa4ebd754527d69bc308ed60c75e3d14acc"}}}}