{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/27233783","id":27233783,"diff_hunk":"@@ -1181,21 +1181,42 @@ func init() {\n \t\t\tif err := s.Convert(&in.ObjectMeta, &out.TypeMeta, 0); err != nil {\n \t\t\t\treturn err\n \t\t\t}\n-\t\t\tif err := s.Convert(&in.Protocol, &out.Protocol, 0); err != nil {\n+\t\t\tif err := s.Convert(&in.Subsets, &out.Subsets, 0); err != nil {\n \t\t\t\treturn err\n \t\t\t}\n-\t\t\tfor i := range in.Endpoints {\n-\t\t\t\tep := &in.Endpoints[i]\n-\t\t\t\thostPort := net.JoinHostPort(ep.IP, strconv.Itoa(ep.Port))\n-\t\t\t\tout.Endpoints = append(out.Endpoints, hostPort)\n-\t\t\t\tif ep.TargetRef != nil {\n-\t\t\t\t\ttarget := EndpointObjectReference{\n-\t\t\t\t\t\tEndpoint: hostPort,\n-\t\t\t\t\t}\n-\t\t\t\t\tif err := s.Convert(ep.TargetRef, &target.ObjectReference, 0); err != nil {\n+\t\t\t// Handle back-compat fields.\n+\t\t\tfirstPortName := \"\"\n+\t\t\tif len(in.Subsets) > 0 {\n+\t\t\t\tif len(in.Subsets[0].Ports) > 0 {\n+\t\t\t\t\tif err := s.Convert(&in.Subsets[0].Ports[0].Protocol, &out.Protocol, 0); err != nil {\n \t\t\t\t\t\treturn err\n \t\t\t\t\t}\n-\t\t\t\t\tout.TargetRefs = append(out.TargetRefs, target)\n+\t\t\t\t\tfirstPortName = in.Subsets[0].Ports[0].Name\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tout.Protocol = ProtocolTCP\n+\t\t\t}\n+\t\t\tfor i := range in.Subsets {\n+\t\t\t\tss := &in.Subsets[i]\n+\t\t\t\tfor j := range ss.Ports {\n+\t\t\t\t\tssp := &ss.Ports[j]\n+\t\t\t\t\tif ssp.Name != firstPortName {\n+\t\t\t\t\t\tcontinue\n+\t\t\t\t\t}\n+\t\t\t\t\tfor k := range ss.Addresses {","path":"pkg/api/v1beta1/conversion.go","position":37,"original_position":37,"commit_id":"e8cb98bcc9deb5939e8e1fc874400474a5ddc8c6","original_commit_id":"e8cb98bcc9deb5939e8e1fc874400474a5ddc8c6","user":{"login":"satnam6502","id":6164339,"avatar_url":"https://avatars.githubusercontent.com/u/6164339?v=3","gravatar_id":"","url":"https://api.github.com/users/satnam6502","html_url":"https://github.com/satnam6502","followers_url":"https://api.github.com/users/satnam6502/followers","following_url":"https://api.github.com/users/satnam6502/following{/other_user}","gists_url":"https://api.github.com/users/satnam6502/gists{/gist_id}","starred_url":"https://api.github.com/users/satnam6502/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satnam6502/subscriptions","organizations_url":"https://api.github.com/users/satnam6502/orgs","repos_url":"https://api.github.com/users/satnam6502/repos","events_url":"https://api.github.com/users/satnam6502/events{/privacy}","received_events_url":"https://api.github.com/users/satnam6502/received_events","type":"User","site_admin":false},"body":"Minor, but I think you can capture `ssa` in the `for` assignment and then use `&ssa` in the body or indeed just still use `ssa.Targetref` because I assume you only do `ssp := &ss.Ports[j]` to avoid copying.","created_at":"2015-03-26T17:11:40Z","updated_at":"2015-03-26T17:11:40Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/5939#discussion_r27233783","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/5939","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/27233783"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/5939#discussion_r27233783"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/5939"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/5939","id":31953220,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/5939","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/5939.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/5939.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/5939","number":5939,"state":"open","locked":false,"title":"Implement multi-port endpoints","user":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"body":"Another piece of multi-port services.\r\n\r\nInstead of endpoints being a flat list, it is now a list of \"subsets\"\r\nwhere each is a struct of {Addresses, Ports}.  To generate the list of\r\nendpoints you need to take union of the Cartesian products of the\r\nsubsets.  This is compact in the vast majority of cases, yest still\r\nrepresents named ports and corner cases (e.g. each pod has a different\r\nport number).\r\n\r\nThis also stores subsets in a deterministic order (sorted by hash) to\r\navoid spurious updates and comparison problems.","created_at":"2015-03-25T18:43:18Z","updated_at":"2015-03-26T17:11:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1cec9fe4164db6d5d1a591ea2b35b0992ebcea0f","assignee":{"login":"satnam6502","id":6164339,"avatar_url":"https://avatars.githubusercontent.com/u/6164339?v=3","gravatar_id":"","url":"https://api.github.com/users/satnam6502","html_url":"https://github.com/satnam6502","followers_url":"https://api.github.com/users/satnam6502/followers","following_url":"https://api.github.com/users/satnam6502/following{/other_user}","gists_url":"https://api.github.com/users/satnam6502/gists{/gist_id}","starred_url":"https://api.github.com/users/satnam6502/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satnam6502/subscriptions","organizations_url":"https://api.github.com/users/satnam6502/orgs","repos_url":"https://api.github.com/users/satnam6502/repos","events_url":"https://api.github.com/users/satnam6502/events{/privacy}","received_events_url":"https://api.github.com/users/satnam6502/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/5939/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/5939/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/5939/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/e8cb98bcc9deb5939e8e1fc874400474a5ddc8c6","head":{"label":"thockin:plural_endpoints_31_endpt_subsets","ref":"plural_endpoints_31_endpt_subsets","sha":"e8cb98bcc9deb5939e8e1fc874400474a5ddc8c6","user":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"repo":{"id":21042716,"name":"kubernetes","full_name":"thockin/kubernetes","owner":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thockin/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/thockin/kubernetes","forks_url":"https://api.github.com/repos/thockin/kubernetes/forks","keys_url":"https://api.github.com/repos/thockin/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thockin/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thockin/kubernetes/teams","hooks_url":"https://api.github.com/repos/thockin/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/thockin/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/thockin/kubernetes/events","assignees_url":"https://api.github.com/repos/thockin/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/thockin/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/thockin/kubernetes/tags","blobs_url":"https://api.github.com/repos/thockin/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thockin/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thockin/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/thockin/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thockin/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/thockin/kubernetes/languages","stargazers_url":"https://api.github.com/repos/thockin/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/thockin/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/thockin/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/thockin/kubernetes/subscription","commits_url":"https://api.github.com/repos/thockin/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/thockin/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/thockin/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/thockin/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/thockin/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/thockin/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thockin/kubernetes/merges","archive_url":"https://api.github.com/repos/thockin/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thockin/kubernetes/downloads","issues_url":"https://api.github.com/repos/thockin/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/thockin/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/thockin/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/thockin/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thockin/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/thockin/kubernetes/releases{/id}","created_at":"2014-06-20T15:30:28Z","updated_at":"2015-02-10T13:42:54Z","pushed_at":"2015-03-26T04:43:27Z","git_url":"git://github.com/thockin/kubernetes.git","ssh_url":"git@github.com:thockin/kubernetes.git","clone_url":"https://github.com/thockin/kubernetes.git","svn_url":"https://github.com/thockin/kubernetes","homepage":null,"size":39804,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"8183a4805ee5d9db97c12cfefe7efb0a83bc6e0a","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-03-26T17:11:24Z","pushed_at":"2015-03-26T17:11:24Z","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":117233,"stargazers_count":6766,"watchers_count":6766,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1280,"mirror_url":null,"open_issues_count":819,"forks":1280,"open_issues":819,"watchers":6766,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/5939"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/5939"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/5939"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/5939/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/5939/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/5939/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/e8cb98bcc9deb5939e8e1fc874400474a5ddc8c6"}}}}