{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/68666","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/68666/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/68666/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/68666/events","html_url":"https://github.com/kubernetes/kubernetes/pull/68666","id":360221105,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NTI5NjM0","number":68666,"title":"reduce resource quota version conflict in controller","user":{"login":"Nebulazhang","id":28707161,"node_id":"MDQ6VXNlcjI4NzA3MTYx","avatar_url":"https://avatars3.githubusercontent.com/u/28707161?v=4","gravatar_id":"","url":"https://api.github.com/users/Nebulazhang","html_url":"https://github.com/Nebulazhang","followers_url":"https://api.github.com/users/Nebulazhang/followers","following_url":"https://api.github.com/users/Nebulazhang/following{/other_user}","gists_url":"https://api.github.com/users/Nebulazhang/gists{/gist_id}","starred_url":"https://api.github.com/users/Nebulazhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nebulazhang/subscriptions","organizations_url":"https://api.github.com/users/Nebulazhang/orgs","repos_url":"https://api.github.com/users/Nebulazhang/repos","events_url":"https://api.github.com/users/Nebulazhang/events{/privacy}","received_events_url":"https://api.github.com/users/Nebulazhang/received_events","type":"User","site_admin":false},"labels":[{"id":477397086,"node_id":"MDU6TGFiZWw0NzczOTcwODY=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":114509261,"node_id":"MDU6TGFiZWwxMTQ1MDkyNjE=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/kind/design","name":"kind/design","color":"c7def8","default":false},{"id":349530249,"node_id":"MDU6TGFiZWwzNDk1MzAyNDk=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/release-note-none","name":"release-note-none","color":"c2e0c6","default":false},{"id":125550211,"node_id":"MDU6TGFiZWwxMjU1NTAyMTE=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/sig/scheduling","name":"sig/scheduling","color":"d2b48c","default":false},{"id":253450793,"node_id":"MDU6TGFiZWwyNTM0NTA3OTM=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/XS","name":"size/XS","color":"009900","default":false}],"state":"open","locked":false,"assignee":{"login":"deads2k","id":8225098,"node_id":"MDQ6VXNlcjgyMjUwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/8225098?v=4","gravatar_id":"","url":"https://api.github.com/users/deads2k","html_url":"https://github.com/deads2k","followers_url":"https://api.github.com/users/deads2k/followers","following_url":"https://api.github.com/users/deads2k/following{/other_user}","gists_url":"https://api.github.com/users/deads2k/gists{/gist_id}","starred_url":"https://api.github.com/users/deads2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deads2k/subscriptions","organizations_url":"https://api.github.com/users/deads2k/orgs","repos_url":"https://api.github.com/users/deads2k/repos","events_url":"https://api.github.com/users/deads2k/events{/privacy}","received_events_url":"https://api.github.com/users/deads2k/received_events","type":"User","site_admin":false},"assignees":[{"login":"deads2k","id":8225098,"node_id":"MDQ6VXNlcjgyMjUwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/8225098?v=4","gravatar_id":"","url":"https://api.github.com/users/deads2k","html_url":"https://github.com/deads2k","followers_url":"https://api.github.com/users/deads2k/followers","following_url":"https://api.github.com/users/deads2k/following{/other_user}","gists_url":"https://api.github.com/users/deads2k/gists{/gist_id}","starred_url":"https://api.github.com/users/deads2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deads2k/subscriptions","organizations_url":"https://api.github.com/users/deads2k/orgs","repos_url":"https://api.github.com/users/deads2k/repos","events_url":"https://api.github.com/users/deads2k/events{/privacy}","received_events_url":"https://api.github.com/users/deads2k/received_events","type":"User","site_admin":false}],"milestone":null,"comments":13,"created_at":"2018-09-14T09:12:09Z","updated_at":"2018-11-19T06:41:15Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/68666","html_url":"https://github.com/kubernetes/kubernetes/pull/68666","diff_url":"https://github.com/kubernetes/kubernetes/pull/68666.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/68666.patch"},"body":"<!--  Thanks for sending a pull request!  Here are some tips for you:\r\n1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/guide#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide\r\n2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews\r\n3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/release-notes.md\r\n4. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests\r\n-->\r\n\r\n**What this PR does / why we need it**:\r\n\r\nWe can reduce resource quota version conflict.\r\n\r\n1. Before this PR:\r\nThere are some workers to call this function \"syncResourceQuotaFromKey\" parallel. In this function, resource quota will be update! Every worker will be blocking if the queue is empty. If some same keys come at the same time (because a quota key will be sent to controller every time delete a pod), every worker is awakened to deal with the same key. This will lead to update resource quota parallel and many version conflicts occur.\r\n\r\n2. After this PR:\r\nWorkers are not waiting, they will deal with the key per second. And only unique key will be hold in the queue. We can reduce many conflicts.\r\n\r\n3. Result:\r\nFirstly I create a quota. Secondly I create a deployment that there are 30 pod in this deployment. And I delete this deployment.\r\nBefore this optimization, I observe that there are many log like this `Operation cannot be fulfilled on resourcequotas \\\"pod-quota\\\": the object has been modified;`\r\nAfter this optimization, I observe only one log.\r\n\r\n4. Other Reason\r\nWe can reduce the possibility of pod create error by reducing resource quota version conflict. Because api-server will also update resource quota when we create a pod. Reducing concurrency of updating the same resource quota will reduce the conflict error by create pod!\r\n\r\n**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:\r\nFixes #\r\n#67761\r\n\r\n**Special notes for your reviewer**:\r\nMaybe there are similar problems in other controllers.\r\n\r\n**Release note**:\r\n\r\n<!--  Write your release note:\r\n1. Enter your extended release note in the below block. If the PR requires additional action from users \r\nswitching to the new release, include the string \"action required\".\r\n2. If no release note is required, just write \"NONE\".\r\n-->\r\n```release-note\r\nNONE\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/439787117","html_url":"https://github.com/kubernetes/kubernetes/pull/68666#issuecomment-439787117","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/68666","id":439787117,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTc4NzExNw==","user":{"login":"Nebulazhang","id":28707161,"node_id":"MDQ6VXNlcjI4NzA3MTYx","avatar_url":"https://avatars3.githubusercontent.com/u/28707161?v=4","gravatar_id":"","url":"https://api.github.com/users/Nebulazhang","html_url":"https://github.com/Nebulazhang","followers_url":"https://api.github.com/users/Nebulazhang/followers","following_url":"https://api.github.com/users/Nebulazhang/following{/other_user}","gists_url":"https://api.github.com/users/Nebulazhang/gists{/gist_id}","starred_url":"https://api.github.com/users/Nebulazhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nebulazhang/subscriptions","organizations_url":"https://api.github.com/users/Nebulazhang/orgs","repos_url":"https://api.github.com/users/Nebulazhang/repos","events_url":"https://api.github.com/users/Nebulazhang/events{/privacy}","received_events_url":"https://api.github.com/users/Nebulazhang/received_events","type":"User","site_admin":false},"created_at":"2018-11-19T06:41:15Z","updated_at":"2018-11-19T06:41:15Z","author_association":"NONE","body":"/retest"}}
{"actor":{"display_login":"Nebulazhang"}}