{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/comments/223783258","pull_request_review_id":162995011,"id":223783258,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzc4MzI1OA==","diff_hunk":"@@ -209,25 +211,65 @@ func (c *cmd) Run(args []string) int {\n \treturn 0\n }\n \n-func (c *cmd) configWatcher(client *api.Client) (proxyImpl.ConfigWatcher, error) {\n-\t// Manual configuration file is specified.\n-\tif c.cfgFile != \"\" {\n-\t\tcfg, err := proxyImpl.ParseConfigFile(c.cfgFile)\n-\t\tif err != nil {\n-\t\t\treturn nil, err\n+func (c *cmd) lookupProxyIDForSidecar(client *api.Client) (string, error) {\n+\treturn LookupProxyIDForSidecar(client, c.sidecarFor)\n+}\n+\n+// LookupProxyIDForSidecar finds candidate local proxy registrations that are a\n+// sidcar for the given service. It will return an ID if and only if there is\n+// exactly one registed connect proxy with `Proxy.DestinationServiceID` set to\n+// the specified service ID.\n+//\n+// This is exported to share it with the connect envoy command.\n+func LookupProxyIDForSidecar(client *api.Client, sidecarFor string) (string, error) {\n+\tsvcs, err := client.Agent().Services()\n+\tif err != nil {\n+\t\treturn \"\", fmt.Errorf(\"Failed looking up sidecar proxy info for %s: %s\",\n+\t\t\tsidecarFor, err)\n+\t}\n+\n+\tvar proxyIDs []string\n+\tfor _, svc := range svcs {\n+\t\tif svc.Kind == api.ServiceKindConnectProxy && svc.Proxy != nil &&\n+\t\t\tstrings.ToLower(svc.Proxy.DestinationServiceID) == sidecarFor {\n+\t\t\tproxyIDs = append(proxyIDs, svc.ID)\n \t\t}\n+\t}\n \n-\t\tc.UI.Info(\"Configuration mode: File\")\n-\t\treturn proxyImpl.NewStaticConfigWatcher(cfg), nil\n+\tif len(proxyIDs) == 0 {\n+\t\treturn \"\", fmt.Errorf(\"No sidecar proxy registereded for %s\", sidecarFor)","path":"command/connect/proxy/proxy.go","position":92,"original_position":92,"commit_id":"96a592f0464ad5c060df8464ddb395bc48c0d270","original_commit_id":"847f36a0ea48077d9aa722e02d36b1b3c9af86af","user":{"login":"rboyer","id":4903,"node_id":"MDQ6VXNlcjQ5MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/4903?v=4","gravatar_id":"","url":"https://api.github.com/users/rboyer","html_url":"https://github.com/rboyer","followers_url":"https://api.github.com/users/rboyer/followers","following_url":"https://api.github.com/users/rboyer/following{/other_user}","gists_url":"https://api.github.com/users/rboyer/gists{/gist_id}","starred_url":"https://api.github.com/users/rboyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rboyer/subscriptions","organizations_url":"https://api.github.com/users/rboyer/orgs","repos_url":"https://api.github.com/users/rboyer/repos","events_url":"https://api.github.com/users/rboyer/events{/privacy}","received_events_url":"https://api.github.com/users/rboyer/received_events","type":"User","site_admin":false},"body":"`s/registereded/registered/`","created_at":"2018-10-09T16:57:54Z","updated_at":"2018-10-09T16:57:55Z","html_url":"https://github.com/hashicorp/consul/pull/4772#discussion_r223783258","pull_request_url":"https://api.github.com/repos/hashicorp/consul/pulls/4772","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments/223783258"},"html":{"href":"https://github.com/hashicorp/consul/pull/4772#discussion_r223783258"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/4772"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/4772","id":221475205,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxNDc1MjA1","html_url":"https://github.com/hashicorp/consul/pull/4772","diff_url":"https://github.com/hashicorp/consul/pull/4772.diff","patch_url":"https://github.com/hashicorp/consul/pull/4772.patch","issue_url":"https://api.github.com/repos/hashicorp/consul/issues/4772","number":4772,"state":"open","locked":false,"title":"Merge Envoy Feature Branch","user":{"login":"banks","id":120915,"node_id":"MDQ6VXNlcjEyMDkxNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/120915?v=4","gravatar_id":"","url":"https://api.github.com/users/banks","html_url":"https://github.com/banks","followers_url":"https://api.github.com/users/banks/followers","following_url":"https://api.github.com/users/banks/following{/other_user}","gists_url":"https://api.github.com/users/banks/gists{/gist_id}","starred_url":"https://api.github.com/users/banks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/banks/subscriptions","organizations_url":"https://api.github.com/users/banks/orgs","repos_url":"https://api.github.com/users/banks/repos","events_url":"https://api.github.com/users/banks/events{/privacy}","received_events_url":"https://api.github.com/users/banks/received_events","type":"User","site_admin":false},"body":"This is a significant feature branch containing changes from 10 or so large PRs.\r\n\r\nAs such this PR is probably to large a diff to be meaningfully reviewed but is a maybe worth sanity checking before we merge to master.","created_at":"2018-10-09T15:01:44Z","updated_at":"2018-10-09T16:57:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a1066487fd7218fbb85f91b60683055d5593799","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/consul/pulls/4772/commits","review_comments_url":"https://api.github.com/repos/hashicorp/consul/pulls/4772/comments","review_comment_url":"https://api.github.com/repos/hashicorp/consul/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/consul/issues/4772/comments","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/96a592f0464ad5c060df8464ddb395bc48c0d270","head":{"label":"hashicorp:f-envoy","ref":"f-envoy","sha":"96a592f0464ad5c060df8464ddb395bc48c0d270","user":{"login":"hashicorp","id":761456,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MTQ1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":14125254,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEyNTI1NA==","name":"consul","full_name":"hashicorp/consul","private":false,"owner":{"login":"hashicorp","id":761456,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MTQ1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hashicorp/consul","description":"Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.","fork":false,"url":"https://api.github.com/repos/hashicorp/consul","forks_url":"https://api.github.com/repos/hashicorp/consul/forks","keys_url":"https://api.github.com/repos/hashicorp/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/consul/teams","hooks_url":"https://api.github.com/repos/hashicorp/consul/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/consul/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/consul/events","assignees_url":"https://api.github.com/repos/hashicorp/consul/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/consul/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/consul/tags","blobs_url":"https://api.github.com/repos/hashicorp/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/consul/languages","stargazers_url":"https://api.github.com/repos/hashicorp/consul/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/consul/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/consul/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/consul/subscription","commits_url":"https://api.github.com/repos/hashicorp/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/consul/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/consul/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/consul/merges","archive_url":"https://api.github.com/repos/hashicorp/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/consul/downloads","issues_url":"https://api.github.com/repos/hashicorp/consul/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/consul/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/consul/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/consul/deployments","created_at":"2013-11-04T22:15:27Z","updated_at":"2018-10-09T15:58:22Z","pushed_at":"2018-10-09T16:57:35Z","git_url":"git://github.com/hashicorp/consul.git","ssh_url":"git@github.com:hashicorp/consul.git","clone_url":"https://github.com/hashicorp/consul.git","svn_url":"https://github.com/hashicorp/consul","homepage":"https://www.consul.io/","size":66225,"stargazers_count":13641,"watchers_count":13641,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2388,"mirror_url":null,"archived":false,"open_issues_count":498,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":2388,"open_issues":498,"watchers":13641,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"6b487f80ffbe601ac71a31c28196b8a8fbfbfbac","user":{"login":"hashicorp","id":761456,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MTQ1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":14125254,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEyNTI1NA==","name":"consul","full_name":"hashicorp/consul","private":false,"owner":{"login":"hashicorp","id":761456,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MTQ1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hashicorp/consul","description":"Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.","fork":false,"url":"https://api.github.com/repos/hashicorp/consul","forks_url":"https://api.github.com/repos/hashicorp/consul/forks","keys_url":"https://api.github.com/repos/hashicorp/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/consul/teams","hooks_url":"https://api.github.com/repos/hashicorp/consul/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/consul/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/consul/events","assignees_url":"https://api.github.com/repos/hashicorp/consul/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/consul/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/consul/tags","blobs_url":"https://api.github.com/repos/hashicorp/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/consul/languages","stargazers_url":"https://api.github.com/repos/hashicorp/consul/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/consul/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/consul/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/consul/subscription","commits_url":"https://api.github.com/repos/hashicorp/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/consul/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/consul/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/consul/merges","archive_url":"https://api.github.com/repos/hashicorp/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/consul/downloads","issues_url":"https://api.github.com/repos/hashicorp/consul/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/consul/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/consul/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/consul/deployments","created_at":"2013-11-04T22:15:27Z","updated_at":"2018-10-09T15:58:22Z","pushed_at":"2018-10-09T16:57:35Z","git_url":"git://github.com/hashicorp/consul.git","ssh_url":"git@github.com:hashicorp/consul.git","clone_url":"https://github.com/hashicorp/consul.git","svn_url":"https://github.com/hashicorp/consul","homepage":"https://www.consul.io/","size":66225,"stargazers_count":13641,"watchers_count":13641,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2388,"mirror_url":null,"archived":false,"open_issues_count":498,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":2388,"open_issues":498,"watchers":13641,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/4772"},"html":{"href":"https://github.com/hashicorp/consul/pull/4772"},"issue":{"href":"https://api.github.com/repos/hashicorp/consul/issues/4772"},"comments":{"href":"https://api.github.com/repos/hashicorp/consul/issues/4772/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/4772/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/4772/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/consul/statuses/96a592f0464ad5c060df8464ddb395bc48c0d270"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rboyer"}}