{"action":"created","comment":{"url":"https://api.github.com/repos/NetSys/quilt/pulls/comments/93605938","pull_request_review_id":14136603,"id":93605938,"diff_hunk":"@@ -314,6 +352,113 @@ func (clst Cluster) getClient(region string) client {\n \treturn clst.clients[region]\n }\n \n+func (clst Cluster) associateFloatingIPs(requests []floatingIP) error {\n+\tif len(requests) == 0 {\n+\t\treturn nil\n+\t}\n+\n+\t// toAssociate is a map of region to spot ID to floating IP.\n+\ttoAssociate := map[string]map[string]floatingIP{}\n+\tfor _, ip := range requests {\n+\t\t// Instantiate region map if doesn't already exist\n+\t\tif _, ok := toAssociate[ip.region]; !ok {\n+\t\t\ttoAssociate[ip.region] = map[string]floatingIP{}\n+\t\t}\n+\n+\t\ttoAssociate[ip.region][ip.spotID] = ip\n+\t}\n+\n+\tfor region, floatingIPs := range toAssociate {\n+\t\tclient := clst.getClient(region)\n+\n+\t\t// Build a map of address to allocation ID for all Elastic IPs.\n+\t\taddressDesc, err := client.DescribeAddresses(nil)\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t\tavailableAddresses := map[string]string{}\n+\t\tfor _, address := range addressDesc.Addresses {\n+\t\t\tavailableAddresses[*address.PublicIp] = *address.AllocationId\n+\t\t}\n+\n+\t\tvar spotIDs []string\n+\t\tfor _, ip := range floatingIPs {\n+\t\t\tspotIDs = append(spotIDs, ip.spotID)\n+\t\t}\n+\n+\t\t// Build a map of spot IDs to *running* EC2 instances.\n+\t\tvar instances map[string]*ec2.Instance\n+\t\terr = util.WaitFor(func() bool {\n+\t\t\tinstances, err = clst.getInstances(region, spotIDs)\n+\t\t\tif err != nil {\n+\t\t\t\treturn true\n+\t\t\t}\n+\n+\t\t\tfor _, inst := range instances {\n+\t\t\t\tif inst == nil ||\n+\t\t\t\t\t*inst.State.Name != ec2.InstanceStateNameRunning {\n+\t\t\t\t\treturn false\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\treturn true\n+\t\t}, 10*time.Second, 15*time.Minute)","path":"cluster/amazon/amazon.go","position":null,"original_position":168,"commit_id":"954a963871b74ff47bc436529c66b4bb0ba8c321","original_commit_id":"2ab42eb22c8b349a03e5563ccbeb0a3e2e87002c","user":{"login":"LuiseV","id":10263364,"avatar_url":"https://avatars.githubusercontent.com/u/10263364?v=3","gravatar_id":"","url":"https://api.github.com/users/LuiseV","html_url":"https://github.com/LuiseV","followers_url":"https://api.github.com/users/LuiseV/followers","following_url":"https://api.github.com/users/LuiseV/following{/other_user}","gists_url":"https://api.github.com/users/LuiseV/gists{/gist_id}","starred_url":"https://api.github.com/users/LuiseV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuiseV/subscriptions","organizations_url":"https://api.github.com/users/LuiseV/orgs","repos_url":"https://api.github.com/users/LuiseV/repos","events_url":"https://api.github.com/users/LuiseV/events{/privacy}","received_events_url":"https://api.github.com/users/LuiseV/received_events","type":"User","site_admin":false},"body":"Yeah, I'd say something between 5 and 10 minutes.","created_at":"2016-12-22T11:15:15Z","updated_at":"2016-12-22T11:15:15Z","html_url":"https://github.com/NetSys/quilt/pull/587#discussion_r93605938","pull_request_url":"https://api.github.com/repos/NetSys/quilt/pulls/587","_links":{"self":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/comments/93605938"},"html":{"href":"https://github.com/NetSys/quilt/pull/587#discussion_r93605938"},"pull_request":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/587"}}},"pull_request":{"url":"https://api.github.com/repos/NetSys/quilt/pulls/587","id":93504831,"html_url":"https://github.com/NetSys/quilt/pull/587","diff_url":"https://github.com/NetSys/quilt/pull/587.diff","patch_url":"https://github.com/NetSys/quilt/pull/587.patch","issue_url":"https://api.github.com/repos/NetSys/quilt/issues/587","number":587,"state":"open","locked":false,"title":"Floating IPs","user":{"login":"tejasmanohar","id":5959235,"avatar_url":"https://avatars.githubusercontent.com/u/5959235?v=3","gravatar_id":"","url":"https://api.github.com/users/tejasmanohar","html_url":"https://github.com/tejasmanohar","followers_url":"https://api.github.com/users/tejasmanohar/followers","following_url":"https://api.github.com/users/tejasmanohar/following{/other_user}","gists_url":"https://api.github.com/users/tejasmanohar/gists{/gist_id}","starred_url":"https://api.github.com/users/tejasmanohar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejasmanohar/subscriptions","organizations_url":"https://api.github.com/users/tejasmanohar/orgs","repos_url":"https://api.github.com/users/tejasmanohar/repos","events_url":"https://api.github.com/users/tejasmanohar/events{/privacy}","received_events_url":"https://api.github.com/users/tejasmanohar/received_events","type":"User","site_admin":false},"body":"v0 of Floating IPs. They're implemented as machine rules, which are at the label/service, not container-level, so that's a bit awkward since 1 IP : 1 container, but I think we should fix this in a refactor of placement rules (and maybe under the hood-- e.g. assign a rule of [\"eip-1\", \"eip-2\"] to a label with 2 containers).","created_at":"2016-11-14T03:54:01Z","updated_at":"2016-12-22T11:15:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68526a13942959ccbb598da4ca5a8df87bc75fc8","assignee":{"login":"LuiseV","id":10263364,"avatar_url":"https://avatars.githubusercontent.com/u/10263364?v=3","gravatar_id":"","url":"https://api.github.com/users/LuiseV","html_url":"https://github.com/LuiseV","followers_url":"https://api.github.com/users/LuiseV/followers","following_url":"https://api.github.com/users/LuiseV/following{/other_user}","gists_url":"https://api.github.com/users/LuiseV/gists{/gist_id}","starred_url":"https://api.github.com/users/LuiseV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuiseV/subscriptions","organizations_url":"https://api.github.com/users/LuiseV/orgs","repos_url":"https://api.github.com/users/LuiseV/repos","events_url":"https://api.github.com/users/LuiseV/events{/privacy}","received_events_url":"https://api.github.com/users/LuiseV/received_events","type":"User","site_admin":false},"assignees":[{"login":"LuiseV","id":10263364,"avatar_url":"https://avatars.githubusercontent.com/u/10263364?v=3","gravatar_id":"","url":"https://api.github.com/users/LuiseV","html_url":"https://github.com/LuiseV","followers_url":"https://api.github.com/users/LuiseV/followers","following_url":"https://api.github.com/users/LuiseV/following{/other_user}","gists_url":"https://api.github.com/users/LuiseV/gists{/gist_id}","starred_url":"https://api.github.com/users/LuiseV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuiseV/subscriptions","organizations_url":"https://api.github.com/users/LuiseV/orgs","repos_url":"https://api.github.com/users/LuiseV/repos","events_url":"https://api.github.com/users/LuiseV/events{/privacy}","received_events_url":"https://api.github.com/users/LuiseV/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/NetSys/quilt/pulls/587/commits","review_comments_url":"https://api.github.com/repos/NetSys/quilt/pulls/587/comments","review_comment_url":"https://api.github.com/repos/NetSys/quilt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NetSys/quilt/issues/587/comments","statuses_url":"https://api.github.com/repos/NetSys/quilt/statuses/954a963871b74ff47bc436529c66b4bb0ba8c321","head":{"label":"tejasmanohar:floating_ips","ref":"floating_ips","sha":"954a963871b74ff47bc436529c66b4bb0ba8c321","user":{"login":"tejasmanohar","id":5959235,"avatar_url":"https://avatars.githubusercontent.com/u/5959235?v=3","gravatar_id":"","url":"https://api.github.com/users/tejasmanohar","html_url":"https://github.com/tejasmanohar","followers_url":"https://api.github.com/users/tejasmanohar/followers","following_url":"https://api.github.com/users/tejasmanohar/following{/other_user}","gists_url":"https://api.github.com/users/tejasmanohar/gists{/gist_id}","starred_url":"https://api.github.com/users/tejasmanohar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejasmanohar/subscriptions","organizations_url":"https://api.github.com/users/tejasmanohar/orgs","repos_url":"https://api.github.com/users/tejasmanohar/repos","events_url":"https://api.github.com/users/tejasmanohar/events{/privacy}","received_events_url":"https://api.github.com/users/tejasmanohar/received_events","type":"User","site_admin":false},"repo":{"id":69329769,"name":"quilt","full_name":"tejasmanohar/quilt","owner":{"login":"tejasmanohar","id":5959235,"avatar_url":"https://avatars.githubusercontent.com/u/5959235?v=3","gravatar_id":"","url":"https://api.github.com/users/tejasmanohar","html_url":"https://github.com/tejasmanohar","followers_url":"https://api.github.com/users/tejasmanohar/followers","following_url":"https://api.github.com/users/tejasmanohar/following{/other_user}","gists_url":"https://api.github.com/users/tejasmanohar/gists{/gist_id}","starred_url":"https://api.github.com/users/tejasmanohar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejasmanohar/subscriptions","organizations_url":"https://api.github.com/users/tejasmanohar/orgs","repos_url":"https://api.github.com/users/tejasmanohar/repos","events_url":"https://api.github.com/users/tejasmanohar/events{/privacy}","received_events_url":"https://api.github.com/users/tejasmanohar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tejasmanohar/quilt","description":"Quilt","fork":true,"url":"https://api.github.com/repos/tejasmanohar/quilt","forks_url":"https://api.github.com/repos/tejasmanohar/quilt/forks","keys_url":"https://api.github.com/repos/tejasmanohar/quilt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tejasmanohar/quilt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tejasmanohar/quilt/teams","hooks_url":"https://api.github.com/repos/tejasmanohar/quilt/hooks","issue_events_url":"https://api.github.com/repos/tejasmanohar/quilt/issues/events{/number}","events_url":"https://api.github.com/repos/tejasmanohar/quilt/events","assignees_url":"https://api.github.com/repos/tejasmanohar/quilt/assignees{/user}","branches_url":"https://api.github.com/repos/tejasmanohar/quilt/branches{/branch}","tags_url":"https://api.github.com/repos/tejasmanohar/quilt/tags","blobs_url":"https://api.github.com/repos/tejasmanohar/quilt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tejasmanohar/quilt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tejasmanohar/quilt/git/refs{/sha}","trees_url":"https://api.github.com/repos/tejasmanohar/quilt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tejasmanohar/quilt/statuses/{sha}","languages_url":"https://api.github.com/repos/tejasmanohar/quilt/languages","stargazers_url":"https://api.github.com/repos/tejasmanohar/quilt/stargazers","contributors_url":"https://api.github.com/repos/tejasmanohar/quilt/contributors","subscribers_url":"https://api.github.com/repos/tejasmanohar/quilt/subscribers","subscription_url":"https://api.github.com/repos/tejasmanohar/quilt/subscription","commits_url":"https://api.github.com/repos/tejasmanohar/quilt/commits{/sha}","git_commits_url":"https://api.github.com/repos/tejasmanohar/quilt/git/commits{/sha}","comments_url":"https://api.github.com/repos/tejasmanohar/quilt/comments{/number}","issue_comment_url":"https://api.github.com/repos/tejasmanohar/quilt/issues/comments{/number}","contents_url":"https://api.github.com/repos/tejasmanohar/quilt/contents/{+path}","compare_url":"https://api.github.com/repos/tejasmanohar/quilt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tejasmanohar/quilt/merges","archive_url":"https://api.github.com/repos/tejasmanohar/quilt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tejasmanohar/quilt/downloads","issues_url":"https://api.github.com/repos/tejasmanohar/quilt/issues{/number}","pulls_url":"https://api.github.com/repos/tejasmanohar/quilt/pulls{/number}","milestones_url":"https://api.github.com/repos/tejasmanohar/quilt/milestones{/number}","notifications_url":"https://api.github.com/repos/tejasmanohar/quilt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tejasmanohar/quilt/labels{/name}","releases_url":"https://api.github.com/repos/tejasmanohar/quilt/releases{/id}","deployments_url":"https://api.github.com/repos/tejasmanohar/quilt/deployments","created_at":"2016-09-27T07:15:53Z","updated_at":"2016-09-27T07:15:55Z","pushed_at":"2016-12-21T21:16:11Z","git_url":"git://github.com/tejasmanohar/quilt.git","ssh_url":"git@github.com:tejasmanohar/quilt.git","clone_url":"https://github.com/tejasmanohar/quilt.git","svn_url":"https://github.com/tejasmanohar/quilt","homepage":"","size":17599,"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":"NetSys:master","ref":"master","sha":"d08c2fb2d0b5c823a53375a1b6246beefa995cb0","user":{"login":"NetSys","id":3665805,"avatar_url":"https://avatars.githubusercontent.com/u/3665805?v=3","gravatar_id":"","url":"https://api.github.com/users/NetSys","html_url":"https://github.com/NetSys","followers_url":"https://api.github.com/users/NetSys/followers","following_url":"https://api.github.com/users/NetSys/following{/other_user}","gists_url":"https://api.github.com/users/NetSys/gists{/gist_id}","starred_url":"https://api.github.com/users/NetSys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NetSys/subscriptions","organizations_url":"https://api.github.com/users/NetSys/orgs","repos_url":"https://api.github.com/users/NetSys/repos","events_url":"https://api.github.com/users/NetSys/events{/privacy}","received_events_url":"https://api.github.com/users/NetSys/received_events","type":"Organization","site_admin":false},"repo":{"id":43390663,"name":"quilt","full_name":"NetSys/quilt","owner":{"login":"NetSys","id":3665805,"avatar_url":"https://avatars.githubusercontent.com/u/3665805?v=3","gravatar_id":"","url":"https://api.github.com/users/NetSys","html_url":"https://github.com/NetSys","followers_url":"https://api.github.com/users/NetSys/followers","following_url":"https://api.github.com/users/NetSys/following{/other_user}","gists_url":"https://api.github.com/users/NetSys/gists{/gist_id}","starred_url":"https://api.github.com/users/NetSys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NetSys/subscriptions","organizations_url":"https://api.github.com/users/NetSys/orgs","repos_url":"https://api.github.com/users/NetSys/repos","events_url":"https://api.github.com/users/NetSys/events{/privacy}","received_events_url":"https://api.github.com/users/NetSys/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NetSys/quilt","description":"Quilt","fork":false,"url":"https://api.github.com/repos/NetSys/quilt","forks_url":"https://api.github.com/repos/NetSys/quilt/forks","keys_url":"https://api.github.com/repos/NetSys/quilt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NetSys/quilt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NetSys/quilt/teams","hooks_url":"https://api.github.com/repos/NetSys/quilt/hooks","issue_events_url":"https://api.github.com/repos/NetSys/quilt/issues/events{/number}","events_url":"https://api.github.com/repos/NetSys/quilt/events","assignees_url":"https://api.github.com/repos/NetSys/quilt/assignees{/user}","branches_url":"https://api.github.com/repos/NetSys/quilt/branches{/branch}","tags_url":"https://api.github.com/repos/NetSys/quilt/tags","blobs_url":"https://api.github.com/repos/NetSys/quilt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NetSys/quilt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NetSys/quilt/git/refs{/sha}","trees_url":"https://api.github.com/repos/NetSys/quilt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NetSys/quilt/statuses/{sha}","languages_url":"https://api.github.com/repos/NetSys/quilt/languages","stargazers_url":"https://api.github.com/repos/NetSys/quilt/stargazers","contributors_url":"https://api.github.com/repos/NetSys/quilt/contributors","subscribers_url":"https://api.github.com/repos/NetSys/quilt/subscribers","subscription_url":"https://api.github.com/repos/NetSys/quilt/subscription","commits_url":"https://api.github.com/repos/NetSys/quilt/commits{/sha}","git_commits_url":"https://api.github.com/repos/NetSys/quilt/git/commits{/sha}","comments_url":"https://api.github.com/repos/NetSys/quilt/comments{/number}","issue_comment_url":"https://api.github.com/repos/NetSys/quilt/issues/comments{/number}","contents_url":"https://api.github.com/repos/NetSys/quilt/contents/{+path}","compare_url":"https://api.github.com/repos/NetSys/quilt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NetSys/quilt/merges","archive_url":"https://api.github.com/repos/NetSys/quilt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NetSys/quilt/downloads","issues_url":"https://api.github.com/repos/NetSys/quilt/issues{/number}","pulls_url":"https://api.github.com/repos/NetSys/quilt/pulls{/number}","milestones_url":"https://api.github.com/repos/NetSys/quilt/milestones{/number}","notifications_url":"https://api.github.com/repos/NetSys/quilt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NetSys/quilt/labels{/name}","releases_url":"https://api.github.com/repos/NetSys/quilt/releases{/id}","deployments_url":"https://api.github.com/repos/NetSys/quilt/deployments","created_at":"2015-09-29T19:52:32Z","updated_at":"2016-12-16T03:05:03Z","pushed_at":"2016-12-22T02:07:35Z","git_url":"git://github.com/NetSys/quilt.git","ssh_url":"git@github.com:NetSys/quilt.git","clone_url":"https://github.com/NetSys/quilt.git","svn_url":"https://github.com/NetSys/quilt","homepage":"","size":17460,"stargazers_count":63,"watchers_count":63,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":6,"forks":20,"open_issues":6,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/587"},"html":{"href":"https://github.com/NetSys/quilt/pull/587"},"issue":{"href":"https://api.github.com/repos/NetSys/quilt/issues/587"},"comments":{"href":"https://api.github.com/repos/NetSys/quilt/issues/587/comments"},"review_comments":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/587/comments"},"review_comment":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/587/commits"},"statuses":{"href":"https://api.github.com/repos/NetSys/quilt/statuses/954a963871b74ff47bc436529c66b4bb0ba8c321"}}}}
{"actor":{"display_login":"LuiseV"}}