{"action":"created","comment":{"url":"https://api.github.com/repos/istio/istio/pulls/comments/216182126","pull_request_review_id":153606247,"id":216182126,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjE4MjEyNg==","diff_hunk":"@@ -591,29 +576,64 @@ func (s *Server) createK8sServiceControllers(serviceControllers *aggregate.Contr\n \treturn\n }\n \n-// initMultiClusterController initializes multi cluster controller\n-// currently implemented only for kubernetes registries\n-func (s *Server) initMultiClusterController(args *PilotArgs) error {\n-\tif hasKubeRegistry(args) {\n-\t\ts.addStartFunc(func(stop <-chan struct{}) error {\n-\t\t\tsecretController := clusterregistry.NewController(s.kubeClient,\n-\t\t\t\targs.Config.ClusterRegistriesNamespace,\n-\t\t\t\ts.clusterStore,\n-\t\t\t\ts.ServiceController,\n-\t\t\t\ts.EnvoyXdsServer,\n-\t\t\t\targs.Config.ControllerOptions.ResyncPeriod,\n-\t\t\t\targs.Config.ControllerOptions.WatchedNamespace,\n-\t\t\t\targs.Config.ControllerOptions.DomainSuffix)\n-\n-\t\t\t// Start secret controller which watches for runtime secret Object changes and adds secrets dynamically\n-\t\t\tgo secretController.Run(stop)\n+// initMultiClusterSecretController initializes multi cluster secret controller\n+// to watch for remote cluster additions or deletions.\n+// Currently implemented only for kubernetes registries\n+func (s *Server) initMultiClusterSecretController(args *PilotArgs) (err error) {\n+\tif checkForKubernetes(args.Service.Registries) {\n+\n+\t\terr = secretcontroller.StartSecretController(s.kubeClient, s.addMemberCluster, s.deleteMemberCluster, args.Config.ClusterRegistriesNamespace)\n+\t\tif err != nil {\n+\t\t\treturn fmt.Errorf(\"could not start secret controller: %v\", err)\n+\t\t}\n \n-\t\t\treturn nil\n-\t\t})\n \t}\n \treturn nil\n }\n \n+//addMemberCluster is passed to the secret controller as a callback to be called\n+//when a remote cluster is added\n+func (s *Server) addMemberCluster(clientset kubernetes.Interface, clusterID string) error {\n+\n+\tstopCh := make(chan struct{})\n+\tkubectl := kube.NewController(clientset, kube.ControllerOptions{\n+\t\tWatchedNamespace: s.WatchedNamespace,\n+\t\tResyncPeriod:     s.ResyncPeriod,\n+\t\tDomainSuffix:     s.DomainSuffix,\n+\t})\n+\ts.kubeRegistry[clusterID] = kubectl\n+\ts.ServiceController.AddRegistry(\n+\t\taggregate.Registry{\n+\t\t\tName:             serviceregistry.KubernetesRegistry,\n+\t\t\tClusterID:        clusterID,\n+\t\t\tServiceDiscovery: kubectl,\n+\t\t\tServiceAccounts:  kubectl,\n+\t\t\tController:       kubectl,\n+\t\t})\n+\n+\tkubectl.StopChan = stopCh\n+\n+\t_ = kubectl.AppendServiceHandler(func(*model.Service, model.Event) { s.EnvoyXdsServer.ClearCacheFunc()() })\n+\t_ = kubectl.AppendInstanceHandler(func(*model.ServiceInstance, model.Event) { s.EnvoyXdsServer.ClearCacheFunc()() })\n+\tgo kubectl.Run(stopCh)\n+\n+\treturn nil\n+}\n+\n+// deleteMemberCluster is passed to the secret controller as a callback to be called\n+// when a remote cluster is deleted\n+func (s *Server) deleteMemberCluster(clusterID string) error {","path":"pilot/pkg/bootstrap/server.go","position":192,"original_position":192,"commit_id":"0b33e70d97f16f51872c2436cc95f6110b7be787","original_commit_id":"0b33e70d97f16f51872c2436cc95f6110b7be787","user":{"login":"hzxuzhonghu","id":13374016,"node_id":"MDQ6VXNlcjEzMzc0MDE2","avatar_url":"https://avatars3.githubusercontent.com/u/13374016?v=4","gravatar_id":"","url":"https://api.github.com/users/hzxuzhonghu","html_url":"https://github.com/hzxuzhonghu","followers_url":"https://api.github.com/users/hzxuzhonghu/followers","following_url":"https://api.github.com/users/hzxuzhonghu/following{/other_user}","gists_url":"https://api.github.com/users/hzxuzhonghu/gists{/gist_id}","starred_url":"https://api.github.com/users/hzxuzhonghu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzxuzhonghu/subscriptions","organizations_url":"https://api.github.com/users/hzxuzhonghu/orgs","repos_url":"https://api.github.com/users/hzxuzhonghu/repos","events_url":"https://api.github.com/users/hzxuzhonghu/events{/privacy}","received_events_url":"https://api.github.com/users/hzxuzhonghu/received_events","type":"User","site_admin":false},"body":"same here, we should lock protect `kubeRegistry` ","created_at":"2018-09-10T01:54:05Z","updated_at":"2018-09-10T01:54:06Z","html_url":"https://github.com/istio/istio/pull/8479#discussion_r216182126","pull_request_url":"https://api.github.com/repos/istio/istio/pulls/8479","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/istio/istio/pulls/comments/216182126"},"html":{"href":"https://github.com/istio/istio/pull/8479#discussion_r216182126"},"pull_request":{"href":"https://api.github.com/repos/istio/istio/pulls/8479"}}},"pull_request":{"url":"https://api.github.com/repos/istio/istio/pulls/8479","id":213112186,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzMTEyMTg2","html_url":"https://github.com/istio/istio/pull/8479","diff_url":"https://github.com/istio/istio/pull/8479.diff","patch_url":"https://github.com/istio/istio/pull/8479.patch","issue_url":"https://api.github.com/repos/istio/istio/issues/8479","number":8479,"state":"open","locked":false,"title":"Converts pilot to use common secret controller","user":{"login":"john-a-joyce","id":5739820,"node_id":"MDQ6VXNlcjU3Mzk4MjA=","avatar_url":"https://avatars2.githubusercontent.com/u/5739820?v=4","gravatar_id":"","url":"https://api.github.com/users/john-a-joyce","html_url":"https://github.com/john-a-joyce","followers_url":"https://api.github.com/users/john-a-joyce/followers","following_url":"https://api.github.com/users/john-a-joyce/following{/other_user}","gists_url":"https://api.github.com/users/john-a-joyce/gists{/gist_id}","starred_url":"https://api.github.com/users/john-a-joyce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/john-a-joyce/subscriptions","organizations_url":"https://api.github.com/users/john-a-joyce/orgs","repos_url":"https://api.github.com/users/john-a-joyce/repos","events_url":"https://api.github.com/users/john-a-joyce/events{/privacy}","received_events_url":"https://api.github.com/users/john-a-joyce/received_events","type":"User","site_admin":false},"body":"This change converts pilot to use a common multicluster\r\nsecret controller library.  The library was committed in\r\nhttps://github.com/istio/istio/pull/7574.","created_at":"2018-09-04T21:42:46Z","updated_at":"2018-09-10T01:54:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd14d8ee623938d57fe82dc9afe4b1926a21809b","assignee":null,"assignees":[],"requested_reviewers":[{"login":"nmittler","id":6493296,"node_id":"MDQ6VXNlcjY0OTMyOTY=","avatar_url":"https://avatars3.githubusercontent.com/u/6493296?v=4","gravatar_id":"","url":"https://api.github.com/users/nmittler","html_url":"https://github.com/nmittler","followers_url":"https://api.github.com/users/nmittler/followers","following_url":"https://api.github.com/users/nmittler/following{/other_user}","gists_url":"https://api.github.com/users/nmittler/gists{/gist_id}","starred_url":"https://api.github.com/users/nmittler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmittler/subscriptions","organizations_url":"https://api.github.com/users/nmittler/orgs","repos_url":"https://api.github.com/users/nmittler/repos","events_url":"https://api.github.com/users/nmittler/events{/privacy}","received_events_url":"https://api.github.com/users/nmittler/received_events","type":"User","site_admin":false},{"login":"GregHanson","id":19473391,"node_id":"MDQ6VXNlcjE5NDczMzkx","avatar_url":"https://avatars3.githubusercontent.com/u/19473391?v=4","gravatar_id":"","url":"https://api.github.com/users/GregHanson","html_url":"https://github.com/GregHanson","followers_url":"https://api.github.com/users/GregHanson/followers","following_url":"https://api.github.com/users/GregHanson/following{/other_user}","gists_url":"https://api.github.com/users/GregHanson/gists{/gist_id}","starred_url":"https://api.github.com/users/GregHanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GregHanson/subscriptions","organizations_url":"https://api.github.com/users/GregHanson/orgs","repos_url":"https://api.github.com/users/GregHanson/repos","events_url":"https://api.github.com/users/GregHanson/events{/privacy}","received_events_url":"https://api.github.com/users/GregHanson/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":491318011,"node_id":"MDU6TGFiZWw0OTEzMTgwMTE=","url":"https://api.github.com/repos/istio/istio/labels/cla:%20yes","name":"cla: yes","color":"bfdadc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/istio/istio/pulls/8479/commits","review_comments_url":"https://api.github.com/repos/istio/istio/pulls/8479/comments","review_comment_url":"https://api.github.com/repos/istio/istio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/istio/istio/issues/8479/comments","statuses_url":"https://api.github.com/repos/istio/istio/statuses/0b33e70d97f16f51872c2436cc95f6110b7be787","head":{"label":"john-a-joyce:pilot_secret_lib","ref":"pilot_secret_lib","sha":"0b33e70d97f16f51872c2436cc95f6110b7be787","user":{"login":"john-a-joyce","id":5739820,"node_id":"MDQ6VXNlcjU3Mzk4MjA=","avatar_url":"https://avatars2.githubusercontent.com/u/5739820?v=4","gravatar_id":"","url":"https://api.github.com/users/john-a-joyce","html_url":"https://github.com/john-a-joyce","followers_url":"https://api.github.com/users/john-a-joyce/followers","following_url":"https://api.github.com/users/john-a-joyce/following{/other_user}","gists_url":"https://api.github.com/users/john-a-joyce/gists{/gist_id}","starred_url":"https://api.github.com/users/john-a-joyce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/john-a-joyce/subscriptions","organizations_url":"https://api.github.com/users/john-a-joyce/orgs","repos_url":"https://api.github.com/users/john-a-joyce/repos","events_url":"https://api.github.com/users/john-a-joyce/events{/privacy}","received_events_url":"https://api.github.com/users/john-a-joyce/received_events","type":"User","site_admin":false},"repo":{"id":116427797,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY0Mjc3OTc=","name":"istio","full_name":"john-a-joyce/istio","owner":{"login":"john-a-joyce","id":5739820,"node_id":"MDQ6VXNlcjU3Mzk4MjA=","avatar_url":"https://avatars2.githubusercontent.com/u/5739820?v=4","gravatar_id":"","url":"https://api.github.com/users/john-a-joyce","html_url":"https://github.com/john-a-joyce","followers_url":"https://api.github.com/users/john-a-joyce/followers","following_url":"https://api.github.com/users/john-a-joyce/following{/other_user}","gists_url":"https://api.github.com/users/john-a-joyce/gists{/gist_id}","starred_url":"https://api.github.com/users/john-a-joyce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/john-a-joyce/subscriptions","organizations_url":"https://api.github.com/users/john-a-joyce/orgs","repos_url":"https://api.github.com/users/john-a-joyce/repos","events_url":"https://api.github.com/users/john-a-joyce/events{/privacy}","received_events_url":"https://api.github.com/users/john-a-joyce/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/john-a-joyce/istio","description":"An open platform to connect, manage, and secure microservices.","fork":true,"url":"https://api.github.com/repos/john-a-joyce/istio","forks_url":"https://api.github.com/repos/john-a-joyce/istio/forks","keys_url":"https://api.github.com/repos/john-a-joyce/istio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/john-a-joyce/istio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/john-a-joyce/istio/teams","hooks_url":"https://api.github.com/repos/john-a-joyce/istio/hooks","issue_events_url":"https://api.github.com/repos/john-a-joyce/istio/issues/events{/number}","events_url":"https://api.github.com/repos/john-a-joyce/istio/events","assignees_url":"https://api.github.com/repos/john-a-joyce/istio/assignees{/user}","branches_url":"https://api.github.com/repos/john-a-joyce/istio/branches{/branch}","tags_url":"https://api.github.com/repos/john-a-joyce/istio/tags","blobs_url":"https://api.github.com/repos/john-a-joyce/istio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/john-a-joyce/istio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/john-a-joyce/istio/git/refs{/sha}","trees_url":"https://api.github.com/repos/john-a-joyce/istio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/john-a-joyce/istio/statuses/{sha}","languages_url":"https://api.github.com/repos/john-a-joyce/istio/languages","stargazers_url":"https://api.github.com/repos/john-a-joyce/istio/stargazers","contributors_url":"https://api.github.com/repos/john-a-joyce/istio/contributors","subscribers_url":"https://api.github.com/repos/john-a-joyce/istio/subscribers","subscription_url":"https://api.github.com/repos/john-a-joyce/istio/subscription","commits_url":"https://api.github.com/repos/john-a-joyce/istio/commits{/sha}","git_commits_url":"https://api.github.com/repos/john-a-joyce/istio/git/commits{/sha}","comments_url":"https://api.github.com/repos/john-a-joyce/istio/comments{/number}","issue_comment_url":"https://api.github.com/repos/john-a-joyce/istio/issues/comments{/number}","contents_url":"https://api.github.com/repos/john-a-joyce/istio/contents/{+path}","compare_url":"https://api.github.com/repos/john-a-joyce/istio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/john-a-joyce/istio/merges","archive_url":"https://api.github.com/repos/john-a-joyce/istio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/john-a-joyce/istio/downloads","issues_url":"https://api.github.com/repos/john-a-joyce/istio/issues{/number}","pulls_url":"https://api.github.com/repos/john-a-joyce/istio/pulls{/number}","milestones_url":"https://api.github.com/repos/john-a-joyce/istio/milestones{/number}","notifications_url":"https://api.github.com/repos/john-a-joyce/istio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/john-a-joyce/istio/labels{/name}","releases_url":"https://api.github.com/repos/john-a-joyce/istio/releases{/id}","deployments_url":"https://api.github.com/repos/john-a-joyce/istio/deployments","created_at":"2018-01-05T21:18:56Z","updated_at":"2018-03-21T19:53:36Z","pushed_at":"2018-09-09T22:02:50Z","git_url":"git://github.com/john-a-joyce/istio.git","ssh_url":"git@github.com:john-a-joyce/istio.git","clone_url":"https://github.com/john-a-joyce/istio.git","svn_url":"https://github.com/john-a-joyce/istio","homepage":"https://istio.io","size":47106,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"istio:master","ref":"master","sha":"b19ce20590581a87cc828704f1530a38d75dbeb7","user":{"login":"istio","id":23534644,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzNTM0NjQ0","avatar_url":"https://avatars1.githubusercontent.com/u/23534644?v=4","gravatar_id":"","url":"https://api.github.com/users/istio","html_url":"https://github.com/istio","followers_url":"https://api.github.com/users/istio/followers","following_url":"https://api.github.com/users/istio/following{/other_user}","gists_url":"https://api.github.com/users/istio/gists{/gist_id}","starred_url":"https://api.github.com/users/istio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/istio/subscriptions","organizations_url":"https://api.github.com/users/istio/orgs","repos_url":"https://api.github.com/users/istio/repos","events_url":"https://api.github.com/users/istio/events{/privacy}","received_events_url":"https://api.github.com/users/istio/received_events","type":"Organization","site_admin":false},"repo":{"id":74175805,"node_id":"MDEwOlJlcG9zaXRvcnk3NDE3NTgwNQ==","name":"istio","full_name":"istio/istio","owner":{"login":"istio","id":23534644,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzNTM0NjQ0","avatar_url":"https://avatars1.githubusercontent.com/u/23534644?v=4","gravatar_id":"","url":"https://api.github.com/users/istio","html_url":"https://github.com/istio","followers_url":"https://api.github.com/users/istio/followers","following_url":"https://api.github.com/users/istio/following{/other_user}","gists_url":"https://api.github.com/users/istio/gists{/gist_id}","starred_url":"https://api.github.com/users/istio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/istio/subscriptions","organizations_url":"https://api.github.com/users/istio/orgs","repos_url":"https://api.github.com/users/istio/repos","events_url":"https://api.github.com/users/istio/events{/privacy}","received_events_url":"https://api.github.com/users/istio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/istio/istio","description":"Connect, secure, control, and observe services.","fork":false,"url":"https://api.github.com/repos/istio/istio","forks_url":"https://api.github.com/repos/istio/istio/forks","keys_url":"https://api.github.com/repos/istio/istio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/istio/istio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/istio/istio/teams","hooks_url":"https://api.github.com/repos/istio/istio/hooks","issue_events_url":"https://api.github.com/repos/istio/istio/issues/events{/number}","events_url":"https://api.github.com/repos/istio/istio/events","assignees_url":"https://api.github.com/repos/istio/istio/assignees{/user}","branches_url":"https://api.github.com/repos/istio/istio/branches{/branch}","tags_url":"https://api.github.com/repos/istio/istio/tags","blobs_url":"https://api.github.com/repos/istio/istio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/istio/istio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/istio/istio/git/refs{/sha}","trees_url":"https://api.github.com/repos/istio/istio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/istio/istio/statuses/{sha}","languages_url":"https://api.github.com/repos/istio/istio/languages","stargazers_url":"https://api.github.com/repos/istio/istio/stargazers","contributors_url":"https://api.github.com/repos/istio/istio/contributors","subscribers_url":"https://api.github.com/repos/istio/istio/subscribers","subscription_url":"https://api.github.com/repos/istio/istio/subscription","commits_url":"https://api.github.com/repos/istio/istio/commits{/sha}","git_commits_url":"https://api.github.com/repos/istio/istio/git/commits{/sha}","comments_url":"https://api.github.com/repos/istio/istio/comments{/number}","issue_comment_url":"https://api.github.com/repos/istio/istio/issues/comments{/number}","contents_url":"https://api.github.com/repos/istio/istio/contents/{+path}","compare_url":"https://api.github.com/repos/istio/istio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/istio/istio/merges","archive_url":"https://api.github.com/repos/istio/istio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/istio/istio/downloads","issues_url":"https://api.github.com/repos/istio/istio/issues{/number}","pulls_url":"https://api.github.com/repos/istio/istio/pulls{/number}","milestones_url":"https://api.github.com/repos/istio/istio/milestones{/number}","notifications_url":"https://api.github.com/repos/istio/istio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/istio/istio/labels{/name}","releases_url":"https://api.github.com/repos/istio/istio/releases{/id}","deployments_url":"https://api.github.com/repos/istio/istio/deployments","created_at":"2016-11-18T23:57:21Z","updated_at":"2018-09-10T01:44:12Z","pushed_at":"2018-09-10T01:53:38Z","git_url":"git://github.com/istio/istio.git","ssh_url":"git@github.com:istio/istio.git","clone_url":"https://github.com/istio/istio.git","svn_url":"https://github.com/istio/istio","homepage":"https://istio.io","size":48218,"stargazers_count":11504,"watchers_count":11504,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1676,"mirror_url":null,"archived":false,"open_issues_count":891,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1676,"open_issues":891,"watchers":11504,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/istio/istio/pulls/8479"},"html":{"href":"https://github.com/istio/istio/pull/8479"},"issue":{"href":"https://api.github.com/repos/istio/istio/issues/8479"},"comments":{"href":"https://api.github.com/repos/istio/istio/issues/8479/comments"},"review_comments":{"href":"https://api.github.com/repos/istio/istio/pulls/8479/comments"},"review_comment":{"href":"https://api.github.com/repos/istio/istio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/istio/istio/pulls/8479/commits"},"statuses":{"href":"https://api.github.com/repos/istio/istio/statuses/0b33e70d97f16f51872c2436cc95f6110b7be787"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hzxuzhonghu"}}