forked from coreos/fleet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster.go
37 lines (31 loc) · 907 Bytes
/
cluster.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package platform
import (
"strconv"
"github.com/coreos/fleet/functional/util"
)
type Cluster interface {
CreateMember(string, MachineConfig) error
DestroyMember(string) error
Members() []string
MemberCommand(string, ...string) (string, error)
Destroy() error
// client operations
Fleetctl(args ...string) (string, string, error)
FleetctlWithInput(input string, args ...string) (string, string, error)
WaitForNActiveUnits(count int) (map[string]util.UnitState, error)
WaitForNMachines(count int) ([]string, error)
}
// MachineConfig defines the parameters that should
// be considered when creating a new cluster member.
type MachineConfig struct {
VerifyUnits bool
}
func CreateNClusterMembers(cl Cluster, count int, cfg MachineConfig) error {
for i := 0; i < count; i++ {
name := strconv.Itoa(i)
if err := cl.CreateMember(name, cfg); err != nil {
return err
}
}
return nil
}