-
Notifications
You must be signed in to change notification settings - Fork 3
/
commands.go
105 lines (103 loc) · 2.51 KB
/
commands.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package cli
import "github.com/urfave/cli"
// List of commands available to the CLI end users.
var (
commands = []cli.Command{
{
Name: "join",
ShortName: "j",
Usage: "Join a caravela instance",
Category: "Caravela system management",
Before: printBanner,
Action: join,
Flags: []cli.Flag{
cli.StringFlag{
Name: "hostIP, hip",
Usage: "Host's IP address",
Value: defaultHostIP,
},
},
},
{
Name: "create",
ShortName: "c",
Usage: "Create a caravela instance",
Category: "Caravela system management",
Before: printBanner,
Action: create,
Flags: []cli.Flag{
cli.StringFlag{
Name: "hostIP, hip",
Usage: "Host's IP address",
Value: defaultHostIP,
},
cli.StringFlag{
Name: "config, c",
Usage: "Configuration's file path",
Value: defaultConfigurationFile,
},
},
},
{
Name: "run",
ShortName: "r",
Usage: "Launch a container in the Caravela instance",
Category: "User's containers management",
Action: runContainers,
Flags: []cli.Flag{
cli.StringFlag{
Name: "name, n",
Usage: "Name for the container",
Value: defaultContainerName,
},
cli.StringSliceFlag{
Name: "portMap, p",
Usage: "Define a port mapping for a container, HostPort:ContainerPort",
Value: &cli.StringSlice{}, // No predefined port mapping
},
cli.StringFlag{
Name: "cpuPower, cp",
Usage: "Power/Class of the CPU necessary for the container",
Value: defaultCPUPower,
},
cli.UintFlag{
Name: "cpus, c",
Usage: "Maximum number of CPUs/Cores that the container need",
Value: defaultCPUs,
},
cli.UintFlag{
Name: "ram, r",
Usage: "Maximum amount of RAM (in Megabytes) that container can use",
Value: defaultRAM,
},
},
},
{
Name: "container",
Aliases: []string{"c"},
Usage: "Options for managing user's containers",
Category: "User's containers management",
Before: printBanner,
Subcommands: []cli.Command{
{
Name: "ps",
Usage: "List the user's containers in the system",
Action: listContainer,
},
{
Name: "stop",
Usage: "Stop a set of containers",
Action: stopContainers,
},
},
},
{
Name: "exit",
ShortName: "e",
Usage: "Shutdown from the CARAVELA instance, makes the node leave",
Category: "Caravela system management",
Before: printBanner,
Action: exitFromCaravela,
},
}
)