forked from docker-archive/classicswarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags.go
163 lines (153 loc) · 4.21 KB
/
flags.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
package cli
import (
"os"
"path/filepath"
"runtime"
"strings"
"github.com/docker/swarm/scheduler/filter"
"github.com/docker/swarm/scheduler/strategy"
"github.com/urfave/cli"
)
func homepath(p string) string {
home := os.Getenv("HOME")
if runtime.GOOS == "windows" {
home = os.Getenv("USERPROFILE")
}
return filepath.Join(home, p)
}
func getDiscovery(c *cli.Context) string {
if len(c.Args()) == 1 {
return c.Args()[0]
}
return os.Getenv("SWARM_DISCOVERY")
}
var (
flJoinAdvertise = cli.StringFlag{
Name: "advertise, addr",
Usage: "Address of the Docker Engine joining the cluster. Swarm manager(s) MUST be able to reach the Docker Engine at this address.",
EnvVar: "SWARM_ADVERTISE",
}
flJoinRandomDelay = cli.StringFlag{
Name: "delay",
Value: "0s",
Usage: "add a random delay in [0s,delay] to avoid synchronized registration",
}
flManageAdvertise = cli.StringFlag{
Name: "advertise, addr",
Usage: "Address of the swarm manager joining the cluster. Other swarm manager(s) MUST be able to reach the swarm manager at this address.",
EnvVar: "SWARM_ADVERTISE",
}
// hack for go vet
flHostsValue = cli.StringSlice([]string{"tcp://127.0.0.1:2375"})
flHosts = cli.StringSliceFlag{
Name: "host, H",
Value: &flHostsValue,
Usage: "ip/socket to listen on",
EnvVar: "SWARM_HOST",
}
flHeartBeat = cli.StringFlag{
Name: "heartbeat",
Value: "60s",
Usage: "period between each heartbeat",
}
flTTL = cli.StringFlag{
Name: "ttl",
Value: "180s",
Usage: "set the expiration of an ephemeral node",
}
flTimeout = cli.StringFlag{
Name: "timeout",
Value: "10s",
Usage: "timeout period",
}
flRefreshIntervalMin = cli.StringFlag{
Name: "engine-refresh-min-interval",
Value: "30s",
Usage: "set engine refresh minimum interval",
}
flRefreshIntervalMax = cli.StringFlag{
Name: "engine-refresh-max-interval",
Value: "60s",
Usage: "set engine refresh maximum interval",
}
flRefreshRetry = cli.IntFlag{
Name: "engine-refresh-retry",
Value: 3,
Usage: "deprecated; replaced by --engine-failure-retry",
}
flFailureRetry = cli.IntFlag{
Name: "engine-failure-retry",
Value: 3,
Usage: "set engine failure retry count",
}
flEnableCors = cli.BoolFlag{
Name: "api-enable-cors, cors",
Usage: "enable CORS headers in the remote API",
}
flTLS = cli.BoolFlag{
Name: "tls",
Usage: "use TLS; implied by --tlsverify=true",
}
flTLSCaCert = cli.StringFlag{
Name: "tlscacert",
Usage: "trust only remotes providing a certificate signed by the CA given here",
}
flTLSCert = cli.StringFlag{
Name: "tlscert",
Usage: "path to TLS certificate file",
}
flTLSKey = cli.StringFlag{
Name: "tlskey",
Usage: "path to TLS key file",
}
flTLSVerify = cli.BoolFlag{
Name: "tlsverify",
Usage: "use TLS and verify the remote",
}
flStrategy = cli.StringFlag{
Name: "strategy",
Usage: "placement strategy to use [" + strings.Join(strategy.List(), ", ") + "]",
Value: strategy.List()[0],
}
// hack for go vet
flFilterValue = cli.StringSlice(filter.List())
// DefaultFilterNumber is exported
DefaultFilterNumber = len(flFilterValue)
flFilter = cli.StringSliceFlag{
Name: "filter, f",
Usage: "filter to use [" + strings.Join(filter.List(), ", ") + "]",
Value: &flFilterValue,
}
flCluster = cli.StringFlag{
Name: "cluster-driver, c",
Usage: "cluster driver to use [swarm, mesos-experimental]",
Value: "swarm",
}
flClusterOpt = cli.StringSliceFlag{
Name: "cluster-opt",
Usage: "cluster driver options",
Value: &cli.StringSlice{},
}
flDiscoveryOpt = cli.StringSliceFlag{
Name: "discovery-opt",
Usage: "discovery options",
Value: &cli.StringSlice{},
}
flLeaderElection = cli.BoolFlag{
Name: "replication",
Usage: "Enable Swarm manager replication",
}
flLeaderTTL = cli.StringFlag{
Name: "replication-ttl",
Value: "20s",
Usage: "Leader lock release time on failure",
}
flRefreshOnNodeFilter = cli.BoolFlag{
Name: "refresh-on-node-filter",
Usage: "If true, refresh the cache when a ContainerList call comes in with a node filter",
}
flContainerNameRefreshFilter = cli.StringFlag{
Name: "container-name-refresh-filter",
Usage: "If set, refresh the cache when a ContainerList call comes in with a name filter set to this value",
}
)