forked from rancher/convoy-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
80 lines (73 loc) · 1.91 KB
/
main.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
package main
import (
"os"
log "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/rancher/convoy-agent/storagepool"
"github.com/rancher/convoy-agent/volume"
"github.com/rancher/kubernetes-agent/healthcheck"
)
var (
GITCOMMIT = "HEAD"
port = 10241
)
func main() {
app := cli.NewApp()
app.Name = "convoy-agent"
app.Version = GITCOMMIT
app.Author = "Rancher Labs"
app.Usage = "An agent that acts as an interface between rancher storage and cattle server"
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "debug, d",
Usage: "enable debug logging level",
},
cli.StringFlag{
Name: "url",
Usage: "The URL endpoint to communicate with cattle server",
EnvVar: "CATTLE_URL",
},
cli.StringFlag{
Name: "access-key",
Usage: "The access key required to authenticate with cattle server",
EnvVar: "CATTLE_ACCESS_KEY",
},
cli.StringFlag{
Name: "secret-key",
Usage: "The secret key required to authenticate with cattle server",
EnvVar: "CATTLE_SECRET_KEY",
},
cli.IntFlag{
Name: "healthcheck-interval",
Value: 5000,
Usage: "set the frequency of performing healthchecks",
},
cli.StringFlag{
Name: "healthcheck-basedir",
Value: ".healthcheck",
Usage: "set the directory to write the healthcheck files into",
},
cli.StringFlag{
Name: "storagepool-rootdir",
Usage: "set the storage pool rootdir",
Value: ".root",
},
cli.StringFlag{
Name: "storagepool-driver",
Usage: "set the storage pool driver.",
},
cli.StringFlag{
Name: "socket, s",
Value: "/var/run/convoy/convoy.sock",
Usage: "specify unix domain socket for communicating with convoy server",
},
}
commands := append(volume.Commands, storagepool.Commands...)
app.Commands = commands
go func() {
err := healthcheck.StartHealthCheck(port)
log.Fatalf("Error while running healthcheck [%v]", err)
}()
app.EnableBashCompletion = true
app.Run(os.Args)
}