{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/33842099","id":33842099,"diff_hunk":"@@ -89,7 +89,42 @@ func LeastRequestedPriority(pod *api.Pod, podLister algorithm.PodLister, minionL\n \n \tlist := algorithm.HostPriorityList{}\n \tfor _, node := range nodes.Items {\n-\t\tlist = append(list, calculateOccupancy(pod, node, podsToMachines[node.Name]))\n+\t\tlist = append(list, calculateResourceOccupancy(pod, node, podsToMachines[node.Name]))\n+\t}\n+\treturn list, nil\n+}\n+\n+func min(l, r int64) (m int64) {\n+\tm = r\n+\tif l < r {\n+\t\tm = l\n+\t}\n+\treturn m\n+}\n+\n+// See comment for DumbSpreadingPriority()\n+const dumbSpreadingDenominator int64 = 10\n+\n+// DumbSpreadingPriority is a priority function that favors nodes with fewer pods.\n+// It works like LeastRequestedPeriority but instead of using 10 * percentage of machine free by resource,\n+// it uses 10 * percentage of machine free by pod, with \"percentage of machine free by pod\" claculated as\n+// (dumbSpreadingDenominator - number of pods already on the node + 1) / dumbSpreadingDenominator.\n+// dumbSpreadingDenominator serves like the machine capacity in LeasRequestedPriority but is chosen\n+// so that we equate one pod with a reasonable amount of resources when we combine all the scores together.\n+func DumbSpreadingPriority(pod *api.Pod, podLister algorithm.PodLister, minionLister algorithm.MinionLister) (algorithm.HostPriorityList, error) {","path":"plugin/pkg/scheduler/algorithm/priorities/priorities.go","position":39,"original_position":39,"commit_id":"415ce247a8c9a949bc162173360bc851156be871","original_commit_id":"415ce247a8c9a949bc162173360bc851156be871","user":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"body":"@davidopp - I completely agree that having a very strict test is not the best option. However, having a test that e.g. has 5 nodes, 2 of then with something simulating addons on them and scheduling 50 pods to check that e.g. at least 5 pods were scheduled on each node is reasonable. What do you think?","created_at":"2015-07-03T06:04:40Z","updated_at":"2015-07-03T06:04:40Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10661#discussion_r33842099","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10661","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/33842099"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10661#discussion_r33842099"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10661"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10661","id":39048570,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10661","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10661.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10661.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/10661","number":10661,"state":"open","locked":false,"title":"Add DumbSpreadingPriority, which tries to spread pods across nodes.","user":{"login":"davidopp","id":8264113,"avatar_url":"https://avatars.githubusercontent.com/u/8264113?v=3","gravatar_id":"","url":"https://api.github.com/users/davidopp","html_url":"https://github.com/davidopp","followers_url":"https://api.github.com/users/davidopp/followers","following_url":"https://api.github.com/users/davidopp/following{/other_user}","gists_url":"https://api.github.com/users/davidopp/gists{/gist_id}","starred_url":"https://api.github.com/users/davidopp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidopp/subscriptions","organizations_url":"https://api.github.com/users/davidopp/orgs","repos_url":"https://api.github.com/users/davidopp/repos","events_url":"https://api.github.com/users/davidopp/events{/privacy}","received_events_url":"https://api.github.com/users/davidopp/received_events","type":"User","site_admin":false},"body":"Fixes #10242 \r\n\r\n@gmarek @bprashanth ","created_at":"2015-07-02T05:05:37Z","updated_at":"2015-07-03T06:04:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"61de175c02ca3ecd6dd18194e8479e8e0529a4c2","assignee":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10661/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10661/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/10661/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/415ce247a8c9a949bc162173360bc851156be871","head":{"label":"davidopp:somebranch","ref":"somebranch","sha":"415ce247a8c9a949bc162173360bc851156be871","user":{"login":"davidopp","id":8264113,"avatar_url":"https://avatars.githubusercontent.com/u/8264113?v=3","gravatar_id":"","url":"https://api.github.com/users/davidopp","html_url":"https://github.com/davidopp","followers_url":"https://api.github.com/users/davidopp/followers","following_url":"https://api.github.com/users/davidopp/following{/other_user}","gists_url":"https://api.github.com/users/davidopp/gists{/gist_id}","starred_url":"https://api.github.com/users/davidopp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidopp/subscriptions","organizations_url":"https://api.github.com/users/davidopp/orgs","repos_url":"https://api.github.com/users/davidopp/repos","events_url":"https://api.github.com/users/davidopp/events{/privacy}","received_events_url":"https://api.github.com/users/davidopp/received_events","type":"User","site_admin":false},"repo":{"id":25228292,"name":"kubernetes","full_name":"davidopp/kubernetes","owner":{"login":"davidopp","id":8264113,"avatar_url":"https://avatars.githubusercontent.com/u/8264113?v=3","gravatar_id":"","url":"https://api.github.com/users/davidopp","html_url":"https://github.com/davidopp","followers_url":"https://api.github.com/users/davidopp/followers","following_url":"https://api.github.com/users/davidopp/following{/other_user}","gists_url":"https://api.github.com/users/davidopp/gists{/gist_id}","starred_url":"https://api.github.com/users/davidopp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidopp/subscriptions","organizations_url":"https://api.github.com/users/davidopp/orgs","repos_url":"https://api.github.com/users/davidopp/repos","events_url":"https://api.github.com/users/davidopp/events{/privacy}","received_events_url":"https://api.github.com/users/davidopp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davidopp/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/davidopp/kubernetes","forks_url":"https://api.github.com/repos/davidopp/kubernetes/forks","keys_url":"https://api.github.com/repos/davidopp/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davidopp/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davidopp/kubernetes/teams","hooks_url":"https://api.github.com/repos/davidopp/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/davidopp/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/davidopp/kubernetes/events","assignees_url":"https://api.github.com/repos/davidopp/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/davidopp/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/davidopp/kubernetes/tags","blobs_url":"https://api.github.com/repos/davidopp/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davidopp/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davidopp/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/davidopp/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davidopp/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/davidopp/kubernetes/languages","stargazers_url":"https://api.github.com/repos/davidopp/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/davidopp/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/davidopp/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/davidopp/kubernetes/subscription","commits_url":"https://api.github.com/repos/davidopp/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/davidopp/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/davidopp/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/davidopp/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/davidopp/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/davidopp/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davidopp/kubernetes/merges","archive_url":"https://api.github.com/repos/davidopp/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davidopp/kubernetes/downloads","issues_url":"https://api.github.com/repos/davidopp/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/davidopp/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/davidopp/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/davidopp/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davidopp/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/davidopp/kubernetes/releases{/id}","created_at":"2014-10-14T21:53:51Z","updated_at":"2015-04-19T21:08:14Z","pushed_at":"2015-07-02T05:12:21Z","git_url":"git://github.com/davidopp/kubernetes.git","ssh_url":"git@github.com:davidopp/kubernetes.git","clone_url":"https://github.com/davidopp/kubernetes.git","svn_url":"https://github.com/davidopp/kubernetes","homepage":null,"size":81928,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"35973444591d139380f70c954813ae58f3518964","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"GoogleCloudPlatform/kubernetes","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-07-03T03:16:31Z","pushed_at":"2015-07-03T05:39:54Z","git_url":"git://github.com/GoogleCloudPlatform/kubernetes.git","ssh_url":"git@github.com:GoogleCloudPlatform/kubernetes.git","clone_url":"https://github.com/GoogleCloudPlatform/kubernetes.git","svn_url":"https://github.com/GoogleCloudPlatform/kubernetes","homepage":"http://kubernetes.io","size":309115,"stargazers_count":8719,"watchers_count":8719,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1928,"mirror_url":null,"open_issues_count":1527,"forks":1928,"open_issues":1527,"watchers":8719,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10661"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/10661"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/10661"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/10661/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10661/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/10661/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/415ce247a8c9a949bc162173360bc851156be871"}}}}