{"action":"created","comment":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/comments/186959264","pull_request_review_id":118639926,"id":186959264,"diff_hunk":"@@ -0,0 +1,33 @@\n+package port\n+\n+// The `port` package contains the implementation of the swarmkit Allocator for\n+// network ports. Its purpose is to assign ports to Endpoint objects based on\n+// the provided Spec. For ingress ports, it keeps track of the availability of\n+// ports, and handles dynamic allocation of ports when the user has specified\n+// no PublishedPort. The allocator does _not_ keep track of host-mode ports in\n+// any capacity. It silently adds them to the returned Ports assignment,\n+// without checking their validity or availability. Port assignments for\n+// host-mode ports are handled on the worker.","path":"manager/allocator/network/port/doc.go","position":10,"original_position":10,"commit_id":"f0b8ec2b9a31da113827ae6e5d1a1c6c7d022833","original_commit_id":"16d0566b1efdf818eee6aeae20ec342bbbe9506c","user":{"login":"talex5","id":554131,"avatar_url":"https://avatars0.githubusercontent.com/u/554131?v=4","gravatar_id":"","url":"https://api.github.com/users/talex5","html_url":"https://github.com/talex5","followers_url":"https://api.github.com/users/talex5/followers","following_url":"https://api.github.com/users/talex5/following{/other_user}","gists_url":"https://api.github.com/users/talex5/gists{/gist_id}","starred_url":"https://api.github.com/users/talex5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talex5/subscriptions","organizations_url":"https://api.github.com/users/talex5/orgs","repos_url":"https://api.github.com/users/talex5/repos","events_url":"https://api.github.com/users/talex5/events{/privacy}","received_events_url":"https://api.github.com/users/talex5/received_events","type":"User","site_admin":false},"body":"But if a host port isn't available on a node because it's already used as an ingress port, won't we have the same problem on all other nodes of the cluster too? Should a worker reject a request to forward an ingress port if it is already using it as a host-mode port? (I'm not too clear about how overlay networks work currently)","created_at":"2018-05-09T07:54:45Z","updated_at":"2018-05-09T07:54:45Z","html_url":"https://github.com/docker/swarmkit/pull/2615#discussion_r186959264","pull_request_url":"https://api.github.com/repos/docker/swarmkit/pulls/2615","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments/186959264"},"html":{"href":"https://github.com/docker/swarmkit/pull/2615#discussion_r186959264"},"pull_request":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2615"}},"in_reply_to_id":186748601},"pull_request":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/2615","id":184742071,"html_url":"https://github.com/docker/swarmkit/pull/2615","diff_url":"https://github.com/docker/swarmkit/pull/2615.diff","patch_url":"https://github.com/docker/swarmkit/pull/2615.patch","issue_url":"https://api.github.com/repos/docker/swarmkit/issues/2615","number":2615,"state":"open","locked":false,"title":"[WIP] Rewrite allocator","user":{"login":"dperny","id":2367858,"avatar_url":"https://avatars3.githubusercontent.com/u/2367858?v=4","gravatar_id":"","url":"https://api.github.com/users/dperny","html_url":"https://github.com/dperny","followers_url":"https://api.github.com/users/dperny/followers","following_url":"https://api.github.com/users/dperny/following{/other_user}","gists_url":"https://api.github.com/users/dperny/gists{/gist_id}","starred_url":"https://api.github.com/users/dperny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dperny/subscriptions","organizations_url":"https://api.github.com/users/dperny/orgs","repos_url":"https://api.github.com/users/dperny/repos","events_url":"https://api.github.com/users/dperny/events{/privacy}","received_events_url":"https://api.github.com/users/dperny/received_events","type":"User","site_admin":false},"body":"<!--\r\nPlease make sure you've read and understood our contributing guidelines;\r\nhttps://github.com/docker/swarmkit/blob/master/CONTRIBUTING.md\r\n\r\n** Make sure all your commits include a signature generated with `git commit -s` **\r\n\r\nFor additional information on our contributing process, read our contributing\r\nguide https://docs.docker.com/opensource/code/\r\n\r\nIf this is a bug fix, make sure your description includes \"fixes #xxxx\", or\r\n\"closes #xxxx\"\r\n\r\nPlease provide the following information:\r\n-->\r\n\r\n**- What I did**\r\n\r\nAdded all of the lower-level allocator subcomponents, paving the way for the final bits of allocator rewrite.\r\n\r\nIncludes and supersedes #2579 and #2605. Does not integrate the new components, which still requires a rewrite of the top-level Allocator object (which is in progress on a local branch).\r\n\r\nWIP because it lacks tests, but all code is ready for review.\r\n\r\n**- How I did it**\r\n\r\nPainfully.\r\n\r\n**- How to review it**\r\n\r\nThis PR is massive, and will be difficult to adequately review. Do not let this discourage you; the design should be clearly delineated, and the components and loosely coupled. There are many comments. If you do not understand why a particular thing was done a particular way during your review, that's not a sign that you can't review it, that's a sign that it hasn't been commented adequately to explain it.\r\n\r\nThis PR should be review-able by anyone with any level of familiarity with the code. The goal is to create a maintainable, easy-to-understand component, that even new contributors to the project can easily understand. Effort has been made to ensure that nothing in the code assumes itself to be obvious.\r\n\r\nTo make reviewing easier, you should follow these guidelines:\r\n\r\n* Start by reading `doc.go`, which should explain the purpose and use of each package. Then, read the doc comments of the public interfaces. Make sure they make sense to you, and adequately explain the intended behavior of the components. If they do not, request changes.\r\n* Look over the design and method signatures. Do the signatures make sense? Are the methods easy to use? Do the concerns of each component seem well-separated?\r\n* Review the lower level components first. The `port` package has previously been subject to review in #2579, but has received changes. The `ipam` package has been partially reviewed in #2605, but has received substantial changes. The `driver` and top-level `network` package has not reviewed yet.\r\n* Review the Allocator component. Does it fit the sub-components together well? Does it adequately respect the separation of concerns?\r\n* Review the tests. Do they cover the cases adequately?\r\n\r\n**- How to test it**\r\n\r\nThis PR is marked WIP primarily because it currently lacks complete testing. The tests it does have are written with the Ginkgo framework.\r\n\r\n**- Description for the changelog**\r\n<!--\r\nWrite a short (one line) summary that describes the changes in this\r\npull request for inclusion in the changelog:\r\n-->","created_at":"2018-04-27T22:35:18Z","updated_at":"2018-05-09T07:54:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2bc0ff33acafcc53b4c65fbc89146b600d84eb1b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/swarmkit/pulls/2615/commits","review_comments_url":"https://api.github.com/repos/docker/swarmkit/pulls/2615/comments","review_comment_url":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/swarmkit/issues/2615/comments","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/f0b8ec2b9a31da113827ae6e5d1a1c6c7d022833","head":{"label":"dperny:rewrite-allocator","ref":"rewrite-allocator","sha":"f0b8ec2b9a31da113827ae6e5d1a1c6c7d022833","user":{"login":"dperny","id":2367858,"avatar_url":"https://avatars3.githubusercontent.com/u/2367858?v=4","gravatar_id":"","url":"https://api.github.com/users/dperny","html_url":"https://github.com/dperny","followers_url":"https://api.github.com/users/dperny/followers","following_url":"https://api.github.com/users/dperny/following{/other_user}","gists_url":"https://api.github.com/users/dperny/gists{/gist_id}","starred_url":"https://api.github.com/users/dperny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dperny/subscriptions","organizations_url":"https://api.github.com/users/dperny/orgs","repos_url":"https://api.github.com/users/dperny/repos","events_url":"https://api.github.com/users/dperny/events{/privacy}","received_events_url":"https://api.github.com/users/dperny/received_events","type":"User","site_admin":false},"repo":{"id":60813040,"name":"swarmkit-1","full_name":"dperny/swarmkit-1","owner":{"login":"dperny","id":2367858,"avatar_url":"https://avatars3.githubusercontent.com/u/2367858?v=4","gravatar_id":"","url":"https://api.github.com/users/dperny","html_url":"https://github.com/dperny","followers_url":"https://api.github.com/users/dperny/followers","following_url":"https://api.github.com/users/dperny/following{/other_user}","gists_url":"https://api.github.com/users/dperny/gists{/gist_id}","starred_url":"https://api.github.com/users/dperny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dperny/subscriptions","organizations_url":"https://api.github.com/users/dperny/orgs","repos_url":"https://api.github.com/users/dperny/repos","events_url":"https://api.github.com/users/dperny/events{/privacy}","received_events_url":"https://api.github.com/users/dperny/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dperny/swarmkit-1","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":true,"url":"https://api.github.com/repos/dperny/swarmkit-1","forks_url":"https://api.github.com/repos/dperny/swarmkit-1/forks","keys_url":"https://api.github.com/repos/dperny/swarmkit-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dperny/swarmkit-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dperny/swarmkit-1/teams","hooks_url":"https://api.github.com/repos/dperny/swarmkit-1/hooks","issue_events_url":"https://api.github.com/repos/dperny/swarmkit-1/issues/events{/number}","events_url":"https://api.github.com/repos/dperny/swarmkit-1/events","assignees_url":"https://api.github.com/repos/dperny/swarmkit-1/assignees{/user}","branches_url":"https://api.github.com/repos/dperny/swarmkit-1/branches{/branch}","tags_url":"https://api.github.com/repos/dperny/swarmkit-1/tags","blobs_url":"https://api.github.com/repos/dperny/swarmkit-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dperny/swarmkit-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dperny/swarmkit-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/dperny/swarmkit-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dperny/swarmkit-1/statuses/{sha}","languages_url":"https://api.github.com/repos/dperny/swarmkit-1/languages","stargazers_url":"https://api.github.com/repos/dperny/swarmkit-1/stargazers","contributors_url":"https://api.github.com/repos/dperny/swarmkit-1/contributors","subscribers_url":"https://api.github.com/repos/dperny/swarmkit-1/subscribers","subscription_url":"https://api.github.com/repos/dperny/swarmkit-1/subscription","commits_url":"https://api.github.com/repos/dperny/swarmkit-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/dperny/swarmkit-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/dperny/swarmkit-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/dperny/swarmkit-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/dperny/swarmkit-1/contents/{+path}","compare_url":"https://api.github.com/repos/dperny/swarmkit-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dperny/swarmkit-1/merges","archive_url":"https://api.github.com/repos/dperny/swarmkit-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dperny/swarmkit-1/downloads","issues_url":"https://api.github.com/repos/dperny/swarmkit-1/issues{/number}","pulls_url":"https://api.github.com/repos/dperny/swarmkit-1/pulls{/number}","milestones_url":"https://api.github.com/repos/dperny/swarmkit-1/milestones{/number}","notifications_url":"https://api.github.com/repos/dperny/swarmkit-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dperny/swarmkit-1/labels{/name}","releases_url":"https://api.github.com/repos/dperny/swarmkit-1/releases{/id}","deployments_url":"https://api.github.com/repos/dperny/swarmkit-1/deployments","created_at":"2016-06-09T23:18:00Z","updated_at":"2016-06-09T23:18:01Z","pushed_at":"2018-05-08T23:06:19Z","git_url":"git://github.com/dperny/swarmkit-1.git","ssh_url":"git@github.com:dperny/swarmkit-1.git","clone_url":"https://github.com/dperny/swarmkit-1.git","svn_url":"https://github.com/dperny/swarmkit-1","homepage":"","size":20389,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"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":2,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"bd69f6e8e301645afd344913fa1ede53a0a111fb","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars1.githubusercontent.com/u/5429470?v=4","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":51556828,"name":"swarmkit","full_name":"docker/swarmkit","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars1.githubusercontent.com/u/5429470?v=4","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarmkit","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":false,"url":"https://api.github.com/repos/docker/swarmkit","forks_url":"https://api.github.com/repos/docker/swarmkit/forks","keys_url":"https://api.github.com/repos/docker/swarmkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarmkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarmkit/teams","hooks_url":"https://api.github.com/repos/docker/swarmkit/hooks","issue_events_url":"https://api.github.com/repos/docker/swarmkit/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarmkit/events","assignees_url":"https://api.github.com/repos/docker/swarmkit/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarmkit/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarmkit/tags","blobs_url":"https://api.github.com/repos/docker/swarmkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarmkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarmkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarmkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarmkit/languages","stargazers_url":"https://api.github.com/repos/docker/swarmkit/stargazers","contributors_url":"https://api.github.com/repos/docker/swarmkit/contributors","subscribers_url":"https://api.github.com/repos/docker/swarmkit/subscribers","subscription_url":"https://api.github.com/repos/docker/swarmkit/subscription","commits_url":"https://api.github.com/repos/docker/swarmkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarmkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarmkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarmkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarmkit/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarmkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarmkit/merges","archive_url":"https://api.github.com/repos/docker/swarmkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarmkit/downloads","issues_url":"https://api.github.com/repos/docker/swarmkit/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarmkit/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarmkit/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarmkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarmkit/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarmkit/releases{/id}","deployments_url":"https://api.github.com/repos/docker/swarmkit/deployments","created_at":"2016-02-12T00:02:15Z","updated_at":"2018-05-08T22:13:02Z","pushed_at":"2018-05-08T23:06:21Z","git_url":"git://github.com/docker/swarmkit.git","ssh_url":"git@github.com:docker/swarmkit.git","clone_url":"https://github.com/docker/swarmkit.git","svn_url":"https://github.com/docker/swarmkit","homepage":"","size":19168,"stargazers_count":1677,"watchers_count":1677,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":387,"mirror_url":null,"archived":false,"open_issues_count":222,"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":387,"open_issues":222,"watchers":1677,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2615"},"html":{"href":"https://github.com/docker/swarmkit/pull/2615"},"issue":{"href":"https://api.github.com/repos/docker/swarmkit/issues/2615"},"comments":{"href":"https://api.github.com/repos/docker/swarmkit/issues/2615/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2615/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2615/commits"},"statuses":{"href":"https://api.github.com/repos/docker/swarmkit/statuses/f0b8ec2b9a31da113827ae6e5d1a1c6c7d022833"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"talex5"}}