{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/etcd-operator/pulls/comments/94173901","pull_request_review_id":14705022,"id":94173901,"diff_hunk":"@@ -82,63 +87,76 @@ type Cluster struct {\n \tbackupDir string\n }\n \n-func New(c Config, e *spec.EtcdCluster, stopC <-chan struct{}, wg *sync.WaitGroup) (*Cluster, error) {\n-\treturn new(c, e, stopC, wg, true)\n-}\n-\n-func Restore(c Config, e *spec.EtcdCluster, stopC <-chan struct{}, wg *sync.WaitGroup) (*Cluster, error) {\n-\treturn new(c, e, stopC, wg, false)\n-}\n-\n-func new(config Config, e *spec.EtcdCluster, stopC <-chan struct{}, wg *sync.WaitGroup, isNewCluster bool) (*Cluster, error) {\n-\terr := e.Spec.Validate()\n-\tif err != nil {\n-\t\treturn nil, fmt.Errorf(\"invalid cluster spec: %v\", err)\n-\t}\n-\n+func New(config Config, e *spec.EtcdCluster, stopC <-chan struct{}, wg *sync.WaitGroup) *Cluster {\n \tlg := logrus.WithField(\"pkg\", \"cluster\").WithField(\"cluster-name\", e.Name)\n-\tvar bm *backupManager\n-\n-\tif b := e.Spec.Backup; b != nil && b.MaxBackups > 0 {\n-\t\tbm, err = newBackupManager(config, e, lg, isNewCluster)\n-\t\tif err != nil {\n-\t\t\treturn nil, err\n-\t\t}\n-\t}\n \tc := &Cluster{\n \t\tlogger:  lg,\n \t\tconfig:  config,\n \t\tcluster: e,\n \t\teventCh: make(chan *clusterEvent, 100),\n \t\tstopCh:  make(chan struct{}),\n \t\tstatus:  &spec.ClusterStatus{},\n-\t\tbm:      bm,\n+\t}\n+\terr := c.setup(wg)\n+\tif err != nil {\n+\t\tc.logger.Errorf(\"fail to setup: %v\", err)\n+\t\tif err != errClusterAlreadyFailed {\n+\t\t\tc.status.SetReason(err.Error())","path":"pkg/cluster/cluster.go","position":60,"original_position":60,"commit_id":"8b9220cc59a39e6b3efda9950dacfa2061cc7091","original_commit_id":"8b9220cc59a39e6b3efda9950dacfa2061cc7091","user":{"login":"xiang90","id":4479947,"avatar_url":"https://avatars.githubusercontent.com/u/4479947?v=3","gravatar_id":"","url":"https://api.github.com/users/xiang90","html_url":"https://github.com/xiang90","followers_url":"https://api.github.com/users/xiang90/followers","following_url":"https://api.github.com/users/xiang90/following{/other_user}","gists_url":"https://api.github.com/users/xiang90/gists{/gist_id}","starred_url":"https://api.github.com/users/xiang90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiang90/subscriptions","organizations_url":"https://api.github.com/users/xiang90/orgs","repos_url":"https://api.github.com/users/xiang90/repos","events_url":"https://api.github.com/users/xiang90/events{/privacy}","received_events_url":"https://api.github.com/users/xiang90/received_events","type":"User","site_admin":false},"body":"i misread it. sorry.","created_at":"2016-12-29T19:54:45Z","updated_at":"2016-12-29T19:54:45Z","html_url":"https://github.com/coreos/etcd-operator/pull/553#discussion_r94173901","pull_request_url":"https://api.github.com/repos/coreos/etcd-operator/pulls/553","_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd-operator/pulls/comments/94173901"},"html":{"href":"https://github.com/coreos/etcd-operator/pull/553#discussion_r94173901"},"pull_request":{"href":"https://api.github.com/repos/coreos/etcd-operator/pulls/553"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/etcd-operator/pulls/553","id":99690430,"html_url":"https://github.com/coreos/etcd-operator/pull/553","diff_url":"https://github.com/coreos/etcd-operator/pull/553.diff","patch_url":"https://github.com/coreos/etcd-operator/pull/553.patch","issue_url":"https://api.github.com/repos/coreos/etcd-operator/issues/553","number":553,"state":"open","locked":false,"title":"cluster: use status phase to detect new cluster","user":{"login":"hongchaodeng","id":920884,"avatar_url":"https://avatars.githubusercontent.com/u/920884?v=3","gravatar_id":"","url":"https://api.github.com/users/hongchaodeng","html_url":"https://github.com/hongchaodeng","followers_url":"https://api.github.com/users/hongchaodeng/followers","following_url":"https://api.github.com/users/hongchaodeng/following{/other_user}","gists_url":"https://api.github.com/users/hongchaodeng/gists{/gist_id}","starred_url":"https://api.github.com/users/hongchaodeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hongchaodeng/subscriptions","organizations_url":"https://api.github.com/users/hongchaodeng/orgs","repos_url":"https://api.github.com/users/hongchaodeng/repos","events_url":"https://api.github.com/users/hongchaodeng/events{/privacy}","received_events_url":"https://api.github.com/users/hongchaodeng/received_events","type":"User","site_admin":false},"body":"Previously, controller list TPR could potentially restore a cluster\nthat was created fresh.\n\nPreviously, we also didn’t do failed status reporting on failure to new\nand didn’t set running status immediately.\n\nThis change is gonna use status phase as cluster states. This handles\ndifferent cases more precisely. We also set running status immediately\ninstead of delaying 5s.","created_at":"2016-12-29T19:31:23Z","updated_at":"2016-12-29T19:54:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6d51e4a55056bbec931d6277f44ca7d6340a945f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/etcd-operator/pulls/553/commits","review_comments_url":"https://api.github.com/repos/coreos/etcd-operator/pulls/553/comments","review_comment_url":"https://api.github.com/repos/coreos/etcd-operator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/etcd-operator/issues/553/comments","statuses_url":"https://api.github.com/repos/coreos/etcd-operator/statuses/8b9220cc59a39e6b3efda9950dacfa2061cc7091","head":{"label":"hongchaodeng:r","ref":"r","sha":"8b9220cc59a39e6b3efda9950dacfa2061cc7091","user":{"login":"hongchaodeng","id":920884,"avatar_url":"https://avatars.githubusercontent.com/u/920884?v=3","gravatar_id":"","url":"https://api.github.com/users/hongchaodeng","html_url":"https://github.com/hongchaodeng","followers_url":"https://api.github.com/users/hongchaodeng/followers","following_url":"https://api.github.com/users/hongchaodeng/following{/other_user}","gists_url":"https://api.github.com/users/hongchaodeng/gists{/gist_id}","starred_url":"https://api.github.com/users/hongchaodeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hongchaodeng/subscriptions","organizations_url":"https://api.github.com/users/hongchaodeng/orgs","repos_url":"https://api.github.com/users/hongchaodeng/repos","events_url":"https://api.github.com/users/hongchaodeng/events{/privacy}","received_events_url":"https://api.github.com/users/hongchaodeng/received_events","type":"User","site_admin":false},"repo":{"id":72786503,"name":"etcd-operator","full_name":"hongchaodeng/etcd-operator","owner":{"login":"hongchaodeng","id":920884,"avatar_url":"https://avatars.githubusercontent.com/u/920884?v=3","gravatar_id":"","url":"https://api.github.com/users/hongchaodeng","html_url":"https://github.com/hongchaodeng","followers_url":"https://api.github.com/users/hongchaodeng/followers","following_url":"https://api.github.com/users/hongchaodeng/following{/other_user}","gists_url":"https://api.github.com/users/hongchaodeng/gists{/gist_id}","starred_url":"https://api.github.com/users/hongchaodeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hongchaodeng/subscriptions","organizations_url":"https://api.github.com/users/hongchaodeng/orgs","repos_url":"https://api.github.com/users/hongchaodeng/repos","events_url":"https://api.github.com/users/hongchaodeng/events{/privacy}","received_events_url":"https://api.github.com/users/hongchaodeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hongchaodeng/etcd-operator","description":"etcd Operator creates/configures/manages etcd clusters atop Kubernetes","fork":true,"url":"https://api.github.com/repos/hongchaodeng/etcd-operator","forks_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/forks","keys_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/teams","hooks_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/hooks","issue_events_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/issues/events{/number}","events_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/events","assignees_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/assignees{/user}","branches_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/branches{/branch}","tags_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/tags","blobs_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/git/refs{/sha}","trees_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/statuses/{sha}","languages_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/languages","stargazers_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/stargazers","contributors_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/contributors","subscribers_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/subscribers","subscription_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/subscription","commits_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/commits{/sha}","git_commits_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/git/commits{/sha}","comments_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/comments{/number}","issue_comment_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/issues/comments{/number}","contents_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/contents/{+path}","compare_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/merges","archive_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/downloads","issues_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/issues{/number}","pulls_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/pulls{/number}","milestones_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/milestones{/number}","notifications_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/labels{/name}","releases_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/releases{/id}","deployments_url":"https://api.github.com/repos/hongchaodeng/etcd-operator/deployments","created_at":"2016-11-03T21:01:55Z","updated_at":"2016-11-03T21:01:56Z","pushed_at":"2016-12-29T19:37:38Z","git_url":"git://github.com/hongchaodeng/etcd-operator.git","ssh_url":"git@github.com:hongchaodeng/etcd-operator.git","clone_url":"https://github.com/hongchaodeng/etcd-operator.git","svn_url":"https://github.com/hongchaodeng/etcd-operator","homepage":"https://coreos.com/blog/introducing-the-etcd-operator.html","size":1159,"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":"coreos:master","ref":"master","sha":"8a6c66bdd1ca6ea4f122d5def32286dabfcf73c3","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":64974719,"name":"etcd-operator","full_name":"coreos/etcd-operator","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/etcd-operator","description":"etcd Operator creates/configures/manages etcd clusters atop Kubernetes","fork":false,"url":"https://api.github.com/repos/coreos/etcd-operator","forks_url":"https://api.github.com/repos/coreos/etcd-operator/forks","keys_url":"https://api.github.com/repos/coreos/etcd-operator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/etcd-operator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/etcd-operator/teams","hooks_url":"https://api.github.com/repos/coreos/etcd-operator/hooks","issue_events_url":"https://api.github.com/repos/coreos/etcd-operator/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/etcd-operator/events","assignees_url":"https://api.github.com/repos/coreos/etcd-operator/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/etcd-operator/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/etcd-operator/tags","blobs_url":"https://api.github.com/repos/coreos/etcd-operator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/etcd-operator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/etcd-operator/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/etcd-operator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/etcd-operator/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/etcd-operator/languages","stargazers_url":"https://api.github.com/repos/coreos/etcd-operator/stargazers","contributors_url":"https://api.github.com/repos/coreos/etcd-operator/contributors","subscribers_url":"https://api.github.com/repos/coreos/etcd-operator/subscribers","subscription_url":"https://api.github.com/repos/coreos/etcd-operator/subscription","commits_url":"https://api.github.com/repos/coreos/etcd-operator/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/etcd-operator/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/etcd-operator/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/etcd-operator/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/etcd-operator/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/etcd-operator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/etcd-operator/merges","archive_url":"https://api.github.com/repos/coreos/etcd-operator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/etcd-operator/downloads","issues_url":"https://api.github.com/repos/coreos/etcd-operator/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/etcd-operator/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/etcd-operator/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/etcd-operator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/etcd-operator/labels{/name}","releases_url":"https://api.github.com/repos/coreos/etcd-operator/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/etcd-operator/deployments","created_at":"2016-08-04T23:54:58Z","updated_at":"2016-12-28T02:29:25Z","pushed_at":"2016-12-29T19:37:39Z","git_url":"git://github.com/coreos/etcd-operator.git","ssh_url":"git@github.com:coreos/etcd-operator.git","clone_url":"https://github.com/coreos/etcd-operator.git","svn_url":"https://github.com/coreos/etcd-operator","homepage":"https://coreos.com/blog/introducing-the-etcd-operator.html","size":1169,"stargazers_count":154,"watchers_count":154,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":27,"forks":20,"open_issues":27,"watchers":154,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd-operator/pulls/553"},"html":{"href":"https://github.com/coreos/etcd-operator/pull/553"},"issue":{"href":"https://api.github.com/repos/coreos/etcd-operator/issues/553"},"comments":{"href":"https://api.github.com/repos/coreos/etcd-operator/issues/553/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/etcd-operator/pulls/553/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/etcd-operator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/etcd-operator/pulls/553/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/etcd-operator/statuses/8b9220cc59a39e6b3efda9950dacfa2061cc7091"}}}}
{"actor":{"display_login":"xiang90"}}