GitHub PullRequestReviewCommentEvent at 2014-10-02 07:04:00
Repository: consul
Actor: ryanuber
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/comments/18324731","id":18324731,"diff_hunk":"@@ -276,3 +277,85 @@ func (s *Server) nodeFailed(me serf.MemberEvent, wan bool) {\n \t\t}\n \t}\n }\n+\n+// ingestKeyringResponse is a helper method to pick the relative information\n+// from a Serf message and stuff it into a KeyringResponse.\n+func ingestKeyringResponse(\n+\tserfResp *serf.KeyResponse, reply *structs.KeyringResponses,\n+\tdc string, wan bool, err error) {\n+\n+\terrStr := \"\"\n+\tif err != nil {\n+\t\terrStr = err.Error()\n+\t}\n+\n+\treply.Responses = append(reply.Responses, &structs.KeyringResponse{\n+\t\tWAN:        wan,\n+\t\tDatacenter: dc,\n+\t\tMessages:   serfResp.Messages,\n+\t\tKeys:       serfResp.Keys,\n+\t\tNumNodes:   serfResp.NumNodes,\n+\t\tError:      errStr,\n+\t})\n+}\n+\n+// forwardKeyring handles sending an RPC request to a remote datacenter and\n+// funneling any errors or responses back through the provided channels.\n+func (s *Server) forwardKeyringRPC(\n+\tmethod, dc string,\n+\targs *structs.KeyringRequest,\n+\terrorCh chan<- error,\n+\trespCh chan<- *structs.KeyringResponses) {\n+\n+\trr := structs.KeyringResponses{}\n+\tif err := s.forwardDC(method, dc, args, &rr); err != nil {\n+\t\terrorCh <- err\n+\t\treturn\n+\t}\n+\trespCh <- &rr\n+\treturn\n+}\n+\n+// keyringRPC is used to forward a keyring-related RPC request to one\n+// server in each datacenter. This will only error for RPC-related errors.\n+// Otherwise, application-level errors are returned inside of the inner\n+// response objects.\n+func (s *Server) keyringRPC(","path":"consul/serf.go","position":null,"original_position":55,"commit_id":"1deaddfba7d458dece0446bcbef8b938533caa9f","original_commit_id":"13b5206fcd701440c9cf35671e4a68d21e7f1937","user":{"login":"ryanuber","id":1642288,"avatar_url":"https://avatars.githubusercontent.com/u/1642288?v=2","gravatar_id":"","url":"https://api.github.com/users/ryanuber","html_url":"https://github.com/ryanuber","followers_url":"https://api.github.com/users/ryanuber/followers","following_url":"https://api.github.com/users/ryanuber/following{/other_user}","gists_url":"https://api.github.com/users/ryanuber/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanuber/subscriptions","organizations_url":"https://api.github.com/users/ryanuber/orgs","repos_url":"https://api.github.com/users/ryanuber/repos","events_url":"https://api.github.com/users/ryanuber/events{/privacy}","received_events_url":"https://api.github.com/users/ryanuber/received_events","type":"User","site_admin":false},"body":"I took a pass at generalizing this. I ended up using an interface for the RPC replies, `structs.CompoundResponse`, which has an `Add(interface{})` method for appending responses. The reason for this is because we are expecting one response per DC, and we will just never know what type of response struct to expect back. Doing a type assertion for it inside of `globalRPC` felt ghetto.","created_at":"2014-10-02T07:04:00Z","updated_at":"2014-10-02T07:04:00Z","html_url":"https://github.com/hashicorp/consul/pull/336#discussion_r18324731","pull_request_url":"https://api.github.com/repos/hashicorp/consul/pulls/336","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments/18324731"},"html":{"href":"https://github.com/hashicorp/consul/pull/336#discussion_r18324731"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/336"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/336","id":21196563,"html_url":"https://github.com/hashicorp/consul/pull/336","diff_url":"https://github.com/hashicorp/consul/pull/336.diff","patch_url":"https://github.com/hashicorp/consul/pull/336.patch","issue_url":"https://api.github.com/repos/hashicorp/consul/issues/336","number":336,"state":"open","locked":false,"title":"feature: gossip encryption key rotation","user":{"login":"ryanuber","id":1642288,"avatar_url":"https://avatars.githubusercontent.com/u/1642288?v=2","gravatar_id":"","url":"https://api.github.com/users/ryanuber","html_url":"https://github.com/ryanuber","followers_url":"https://api.github.com/users/ryanuber/followers","following_url":"https://api.github.com/users/ryanuber/following{/other_user}","gists_url":"https://api.github.com/users/ryanuber/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanuber/subscriptions","organizations_url":"https://api.github.com/users/ryanuber/orgs","repos_url":"https://api.github.com/users/ryanuber/repos","events_url":"https://api.github.com/users/ryanuber/events{/privacy}","received_events_url":"https://api.github.com/users/ryanuber/received_events","type":"User","site_admin":false},"body":"Since Serf supports symmetric key rotation for gossip messages, Consul can leverage this to allow key rotation for both the LAN and WAN gossip pools.\r\n\r\nBecause of the multiple gossip pools and a few other semantic differences between Serf and Consul, there are a few things to note about this implementation:\r\n\r\n* The command is `consul keyring` to avoid confusion with TLS keys or KV keys.\r\n* For operational simplicity, both LAN and WAN keyrings are modified / queried in the same command run for all keyring-related commands.\r\n* Only server nodes are allowed to query or modify any keyrings. This avoids ambiguity in running `consul keyring` on a server vs. a client.\r\n* Both LAN and WAN keyrings are persisted separately in consul's data-dir.\r\n* At agent start, if keyring files exist in consul's data directory, they will be automatically loaded and updated if keys change.\r\n* The `-encrypt` argument still works with unmodified behavior\r\n\r\nSome examples of the feature in action in a cluster with one server and one client are in [this gist](https://gist.github.com/ryanuber/435f14e225be7cee12c7).\r\n\r\nI've still got a few more tests and docs to write, but would like feedback on the overall flow of how this is working in its current form.\r\n\r\n Related to #246 ","created_at":"2014-09-13T19:47:26Z","updated_at":"2014-10-02T07:04:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"202f4678aeee6d1955a5c1cc4747e7677da1a412","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/consul/pulls/336/commits","review_comments_url":"https://api.github.com/repos/hashicorp/consul/pulls/336/comments","review_comment_url":"https://api.github.com/repos/hashicorp/consul/pulls/comments/{number}","comments_url":"https://api.github.com/repos/hashicorp/consul/issues/336/comments","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/1deaddfba7d458dece0446bcbef8b938533caa9f","head":{"label":"ryanuber:f-keyring","ref":"f-keyring","sha":"1deaddfba7d458dece0446bcbef8b938533caa9f","user":{"login":"ryanuber","id":1642288,"avatar_url":"https://avatars.githubusercontent.com/u/1642288?v=2","gravatar_id":"","url":"https://api.github.com/users/ryanuber","html_url":"https://github.com/ryanuber","followers_url":"https://api.github.com/users/ryanuber/followers","following_url":"https://api.github.com/users/ryanuber/following{/other_user}","gists_url":"https://api.github.com/users/ryanuber/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanuber/subscriptions","organizations_url":"https://api.github.com/users/ryanuber/orgs","repos_url":"https://api.github.com/users/ryanuber/repos","events_url":"https://api.github.com/users/ryanuber/events{/privacy}","received_events_url":"https://api.github.com/users/ryanuber/received_events","type":"User","site_admin":false},"repo":{"id":20048491,"name":"consul","full_name":"ryanuber/consul","owner":{"login":"ryanuber","id":1642288,"avatar_url":"https://avatars.githubusercontent.com/u/1642288?v=2","gravatar_id":"","url":"https://api.github.com/users/ryanuber","html_url":"https://github.com/ryanuber","followers_url":"https://api.github.com/users/ryanuber/followers","following_url":"https://api.github.com/users/ryanuber/following{/other_user}","gists_url":"https://api.github.com/users/ryanuber/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanuber/subscriptions","organizations_url":"https://api.github.com/users/ryanuber/orgs","repos_url":"https://api.github.com/users/ryanuber/repos","events_url":"https://api.github.com/users/ryanuber/events{/privacy}","received_events_url":"https://api.github.com/users/ryanuber/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ryanuber/consul","description":"Consul is a tool for service discovery, monitoring and configuration.","fork":true,"url":"https://api.github.com/repos/ryanuber/consul","forks_url":"https://api.github.com/repos/ryanuber/consul/forks","keys_url":"https://api.github.com/repos/ryanuber/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ryanuber/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ryanuber/consul/teams","hooks_url":"https://api.github.com/repos/ryanuber/consul/hooks","issue_events_url":"https://api.github.com/repos/ryanuber/consul/issues/events{/number}","events_url":"https://api.github.com/repos/ryanuber/consul/events","assignees_url":"https://api.github.com/repos/ryanuber/consul/assignees{/user}","branches_url":"https://api.github.com/repos/ryanuber/consul/branches{/branch}","tags_url":"https://api.github.com/repos/ryanuber/consul/tags","blobs_url":"https://api.github.com/repos/ryanuber/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ryanuber/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ryanuber/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/ryanuber/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ryanuber/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/ryanuber/consul/languages","stargazers_url":"https://api.github.com/repos/ryanuber/consul/stargazers","contributors_url":"https://api.github.com/repos/ryanuber/consul/contributors","subscribers_url":"https://api.github.com/repos/ryanuber/consul/subscribers","subscription_url":"https://api.github.com/repos/ryanuber/consul/subscription","commits_url":"https://api.github.com/repos/ryanuber/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/ryanuber/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/ryanuber/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/ryanuber/consul/issues/comments/{number}","contents_url":"https://api.github.com/repos/ryanuber/consul/contents/{+path}","compare_url":"https://api.github.com/repos/ryanuber/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ryanuber/consul/merges","archive_url":"https://api.github.com/repos/ryanuber/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ryanuber/consul/downloads","issues_url":"https://api.github.com/repos/ryanuber/consul/issues{/number}","pulls_url":"https://api.github.com/repos/ryanuber/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/ryanuber/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/ryanuber/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ryanuber/consul/labels{/name}","releases_url":"https://api.github.com/repos/ryanuber/consul/releases{/id}","created_at":"2014-05-22T05:01:45Z","updated_at":"2014-09-03T15:42:12Z","pushed_at":"2014-10-02T07:02:58Z","git_url":"git://github.com/ryanuber/consul.git","ssh_url":"git@github.com:ryanuber/consul.git","clone_url":"https://github.com/ryanuber/consul.git","svn_url":"https://github.com/ryanuber/consul","homepage":"http://www.consul.io","size":6759,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"77436a15fd2d5e1cfb9e8af98315b391419f996a","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=2","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,"name":"consul","full_name":"hashicorp/consul","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=2","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},"private":false,"html_url":"https://github.com/hashicorp/consul","description":"Consul is a tool for service discovery, monitoring and configuration.","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}","created_at":"2013-11-04T22:15:27Z","updated_at":"2014-10-02T05:05:01Z","pushed_at":"2014-09-30T20:04:34Z","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":"http://www.consul.io","size":13767,"stargazers_count":1989,"watchers_count":1989,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":151,"mirror_url":null,"open_issues_count":79,"forks":151,"open_issues":79,"watchers":1989,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/336"},"html":{"href":"https://github.com/hashicorp/consul/pull/336"},"issue":{"href":"https://api.github.com/repos/hashicorp/consul/issues/336"},"comments":{"href":"https://api.github.com/repos/hashicorp/consul/issues/336/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/336/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/336/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/consul/statuses/1deaddfba7d458dece0446bcbef8b938533caa9f"}}}}