{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/29110695","id":29110695,"diff_hunk":"@@ -557,11 +558,78 @@ func (kl *Kubelet) Run(updates <-chan PodUpdate) {\n \tkl.syncLoop(updates, kl)\n }\n \n+func (kl *Kubelet) initialNodeStatus() (*api.Node, error) {\n+\tnode := &api.Node{\n+\t\tObjectMeta: api.ObjectMeta{Name: kl.hostname},\n+\t\tStatus: api.NodeStatus{\n+\t\t\tCapacity: api.ResourceList{\n+\t\t\t\tapi.ResourceCPU:    *resource.NewMilliQuantity(1000, resource.DecimalSI),\n+\t\t\t\tapi.ResourceMemory: resource.MustParse(\"3Gi\"),\n+\t\t\t},\n+\t\t},\n+\t}\n+\tif kl.cloud != nil {\n+\t\tinstances, ok := kl.cloud.Instances()\n+\t\tif !ok {\n+\t\t\treturn nil, fmt.Errorf(\"failed to get instances from cloud provider\")\n+\t\t}\n+\t\t// TODO(roberthbailey): Inspect the local machine rather than calling out\n+\t\t// to the cloud provider.\n+\t\tresources, err := instances.GetNodeResources(kl.hostname)\n+\t\tif err != nil {\n+\t\t\treturn nil, fmt.Errorf(\"failed to get node resources from cloud provider: %v\", err)\n+\t\t}\n+\t\tif resources != nil {\n+\t\t\tnode.Status.Capacity = resources.Capacity\n+\t\t}\n+\t\tinstanceID, err := instances.ExternalID(kl.hostname)\n+\t\tif err != nil {\n+\t\t\treturn nil, fmt.Errorf(\"failed to get instance ID from cloud provider: %v\", err)\n+\t\t}\n+\t\tnode.Spec.ExternalID = instanceID\n+\t\tnodeAddresses, err := instances.NodeAddresses(kl.hostname)\n+\t\tif err != nil {\n+\t\t\treturn nil, fmt.Errorf(\"failed to get node address from cloud provider: %v\", err)\n+\t\t}\n+\t\tnode.Status.Addresses = nodeAddresses\n+\t}\n+\treturn node, nil\n+}\n+\n+// registerNode registers the node with the cluster master.\n+func (kl *Kubelet) registerNode() error {\n+\tstep := 100 * time.Millisecond\n+\tfor start := time.Now(); time.Since(start) < 30*time.Minute; time.Sleep(step) {\n+\t\tstep = step * 2\n+\t\tif step >= 7*time.Second {\n+\t\t\tstep = 7 * time.Second\n+\t\t}\n+\n+\t\tnode, err := kl.initialNodeStatus()\n+\t\tif err != nil {\n+\t\t\tglog.Errorf(\"Unable to construct api.Node object for kubelet: %v\", err)\n+\t\t\tcontinue\n+\t\t}\n+\t\tglog.V(2).Infof(\"Attempting to register node %s\", node.Name)\n+\t\tif _, err := kl.kubeClient.Nodes().Create(node); err != nil {","path":"pkg/kubelet/kubelet.go","position":64,"original_position":65,"commit_id":"09689d2c27f3e9889d3b340e6faa331caabefbf6","original_commit_id":"75c6d7abd56866bafc05d4b1cb96a97402787bed","user":{"login":"roberthbailey","id":7751204,"avatar_url":"https://avatars.githubusercontent.com/u/7751204?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthbailey","html_url":"https://github.com/roberthbailey","followers_url":"https://api.github.com/users/roberthbailey/followers","following_url":"https://api.github.com/users/roberthbailey/following{/other_user}","gists_url":"https://api.github.com/users/roberthbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthbailey/subscriptions","organizations_url":"https://api.github.com/users/roberthbailey/orgs","repos_url":"https://api.github.com/users/roberthbailey/repos","events_url":"https://api.github.com/users/roberthbailey/events{/privacy}","received_events_url":"https://api.github.com/users/roberthbailey/received_events","type":"User","site_admin":false},"body":"This now handles previously registered nodes. I did a reboot test and verified that the node switches from Ready -> NotReady -> Ready. ","created_at":"2015-04-26T15:09:15Z","updated_at":"2015-04-26T15:09:15Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6949#discussion_r29110695","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6949","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/29110695"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6949#discussion_r29110695"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6949"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6949","id":33507891,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6949","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6949.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6949.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6949","number":6949,"state":"open","locked":false,"title":"Modify nodes to register directly with the master.","user":{"login":"roberthbailey","id":7751204,"avatar_url":"https://avatars.githubusercontent.com/u/7751204?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthbailey","html_url":"https://github.com/roberthbailey","followers_url":"https://api.github.com/users/roberthbailey/followers","following_url":"https://api.github.com/users/roberthbailey/following{/other_user}","gists_url":"https://api.github.com/users/roberthbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthbailey/subscriptions","organizations_url":"https://api.github.com/users/roberthbailey/orgs","repos_url":"https://api.github.com/users/roberthbailey/repos","events_url":"https://api.github.com/users/roberthbailey/events{/privacy}","received_events_url":"https://api.github.com/users/roberthbailey/received_events","type":"User","site_admin":false},"body":"Fixes #6087. ","created_at":"2015-04-17T01:28:31Z","updated_at":"2015-04-26T15:09:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68092f526acae67c6a4bf183e3a1853b45e7f3c8","assignee":{"login":"erictune","id":8105590,"avatar_url":"https://avatars.githubusercontent.com/u/8105590?v=3","gravatar_id":"","url":"https://api.github.com/users/erictune","html_url":"https://github.com/erictune","followers_url":"https://api.github.com/users/erictune/followers","following_url":"https://api.github.com/users/erictune/following{/other_user}","gists_url":"https://api.github.com/users/erictune/gists{/gist_id}","starred_url":"https://api.github.com/users/erictune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erictune/subscriptions","organizations_url":"https://api.github.com/users/erictune/orgs","repos_url":"https://api.github.com/users/erictune/repos","events_url":"https://api.github.com/users/erictune/events{/privacy}","received_events_url":"https://api.github.com/users/erictune/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6949/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6949/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6949/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/09689d2c27f3e9889d3b340e6faa331caabefbf6","head":{"label":"roberthbailey:node-register","ref":"node-register","sha":"09689d2c27f3e9889d3b340e6faa331caabefbf6","user":{"login":"roberthbailey","id":7751204,"avatar_url":"https://avatars.githubusercontent.com/u/7751204?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthbailey","html_url":"https://github.com/roberthbailey","followers_url":"https://api.github.com/users/roberthbailey/followers","following_url":"https://api.github.com/users/roberthbailey/following{/other_user}","gists_url":"https://api.github.com/users/roberthbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthbailey/subscriptions","organizations_url":"https://api.github.com/users/roberthbailey/orgs","repos_url":"https://api.github.com/users/roberthbailey/repos","events_url":"https://api.github.com/users/roberthbailey/events{/privacy}","received_events_url":"https://api.github.com/users/roberthbailey/received_events","type":"User","site_admin":false},"repo":{"id":21398175,"name":"kubernetes","full_name":"roberthbailey/kubernetes","owner":{"login":"roberthbailey","id":7751204,"avatar_url":"https://avatars.githubusercontent.com/u/7751204?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthbailey","html_url":"https://github.com/roberthbailey","followers_url":"https://api.github.com/users/roberthbailey/followers","following_url":"https://api.github.com/users/roberthbailey/following{/other_user}","gists_url":"https://api.github.com/users/roberthbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthbailey/subscriptions","organizations_url":"https://api.github.com/users/roberthbailey/orgs","repos_url":"https://api.github.com/users/roberthbailey/repos","events_url":"https://api.github.com/users/roberthbailey/events{/privacy}","received_events_url":"https://api.github.com/users/roberthbailey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/roberthbailey/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/roberthbailey/kubernetes","forks_url":"https://api.github.com/repos/roberthbailey/kubernetes/forks","keys_url":"https://api.github.com/repos/roberthbailey/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/roberthbailey/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/roberthbailey/kubernetes/teams","hooks_url":"https://api.github.com/repos/roberthbailey/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/roberthbailey/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/roberthbailey/kubernetes/events","assignees_url":"https://api.github.com/repos/roberthbailey/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/roberthbailey/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/roberthbailey/kubernetes/tags","blobs_url":"https://api.github.com/repos/roberthbailey/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/roberthbailey/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/roberthbailey/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/roberthbailey/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/roberthbailey/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/roberthbailey/kubernetes/languages","stargazers_url":"https://api.github.com/repos/roberthbailey/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/roberthbailey/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/roberthbailey/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/roberthbailey/kubernetes/subscription","commits_url":"https://api.github.com/repos/roberthbailey/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/roberthbailey/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/roberthbailey/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/roberthbailey/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/roberthbailey/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/roberthbailey/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/roberthbailey/kubernetes/merges","archive_url":"https://api.github.com/repos/roberthbailey/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/roberthbailey/kubernetes/downloads","issues_url":"https://api.github.com/repos/roberthbailey/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/roberthbailey/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/roberthbailey/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/roberthbailey/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/roberthbailey/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/roberthbailey/kubernetes/releases{/id}","created_at":"2014-07-01T18:28:50Z","updated_at":"2015-04-25T05:18:23Z","pushed_at":"2015-04-26T14:54:12Z","git_url":"git://github.com/roberthbailey/kubernetes.git","ssh_url":"git@github.com:roberthbailey/kubernetes.git","clone_url":"https://github.com/roberthbailey/kubernetes.git","svn_url":"https://github.com/roberthbailey/kubernetes","homepage":null,"size":47406,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"GoogleCloudPlatform:master","ref":"master","sha":"e061043cf1961c2732aa8edc659102784dc6e5a0","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"GoogleCloudPlatform/kubernetes","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-04-26T10:47:41Z","pushed_at":"2015-04-26T14:54:14Z","git_url":"git://github.com/GoogleCloudPlatform/kubernetes.git","ssh_url":"git@github.com:GoogleCloudPlatform/kubernetes.git","clone_url":"https://github.com/GoogleCloudPlatform/kubernetes.git","svn_url":"https://github.com/GoogleCloudPlatform/kubernetes","homepage":"http://kubernetes.io","size":206931,"stargazers_count":7353,"watchers_count":7353,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1469,"mirror_url":null,"open_issues_count":942,"forks":1469,"open_issues":942,"watchers":7353,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6949"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6949"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6949"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6949/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6949/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6949/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/09689d2c27f3e9889d3b340e6faa331caabefbf6"}}}}