-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstorage.go
60 lines (53 loc) · 1.43 KB
/
storage.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
package main
import (
"fmt"
"os"
"github.com/projecteru2/resource-storage/cmd"
"github.com/projecteru2/resource-storage/cmd/calculate"
"github.com/projecteru2/resource-storage/cmd/metrics"
"github.com/projecteru2/resource-storage/cmd/node"
"github.com/projecteru2/resource-storage/cmd/storage"
"github.com/projecteru2/resource-storage/version"
"github.com/urfave/cli/v2"
)
func main() {
cli.VersionPrinter = func(c *cli.Context) {
fmt.Print(version.String())
}
app := cli.NewApp()
app.Name = version.NAME
app.Usage = "Run eru resource storage plugin"
app.Version = version.VERSION
app.Commands = []*cli.Command{
storage.Name(),
metrics.Description(),
metrics.GetMetrics(),
node.AddNode(),
node.RemoveNode(),
node.GetNodesDeployCapacity(),
node.SetNodeResourceCapacity(),
node.GetNodeResourceInfo(),
node.SetNodeResourceInfo(),
node.SetNodeResourceUsage(),
node.GetMostIdleNode(),
node.FixNodeResource(),
calculate.CalculateDeploy(),
calculate.CalculateRealloc(),
calculate.CalculateRemap(),
}
app.Flags = []cli.Flag{
&cli.StringFlag{
Name: "config",
Value: "storage.yaml",
Usage: "config file path for plugin, in yaml",
Destination: &cmd.ConfigPath,
EnvVars: []string{"ERU_RESOURCE_CONFIG_PATH"},
},
&cli.BoolFlag{
Name: "embedded-storage",
Usage: "active embedded storage",
Destination: &cmd.EmbeddedStorage,
},
}
_ = app.Run(os.Args)
}