Merge pull request #55 from hongchaodeng/master
implement cluster creation
This commit is contained in:
Коммит
05ef6596ca
10
cluster.go
10
cluster.go
|
@ -113,20 +113,12 @@ func (c *Cluster) create(spec *Spec) {
|
||||||
members := MemberSet{}
|
members := MemberSet{}
|
||||||
c.spec = spec
|
c.spec = spec
|
||||||
// we want to make use of member's utility methods.
|
// we want to make use of member's utility methods.
|
||||||
for i := 0; i < c.spec.Size; i++ {
|
etcdName := fmt.Sprintf("%s-%04d", c.name, 0)
|
||||||
etcdName := fmt.Sprintf("%s-%04d", c.name, i)
|
|
||||||
members.Add(&Member{Name: etcdName})
|
members.Add(&Member{Name: etcdName})
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: parallelize it
|
|
||||||
for i := 0; i < c.spec.Size; i++ {
|
|
||||||
etcdName := fmt.Sprintf("%s-%04d", c.name, i)
|
|
||||||
if err := c.createPodAndService(members, members[etcdName], "new"); err != nil {
|
if err := c.createPodAndService(members, members[etcdName], "new"); err != nil {
|
||||||
panic(fmt.Sprintf("(TODO: we need to clean up already created ones.)\nError: %v", err))
|
panic(fmt.Sprintf("(TODO: we need to clean up already created ones.)\nError: %v", err))
|
||||||
}
|
}
|
||||||
c.idCounter++
|
c.idCounter++
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println("created cluster:", members)
|
fmt.Println("created cluster:", members)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче