{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/autoscaler/pulls/comments/172207002","pull_request_review_id":101176081,"id":172207002,"diff_hunk":"@@ -85,44 +101,62 @@ func (calc *UpdatePriorityCalculator) GetSortedPods() []*apiv1.Pod {\n \treturn result\n }\n \n-func (calc *UpdatePriorityCalculator) getUpdatePriority(pod *apiv1.Pod, recommendation *vpa_types.RecommendedPodResources) float64 {\n-\tvar priority float64\n+func (calc *UpdatePriorityCalculator) getUpdatePriority(pod *apiv1.Pod, recommendation *vpa_types.RecommendedPodResources) podPriority {\n+\toutsideRecommendedRange := false\n+\tscaleUp := false\n+\t// Sum of requests over all containers, per resource type.\n+\ttotalRequestPerResource := make(map[apiv1.ResourceName]int64)\n+\t// Sum of recommendations over all containers, per resource type.\n+\ttotalRecommendedPerResource := make(map[apiv1.ResourceName]int64)\n \n \tfor _, podContainer := range pod.Spec.Containers {\n \t\trecommendedRequest, err := vpa_api_util.GetCappedRecommendationForContainer(podContainer, recommendation, calc.resourcesPolicy)\n \t\tif err != nil {\n \t\t\tglog.V(2).Infof(\"no recommendation for container %v in pod %v\", podContainer.Name, pod.Name)\n \t\t\tcontinue\n \t\t}\n-\t\tfor resourceName, recommended := range recommendedRequest {\n-\t\t\tvar requested *resource.Quantity\n-\n-\t\t\tif request, ok := podContainer.Resources.Requests[resourceName]; ok {\n-\t\t\t\trequested = &request\n+\t\tfor resourceName, recommended := range recommendedRequest.Target {\n+\t\t\ttotalRecommendedPerResource[resourceName] += recommended.MilliValue()\n+\t\t\tminRecommneded, hasMin := recommendedRequest.MinRecommended[resourceName]\n+\t\t\tmaxRecommneded, hasMax := recommendedRequest.MaxRecommended[resourceName]\n+\t\t\tif request, hasRequest := podContainer.Resources.Requests[resourceName]; hasRequest {\n+\t\t\t\ttotalRequestPerResource[resourceName] += request.MilliValue()\n+\t\t\t\tif recommended.MilliValue() > request.MilliValue() {\n+\t\t\t\t\tscaleUp = true\n+\t\t\t\t}\n+\t\t\t\tif (hasMin && request.MilliValue() < minRecommneded.MilliValue()) ||\n+\t\t\t\t\t(hasMax && request.MilliValue() > maxRecommneded.MilliValue()) {\n+\t\t\t\t\toutsideRecommendedRange = true\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tscaleUp = true\n+\t\t\t\toutsideRecommendedRange = true","path":"vertical-pod-autoscaler/updater/priority/update_priority_calculator.go","position":106,"original_position":106,"commit_id":"be7cc7feb8a036cd735fb66b7735b2b3e3186d59","original_commit_id":"be7cc7feb8a036cd735fb66b7735b2b3e3186d59","user":{"login":"schylek","id":35226731,"avatar_url":"https://avatars2.githubusercontent.com/u/35226731?v=4","gravatar_id":"","url":"https://api.github.com/users/schylek","html_url":"https://github.com/schylek","followers_url":"https://api.github.com/users/schylek/followers","following_url":"https://api.github.com/users/schylek/following{/other_user}","gists_url":"https://api.github.com/users/schylek/gists{/gist_id}","starred_url":"https://api.github.com/users/schylek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schylek/subscriptions","organizations_url":"https://api.github.com/users/schylek/orgs","repos_url":"https://api.github.com/users/schylek/repos","events_url":"https://api.github.com/users/schylek/events{/privacy}","received_events_url":"https://api.github.com/users/schylek/received_events","type":"User","site_admin":false},"body":"AFAIU this code if we start new pod without request it will be evicted immediately just to assign request. Seems dangerous - I would prefer to let such pod live until we get better confidence in recommendation or it dies by itself (but giving us some usage samples before that)","created_at":"2018-03-05T14:40:15Z","updated_at":"2018-03-05T14:47:29Z","html_url":"https://github.com/kubernetes/autoscaler/pull/690#discussion_r172207002","pull_request_url":"https://api.github.com/repos/kubernetes/autoscaler/pulls/690","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/autoscaler/pulls/comments/172207002"},"html":{"href":"https://github.com/kubernetes/autoscaler/pull/690#discussion_r172207002"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/autoscaler/pulls/690"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/autoscaler/pulls/690","id":172818841,"html_url":"https://github.com/kubernetes/autoscaler/pull/690","diff_url":"https://github.com/kubernetes/autoscaler/pull/690.diff","patch_url":"https://github.com/kubernetes/autoscaler/pull/690.patch","issue_url":"https://api.github.com/repos/kubernetes/autoscaler/issues/690","number":690,"state":"open","locked":false,"title":"Extend the Updater policy with new rules","user":{"login":"kgrygiel","id":13944462,"avatar_url":"https://avatars0.githubusercontent.com/u/13944462?v=4","gravatar_id":"","url":"https://api.github.com/users/kgrygiel","html_url":"https://github.com/kgrygiel","followers_url":"https://api.github.com/users/kgrygiel/followers","following_url":"https://api.github.com/users/kgrygiel/following{/other_user}","gists_url":"https://api.github.com/users/kgrygiel/gists{/gist_id}","starred_url":"https://api.github.com/users/kgrygiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgrygiel/subscriptions","organizations_url":"https://api.github.com/users/kgrygiel/orgs","repos_url":"https://api.github.com/users/kgrygiel/repos","events_url":"https://api.github.com/users/kgrygiel/events{/privacy}","received_events_url":"https://api.github.com/users/kgrygiel/received_events","type":"User","site_admin":false},"body":"1. Update priority is calculated based on the ratio between the total request and total recommended target for all containers, as opposed to sum of ratio for each container (previous policy favored many small containers).\r\n2. Pods with a container that needs to grow get higher priority.\r\n3. Pods with any request outside the [MinRecommended...MaxRecommended] range can be updated regardless of the relative diff between request and target.\r\n4. Pods with all requests within the [MinRecommended...MaxRecommended] range can be updated if they live for at least 12h and the relative diff exceeds the threshold.","created_at":"2018-03-05T09:52:41Z","updated_at":"2018-03-05T14:47:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1f5eec30eb01af6b2d65cc4ae6ae3643b5fe8d9d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":586404823,"url":"https://api.github.com/repos/kubernetes/autoscaler/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":675980930,"url":"https://api.github.com/repos/kubernetes/autoscaler/labels/size/L","name":"size/L","color":"ee9900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/autoscaler/pulls/690/commits","review_comments_url":"https://api.github.com/repos/kubernetes/autoscaler/pulls/690/comments","review_comment_url":"https://api.github.com/repos/kubernetes/autoscaler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/autoscaler/issues/690/comments","statuses_url":"https://api.github.com/repos/kubernetes/autoscaler/statuses/be7cc7feb8a036cd735fb66b7735b2b3e3186d59","head":{"label":"kgrygiel:master","ref":"master","sha":"be7cc7feb8a036cd735fb66b7735b2b3e3186d59","user":{"login":"kgrygiel","id":13944462,"avatar_url":"https://avatars0.githubusercontent.com/u/13944462?v=4","gravatar_id":"","url":"https://api.github.com/users/kgrygiel","html_url":"https://github.com/kgrygiel","followers_url":"https://api.github.com/users/kgrygiel/followers","following_url":"https://api.github.com/users/kgrygiel/following{/other_user}","gists_url":"https://api.github.com/users/kgrygiel/gists{/gist_id}","starred_url":"https://api.github.com/users/kgrygiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgrygiel/subscriptions","organizations_url":"https://api.github.com/users/kgrygiel/orgs","repos_url":"https://api.github.com/users/kgrygiel/repos","events_url":"https://api.github.com/users/kgrygiel/events{/privacy}","received_events_url":"https://api.github.com/users/kgrygiel/received_events","type":"User","site_admin":false},"repo":{"id":88632978,"name":"autoscaler","full_name":"kgrygiel/autoscaler","owner":{"login":"kgrygiel","id":13944462,"avatar_url":"https://avatars0.githubusercontent.com/u/13944462?v=4","gravatar_id":"","url":"https://api.github.com/users/kgrygiel","html_url":"https://github.com/kgrygiel","followers_url":"https://api.github.com/users/kgrygiel/followers","following_url":"https://api.github.com/users/kgrygiel/following{/other_user}","gists_url":"https://api.github.com/users/kgrygiel/gists{/gist_id}","starred_url":"https://api.github.com/users/kgrygiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgrygiel/subscriptions","organizations_url":"https://api.github.com/users/kgrygiel/orgs","repos_url":"https://api.github.com/users/kgrygiel/repos","events_url":"https://api.github.com/users/kgrygiel/events{/privacy}","received_events_url":"https://api.github.com/users/kgrygiel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kgrygiel/autoscaler","description":null,"fork":true,"url":"https://api.github.com/repos/kgrygiel/autoscaler","forks_url":"https://api.github.com/repos/kgrygiel/autoscaler/forks","keys_url":"https://api.github.com/repos/kgrygiel/autoscaler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kgrygiel/autoscaler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kgrygiel/autoscaler/teams","hooks_url":"https://api.github.com/repos/kgrygiel/autoscaler/hooks","issue_events_url":"https://api.github.com/repos/kgrygiel/autoscaler/issues/events{/number}","events_url":"https://api.github.com/repos/kgrygiel/autoscaler/events","assignees_url":"https://api.github.com/repos/kgrygiel/autoscaler/assignees{/user}","branches_url":"https://api.github.com/repos/kgrygiel/autoscaler/branches{/branch}","tags_url":"https://api.github.com/repos/kgrygiel/autoscaler/tags","blobs_url":"https://api.github.com/repos/kgrygiel/autoscaler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kgrygiel/autoscaler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kgrygiel/autoscaler/git/refs{/sha}","trees_url":"https://api.github.com/repos/kgrygiel/autoscaler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kgrygiel/autoscaler/statuses/{sha}","languages_url":"https://api.github.com/repos/kgrygiel/autoscaler/languages","stargazers_url":"https://api.github.com/repos/kgrygiel/autoscaler/stargazers","contributors_url":"https://api.github.com/repos/kgrygiel/autoscaler/contributors","subscribers_url":"https://api.github.com/repos/kgrygiel/autoscaler/subscribers","subscription_url":"https://api.github.com/repos/kgrygiel/autoscaler/subscription","commits_url":"https://api.github.com/repos/kgrygiel/autoscaler/commits{/sha}","git_commits_url":"https://api.github.com/repos/kgrygiel/autoscaler/git/commits{/sha}","comments_url":"https://api.github.com/repos/kgrygiel/autoscaler/comments{/number}","issue_comment_url":"https://api.github.com/repos/kgrygiel/autoscaler/issues/comments{/number}","contents_url":"https://api.github.com/repos/kgrygiel/autoscaler/contents/{+path}","compare_url":"https://api.github.com/repos/kgrygiel/autoscaler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kgrygiel/autoscaler/merges","archive_url":"https://api.github.com/repos/kgrygiel/autoscaler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kgrygiel/autoscaler/downloads","issues_url":"https://api.github.com/repos/kgrygiel/autoscaler/issues{/number}","pulls_url":"https://api.github.com/repos/kgrygiel/autoscaler/pulls{/number}","milestones_url":"https://api.github.com/repos/kgrygiel/autoscaler/milestones{/number}","notifications_url":"https://api.github.com/repos/kgrygiel/autoscaler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kgrygiel/autoscaler/labels{/name}","releases_url":"https://api.github.com/repos/kgrygiel/autoscaler/releases{/id}","deployments_url":"https://api.github.com/repos/kgrygiel/autoscaler/deployments","created_at":"2017-04-18T14:13:07Z","updated_at":"2017-04-18T14:13:09Z","pushed_at":"2018-03-05T13:48:03Z","git_url":"git://github.com/kgrygiel/autoscaler.git","ssh_url":"git@github.com:kgrygiel/autoscaler.git","clone_url":"https://github.com/kgrygiel/autoscaler.git","svn_url":"https://github.com/kgrygiel/autoscaler","homepage":null,"size":26565,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"9e72d87cb755c0211b3f05c69c2fd688ef3e287d","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":87990209,"name":"autoscaler","full_name":"kubernetes/autoscaler","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/autoscaler","description":"Autoscaling components for Kubernetes","fork":false,"url":"https://api.github.com/repos/kubernetes/autoscaler","forks_url":"https://api.github.com/repos/kubernetes/autoscaler/forks","keys_url":"https://api.github.com/repos/kubernetes/autoscaler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/autoscaler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/autoscaler/teams","hooks_url":"https://api.github.com/repos/kubernetes/autoscaler/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/autoscaler/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/autoscaler/events","assignees_url":"https://api.github.com/repos/kubernetes/autoscaler/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/autoscaler/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/autoscaler/tags","blobs_url":"https://api.github.com/repos/kubernetes/autoscaler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/autoscaler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/autoscaler/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/autoscaler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/autoscaler/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/autoscaler/languages","stargazers_url":"https://api.github.com/repos/kubernetes/autoscaler/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/autoscaler/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/autoscaler/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/autoscaler/subscription","commits_url":"https://api.github.com/repos/kubernetes/autoscaler/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/autoscaler/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/autoscaler/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/autoscaler/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/autoscaler/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/autoscaler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/autoscaler/merges","archive_url":"https://api.github.com/repos/kubernetes/autoscaler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/autoscaler/downloads","issues_url":"https://api.github.com/repos/kubernetes/autoscaler/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/autoscaler/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/autoscaler/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/autoscaler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/autoscaler/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/autoscaler/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/autoscaler/deployments","created_at":"2017-04-12T00:03:40Z","updated_at":"2018-03-05T14:05:55Z","pushed_at":"2018-03-05T13:48:04Z","git_url":"git://github.com/kubernetes/autoscaler.git","ssh_url":"git@github.com:kubernetes/autoscaler.git","clone_url":"https://github.com/kubernetes/autoscaler.git","svn_url":"https://github.com/kubernetes/autoscaler","homepage":"","size":27067,"stargazers_count":495,"watchers_count":495,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":252,"mirror_url":null,"archived":false,"open_issues_count":56,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":252,"open_issues":56,"watchers":495,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/autoscaler/pulls/690"},"html":{"href":"https://github.com/kubernetes/autoscaler/pull/690"},"issue":{"href":"https://api.github.com/repos/kubernetes/autoscaler/issues/690"},"comments":{"href":"https://api.github.com/repos/kubernetes/autoscaler/issues/690/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/autoscaler/pulls/690/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/autoscaler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/autoscaler/pulls/690/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/autoscaler/statuses/be7cc7feb8a036cd735fb66b7735b2b3e3186d59"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"schylek"}}