{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/contrib/pulls/comments/58427992","id":58427992,"diff_hunk":"@@ -51,3 +56,78 @@ func NewInMemoryPool() *InMemoryPool {\n \treturn &InMemoryPool{\n \t\tcache.NewThreadSafeStore(cache.Indexers{}, cache.Indices{})}\n }\n+\n+type keyFunc func(interface{}) (string, error)\n+\n+type cloudLister interface {\n+\tList() ([]interface{}, error)\n+}\n+\n+// CloudListingPool wraps InMemoryPool but relists from the cloud periodically.\n+type CloudListingPool struct {\n+\t// A lock to protect against concurrent mutation of the pool\n+\tlock sync.Mutex\n+\t// The pool that is re-populated via re-list from cloud, and written to\n+\t// from controller\n+\t*InMemoryPool\n+\t// An interface that lists objects from the cloud.\n+\tlister cloudLister\n+\t// A function capable of producing a key for a given object.\n+\t// This key must match the key used to store the same object in the user of\n+\t// this cache.\n+\tkeyGetter keyFunc\n+}\n+\n+// ReplinishPool lists through the cloudLister and inserts into the pool.\n+func (c *CloudListingPool) ReplinishPool() {\n+\tc.lock.Lock()\n+\tdefer c.lock.Unlock()\n+\tglog.V(4).Infof(\"Replinishing pool\")\n+\titems, err := c.lister.List()\n+\tif err != nil {\n+\t\tglog.Warningf(\"Failed to list: %v\", err)\n+\t\treturn\n+\t}\n+\tfor i := range items {\n+\t\tkey, err := c.keyGetter(items[i])\n+\t\tif err != nil {\n+\t\t\tglog.V(4).Infof(\"CloudListingPool: %v\", err)\n+\t\t\tcontinue\n+\t\t}\n+\t\tc.InMemoryPool.Add(key, items[i])","path":"ingress/controllers/gce/storage/pools.go","position":55,"original_position":55,"commit_id":"fc525de85987c40b2554977a5f7266cb91df9401","original_commit_id":"aa301187f710bae5035cc7d2b681a87af4c8e626","user":{"login":"freehan","id":1332699,"avatar_url":"https://avatars.githubusercontent.com/u/1332699?v=3","gravatar_id":"","url":"https://api.github.com/users/freehan","html_url":"https://github.com/freehan","followers_url":"https://api.github.com/users/freehan/followers","following_url":"https://api.github.com/users/freehan/following{/other_user}","gists_url":"https://api.github.com/users/freehan/gists{/gist_id}","starred_url":"https://api.github.com/users/freehan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freehan/subscriptions","organizations_url":"https://api.github.com/users/freehan/orgs","repos_url":"https://api.github.com/users/freehan/repos","events_url":"https://api.github.com/users/freehan/events{/privacy}","received_events_url":"https://api.github.com/users/freehan/received_events","type":"User","site_admin":false},"body":"Only Add. No delete? ","created_at":"2016-04-04T18:53:34Z","updated_at":"2016-04-04T18:53:34Z","html_url":"https://github.com/kubernetes/contrib/pull/652#discussion_r58427992","pull_request_url":"https://api.github.com/repos/kubernetes/contrib/pulls/652","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/contrib/pulls/comments/58427992"},"html":{"href":"https://github.com/kubernetes/contrib/pull/652#discussion_r58427992"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/contrib/pulls/652"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/contrib/pulls/652","id":64381446,"html_url":"https://github.com/kubernetes/contrib/pull/652","diff_url":"https://github.com/kubernetes/contrib/pull/652.diff","patch_url":"https://github.com/kubernetes/contrib/pull/652.patch","issue_url":"https://api.github.com/repos/kubernetes/contrib/issues/652","number":652,"state":"open","locked":false,"title":"Resilience fixes for the Ingress controller","user":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"body":"Reasoning for each commit:\r\n1. UrlMap updating logic was too complicated, because it accounted for \"joining\" which we don't care about right now.\r\n2. Errors at the beginning of the sync() function would prevent cloud urlmaps from getting cleaned up\r\n3. The controller would silently forget about resources if it was restarted, and while down someone modified an Ingress\r\n4. Retry creating GCE client since it can fail if we don't resolve metadata server","created_at":"2016-03-28T21:46:31Z","updated_at":"2016-04-04T18:53:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f31106b9d9e641727903c28da9b500f0c122af82","assignee":{"login":"freehan","id":1332699,"avatar_url":"https://avatars.githubusercontent.com/u/1332699?v=3","gravatar_id":"","url":"https://api.github.com/users/freehan","html_url":"https://github.com/freehan","followers_url":"https://api.github.com/users/freehan/followers","following_url":"https://api.github.com/users/freehan/following{/other_user}","gists_url":"https://api.github.com/users/freehan/gists{/gist_id}","starred_url":"https://api.github.com/users/freehan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freehan/subscriptions","organizations_url":"https://api.github.com/users/freehan/orgs","repos_url":"https://api.github.com/users/freehan/repos","events_url":"https://api.github.com/users/freehan/events{/privacy}","received_events_url":"https://api.github.com/users/freehan/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/contrib/pulls/652/commits","review_comments_url":"https://api.github.com/repos/kubernetes/contrib/pulls/652/comments","review_comment_url":"https://api.github.com/repos/kubernetes/contrib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/contrib/issues/652/comments","statuses_url":"https://api.github.com/repos/kubernetes/contrib/statuses/fc525de85987c40b2554977a5f7266cb91df9401","head":{"label":"bprashanth:ing_resilience","ref":"ing_resilience","sha":"fc525de85987c40b2554977a5f7266cb91df9401","user":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"repo":{"id":41126871,"name":"contrib","full_name":"bprashanth/contrib","owner":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bprashanth/contrib","description":"","fork":true,"url":"https://api.github.com/repos/bprashanth/contrib","forks_url":"https://api.github.com/repos/bprashanth/contrib/forks","keys_url":"https://api.github.com/repos/bprashanth/contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bprashanth/contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bprashanth/contrib/teams","hooks_url":"https://api.github.com/repos/bprashanth/contrib/hooks","issue_events_url":"https://api.github.com/repos/bprashanth/contrib/issues/events{/number}","events_url":"https://api.github.com/repos/bprashanth/contrib/events","assignees_url":"https://api.github.com/repos/bprashanth/contrib/assignees{/user}","branches_url":"https://api.github.com/repos/bprashanth/contrib/branches{/branch}","tags_url":"https://api.github.com/repos/bprashanth/contrib/tags","blobs_url":"https://api.github.com/repos/bprashanth/contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bprashanth/contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bprashanth/contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/bprashanth/contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bprashanth/contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/bprashanth/contrib/languages","stargazers_url":"https://api.github.com/repos/bprashanth/contrib/stargazers","contributors_url":"https://api.github.com/repos/bprashanth/contrib/contributors","subscribers_url":"https://api.github.com/repos/bprashanth/contrib/subscribers","subscription_url":"https://api.github.com/repos/bprashanth/contrib/subscription","commits_url":"https://api.github.com/repos/bprashanth/contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/bprashanth/contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/bprashanth/contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/bprashanth/contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/bprashanth/contrib/contents/{+path}","compare_url":"https://api.github.com/repos/bprashanth/contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bprashanth/contrib/merges","archive_url":"https://api.github.com/repos/bprashanth/contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bprashanth/contrib/downloads","issues_url":"https://api.github.com/repos/bprashanth/contrib/issues{/number}","pulls_url":"https://api.github.com/repos/bprashanth/contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/bprashanth/contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/bprashanth/contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bprashanth/contrib/labels{/name}","releases_url":"https://api.github.com/repos/bprashanth/contrib/releases{/id}","deployments_url":"https://api.github.com/repos/bprashanth/contrib/deployments","created_at":"2015-08-21T01:24:13Z","updated_at":"2015-08-21T01:24:13Z","pushed_at":"2016-04-04T05:25:45Z","git_url":"git://github.com/bprashanth/contrib.git","ssh_url":"git@github.com:bprashanth/contrib.git","clone_url":"https://github.com/bprashanth/contrib.git","svn_url":"https://github.com/bprashanth/contrib","homepage":null,"size":24142,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"33bd3069434edfe266aebf9529b719edf4c90ed4","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":40686014,"name":"contrib","full_name":"kubernetes/contrib","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/contrib","description":"This is a place for various components in the Kubernetes ecosystem that aren't part of the Kubernetes core.","fork":false,"url":"https://api.github.com/repos/kubernetes/contrib","forks_url":"https://api.github.com/repos/kubernetes/contrib/forks","keys_url":"https://api.github.com/repos/kubernetes/contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/contrib/teams","hooks_url":"https://api.github.com/repos/kubernetes/contrib/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/contrib/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/contrib/events","assignees_url":"https://api.github.com/repos/kubernetes/contrib/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/contrib/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/contrib/tags","blobs_url":"https://api.github.com/repos/kubernetes/contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/contrib/languages","stargazers_url":"https://api.github.com/repos/kubernetes/contrib/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/contrib/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/contrib/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/contrib/subscription","commits_url":"https://api.github.com/repos/kubernetes/contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/contrib/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/contrib/merges","archive_url":"https://api.github.com/repos/kubernetes/contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/contrib/downloads","issues_url":"https://api.github.com/repos/kubernetes/contrib/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/contrib/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/contrib/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/contrib/deployments","created_at":"2015-08-13T23:18:26Z","updated_at":"2016-04-04T11:08:04Z","pushed_at":"2016-04-04T16:55:36Z","git_url":"git://github.com/kubernetes/contrib.git","ssh_url":"git@github.com:kubernetes/contrib.git","clone_url":"https://github.com/kubernetes/contrib.git","svn_url":"https://github.com/kubernetes/contrib","homepage":"","size":40084,"stargazers_count":221,"watchers_count":221,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":201,"mirror_url":null,"open_issues_count":146,"forks":201,"open_issues":146,"watchers":221,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/contrib/pulls/652"},"html":{"href":"https://github.com/kubernetes/contrib/pull/652"},"issue":{"href":"https://api.github.com/repos/kubernetes/contrib/issues/652"},"comments":{"href":"https://api.github.com/repos/kubernetes/contrib/issues/652/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/contrib/pulls/652/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/contrib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/contrib/pulls/652/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/contrib/statuses/fc525de85987c40b2554977a5f7266cb91df9401"}}}}