This repository has been archived by the owner on Jul 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
plugin.go
494 lines (438 loc) · 33.6 KB
/
plugin.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
package cloudfoundry
import (
"strings"
"github.com/enaml-ops/enaml"
"github.com/enaml-ops/omg-product-bundle/products/oss_cf/plugin/config"
"github.com/enaml-ops/pluginlib/cred"
"github.com/enaml-ops/pluginlib/pcli"
"github.com/enaml-ops/pluginlib/pluginutil"
"github.com/enaml-ops/pluginlib/productv1"
"github.com/xchapter7x/lo"
"gopkg.in/urfave/cli.v2"
)
func init() {
RegisterInstanceGrouperFactory(NewConsulPartition)
RegisterInstanceGrouperFactory(NewNatsPartition)
RegisterInstanceGrouperFactory(NewEtcdPartition)
RegisterInstanceGrouperFactory(NewDiegoDatabasePartition)
RegisterInstanceGrouperFactory(NewNFSPartition)
RegisterInstanceGrouperFactory(NewGoRouterPartition)
RegisterInstanceGrouperFactory(NewMySQLProxyPartition)
RegisterInstanceGrouperFactory(NewMySQLPartition)
RegisterInstanceGrouperFactory(NewCloudControllerPartition)
RegisterInstanceGrouperFactory(NewHaProxyPartition)
RegisterInstanceGrouperFactory(NewClockGlobalPartition)
RegisterInstanceGrouperFactory(NewCloudControllerWorkerPartition)
RegisterInstanceGrouperFactory(NewUAAPartition)
RegisterInstanceGrouperFactory(NewDiegoBrainPartition)
RegisterInstanceGrouperFactory(NewDiegoCellPartition)
RegisterInstanceGrouperFactory(NewDopplerPartition)
RegisterInstanceGrouperFactory(NewLoggregatorTrafficController)
//errands
RegisterInstanceGrouperFactory(NewSmokeErrand)
RegisterInstanceGrouperFactory(NewBootstrapPartition)
}
//GetFlags -
func (s *Plugin) GetFlags() (flags []pcli.Flag) {
return []pcli.Flag{
pcli.CreateStringFlag("cf-release-version", "version for cf bosh release", CFReleaseVersion),
pcli.CreateStringFlag("garden-release-version", "version for garden bosh release", GardenReleaseVersion),
pcli.CreateStringFlag("diego-release-version", "version for diego bosh release", DiegoReleaseVersion),
pcli.CreateStringFlag("etcd-release-version", "version for etcd bosh release", EtcdReleaseVersion),
pcli.CreateStringFlag("cf-mysql-release-version", "version for cf-mysql bosh release", CFMysqlReleaseVersion),
pcli.CreateStringFlag("cflinuxfs2-release-version", "version for cflinuxfs2 bosh release", CFLinuxReleaseVersion),
pcli.CreateStringFlag("cf-release-url", "url for cf bosh release", CFReleaseURI),
pcli.CreateStringFlag("garden-release-url", "url for garden bosh release", GardenReleaseURI),
pcli.CreateStringFlag("diego-release-url", "url for diego bosh release", DiegoReleaseURI),
pcli.CreateStringFlag("etcd-release-url", "url for etcd bosh release", EtcdReleaseURI),
pcli.CreateStringFlag("cf-mysql-release-url", "url for cf-mysql bosh release", CFMysqlReleaseURI),
pcli.CreateStringFlag("cflinuxfs2-release-url", "url for cflinuxfs2 bosh release", CFLinuxReleaseURI),
pcli.CreateStringFlag("cf-release-sha", "sha for cf bosh release", CFReleaseSHA),
pcli.CreateStringFlag("garden-release-sha", "sha for garden bosh release", GardenReleaseSHA),
pcli.CreateStringFlag("diego-release-sha", "sha for diego bosh release", DiegoReleaseSHA),
pcli.CreateStringFlag("etcd-release-sha", "sha for etcd bosh release", EtcdReleaseSHA),
pcli.CreateStringFlag("cf-mysql-release-sha", "sha for cf-mysql bosh release", CFMysqlReleaseSHA),
pcli.CreateStringFlag("cflinuxfs2-release-sha", "sha for cflinuxfs2 bosh release", CFLinuxReleaseSHA),
pcli.CreateStringFlag("deployment-name", "name for the deployment", DeploymentName),
pcli.CreateStringFlag("stemcell-version", "version of stemcell", s.GetMeta().Stemcell.Version),
// shared for all instance groups:
pcli.CreateBoolFlag("infer-from-cloud", "setting this flag will attempt to pull as many defaults from your targetted bosh's cloud config as it can (vmtype, network, disk, etc)."),
pcli.CreateStringFlag("stemcell-name", "the alias of your desired stemcell", s.GetMeta().Stemcell.Alias),
pcli.CreateStringSliceFlag("az", "list of AZ names to use"),
pcli.CreateStringFlag("network", "the name of the network to use"),
pcli.CreateStringFlag("system-domain", "System Domain"),
pcli.CreateStringSliceFlag("app-domain", "Applications Domains"),
pcli.CreateBoolFlag("allow-app-ssh-access", "Allow SSH access for CF applications"),
pcli.CreateStringSliceFlag("router-ip", "a list of the router ips you wish to use"),
pcli.CreateStringFlag("router-vm-type", "the name of your desired vm size"),
pcli.CreateStringFlag("router-ssl-cert", "the go router ssl cert, or a filename preceded by '@'"),
pcli.CreateStringFlag("router-ssl-key", "the go router ssl key, or a filename preceded by '@'"),
pcli.CreateStringFlag("router-user", "the username of the go-routers", "router_status"),
pcli.CreateStringFlag("router-pass", "the password of the go-routers"),
pcli.CreateBoolFlag("router-enable-ssl", "enable or disable ssl on your routers"),
pcli.CreateBoolTFlag("skip-haproxy", "this flag is on by default and it will skip installing haproxy"),
pcli.CreateStringSliceFlag("haproxy-ip", "a list of the haproxy ips you wish to use"),
pcli.CreateStringFlag("haproxy-vm-type", "the name of your desired vm size"),
pcli.CreateStringFlag("nats-vm-type", "the name of your desired vm size for NATS"),
pcli.CreateStringFlag("nats-user", "username for your nats pool", "nats"),
pcli.CreateStringFlag("nats-pass", "password for your nats pool", "nats-password"),
pcli.CreateIntFlag("nats-port", "the port for the NATS server to listen on", "4222"),
pcli.CreateStringSliceFlag("nats-machine-ip", "ip of a nats node vm"),
pcli.CreateStringSliceFlag("consul-ip", "a list of the consul ips you wish to use"),
pcli.CreateStringFlag("consul-vm-type", "the name of your desired vm size for consul"),
pcli.CreateStringSliceFlag("consul-encryption-key", "encryption key for consul"),
pcli.CreateStringFlag("consul-agent-cert", "agent cert for consul, or a filename preceded by '@'"),
pcli.CreateStringFlag("consul-agent-key", "agent key for consul, or a filename preceded by '@'"),
pcli.CreateStringFlag("consul-server-cert", "server cert for consul, or a filename preceded by '@'"),
pcli.CreateStringFlag("consul-server-key", "server key for consul, or a filename preceded by '@'"),
pcli.CreateStringFlag("syslog-address", "address of syslog server"),
pcli.CreateIntFlag("syslog-port", "port of syslog server", "514"),
pcli.CreateStringFlag("syslog-transport", "transport to syslog server", "tcp"),
pcli.CreateStringSliceFlag("etcd-machine-ip", "ip of a etcd node vm"),
pcli.CreateStringFlag("etcd-vm-type", "the name of your desired vm size for etcd"),
pcli.CreateStringFlag("etcd-disk-type", "the name of your desired persistent disk type for etcd"),
pcli.CreateStringFlag("nfs-ip", "a list of the nfs ips you wish to use"),
pcli.CreateStringFlag("nfs-vm-type", "the name of your desired vm size for nfs"),
pcli.CreateStringFlag("nfs-disk-type", "the name of your desired persistent disk type for nfs"),
pcli.CreateStringFlag("nfs-share-path", "NFS Share Path", "/var/vcap/store"),
pcli.CreateStringSliceFlag("nfs-allow-from-network-cidr", "the network cidr you wish to allow connections to nfs from"),
//Mysql Flags
pcli.CreateStringSliceFlag("mysql-ip", "a list of the mysql ips you wish to use"),
pcli.CreateStringFlag("mysql-vm-type", "the name of your desired vm size for mysql"),
pcli.CreateStringFlag("mysql-disk-type", "the name of your desired persistent disk type for mysql"),
pcli.CreateStringFlag("mysql-admin-password", "admin password for mysql"),
pcli.CreateStringFlag("mysql-bootstrap-username", "bootstrap username for mysql", "enamlmbu"),
pcli.CreateStringFlag("mysql-bootstrap-password", "bootstrap password for mysql"),
//MySQL proxy flags
pcli.CreateStringSliceFlag("mysql-proxy-ip", "a list of -mysql proxy ips you wish to use"),
pcli.CreateStringFlag("mysql-proxy-vm-type", "the name of your desired vm size for mysql proxy"),
pcli.CreateStringFlag("mysql-proxy-external-host", "Host name of MySQL proxy"),
pcli.CreateStringFlag("mysql-proxy-api-username", "Proxy API user name", "enamlmpa"),
pcli.CreateStringFlag("mysql-proxy-api-password", "Proxy API password"),
//CC Worker Partition Flags
pcli.CreateIntFlag("cc-worker-instances", "the number of vms for cc workers", "1"),
pcli.CreateStringFlag("cc-worker-vm-type", "the name of the desired vm type for cc worker"),
pcli.CreateStringFlag("cc-staging-upload-user", "user name for staging upload", "staging_upload_user"),
pcli.CreateStringFlag("cc-staging-upload-password", "password for staging upload"),
pcli.CreateStringFlag("cc-bulk-api-password", "password for bulk api calls"),
pcli.CreateStringFlag("cc-db-encryption-key", "Cloud Controller DB encryption key"),
pcli.CreateStringFlag("cc-internal-api-user", "user name for Internal API calls"),
pcli.CreateStringFlag("cc-internal-api-password", "password for Internal API calls"),
pcli.CreateIntFlag("cc-uploader-poll-interval", "CC uploader job polling interval, in seconds", "25"),
pcli.CreateStringFlag("cc-vm-type", "Cloud Controller VM Type"),
pcli.CreateIntFlag("cc-instances", "the number of vms for cc", "1"),
pcli.CreateStringFlag("host-key-fingerprint", "Host Key Fingerprint"),
pcli.CreateStringFlag("support-address", "Support URL", "https://support.pivotal.io"),
pcli.CreateStringFlag("min-cli-version", "Min CF CLI Version supported", "6.7.0"),
pcli.CreateStringFlag("db-uaa-username", "uaa db username", "enamluaa"),
pcli.CreateStringFlag("db-uaa-password", "uaa db password"),
pcli.CreateStringFlag("db-ccdb-username", "ccdb db username", "enamlccdb"),
pcli.CreateStringFlag("db-ccdb-password", "ccdb db password"),
pcli.CreateStringFlag("db-console-username", "console db username", "enamlconsole"),
pcli.CreateStringFlag("db-console-password", "console db password"),
pcli.CreateStringFlag("db-app_usage-password", "app usage db password"),
pcli.CreateStringFlag("db-autoscale-username", "autoscale db user", "enamlautoscale"),
pcli.CreateStringFlag("db-autoscale-password", "autoscale db password"),
pcli.CreateStringFlag("db-notifications-username", "notifications db user", "enamlnotifications"),
pcli.CreateStringFlag("db-notifications-password", "notifications db password"),
//Diego Database
pcli.CreateStringSliceFlag("diego-db-ip", "a list of static IPs for the diego database partitions"),
pcli.CreateStringFlag("diego-db-vm-type", "the name of the desired vm type for the diego db"),
pcli.CreateStringFlag("diego-db-disk-type", "the name of your desired persistent disk type for the diego db"),
pcli.CreateStringFlag("diego-db-passphrase", "the passphrase for your database"),
pcli.CreateStringFlag("bbs-server-cert", "BBS server SSL cert (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("bbs-server-key", "BBS server SSL key (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("etcd-server-key", "etcd server SSL key (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("etcd-server-cert", "etcd server cert (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("etcd-client-key", "etcd client SSL key (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("etcd-client-cert", "etcd client SSL cert (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("etcd-peer-key", "etcd peer SSL key (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("etcd-peer-cert", "etcd peer SSL cert (or a file containing it: file format `@filepath`)"),
// Diego Cell
pcli.CreateStringSliceFlag("diego-cell-ip", "a list of static IPs for the diego cell"),
pcli.CreateStringFlag("diego-cell-vm-type", "the name of the desired vm type for the diego cell"),
pcli.CreateStringFlag("diego-cell-disk-type", "the name of your desired persistent disk type for the diego cell"),
// Diego Brain
pcli.CreateStringSliceFlag("diego-brain-ip", "a list of static IPs for the diego brain"),
pcli.CreateStringFlag("diego-brain-vm-type", "the name of the desired vm type for the diego brain"),
pcli.CreateStringFlag("diego-brain-disk-type", "the name of your desired persistent disk type for the diego brain"),
pcli.CreateStringFlag("bbs-server-ca-cert", "BBS CA SSL cert (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("bbs-client-cert", "BBS client SSL cert (or a file containing it: file format `@filepath`)"),
pcli.CreateStringFlag("bbs-client-key", "BBS client SSL key (or a file containing it: file format `@filepath`)"),
pcli.CreateBoolTFlag("bbs-require-ssl", "enable SSL for all communications with the BBS"),
pcli.CreateBoolTFlag("skip-cert-verify", "ignore bad SSL certificates when connecting over HTTPS"),
pcli.CreateIntFlag("cc-external-port", "external port of the Cloud Controller API", "9022"),
pcli.CreateStringFlag("ssh-proxy-uaa-secret", "the OAuth client secret used to authenticate the SSH proxy"),
pcli.CreateIntFlag("loggregator-port", "port for loggregator", "443"),
pcli.CreateStringFlag("clock-global-vm-type", "the name of the desired vm type for the clock global partition"),
//Doppler
pcli.CreateStringSliceFlag("doppler-ip", "a list of the doppler ips you wish to use"),
pcli.CreateStringFlag("doppler-vm-type", "the name of your desired vm size for doppler"),
pcli.CreateStringFlag("doppler-zone", "the name zone for doppler"),
pcli.CreateIntFlag("doppler-drain-buffer-size", "message drain buffer size", "10000"),
pcli.CreateStringFlag("doppler-shared-secret", "doppler shared secret"),
//Loggregator Traffic Controller
pcli.CreateStringSliceFlag("loggregator-traffic-controller-ip", "a list of loggregator traffic controller IPs"),
pcli.CreateStringFlag("loggregator-traffic-controller-vmtype", "the name of your desired vm size for the loggregator traffic controller"),
//UAA
pcli.CreateStringFlag("uaa-vm-type", "the name of your desired vm size for uaa"),
pcli.CreateIntFlag("uaa-instances", "the number of your desired vms for uaa", "1"),
pcli.CreateStringFlag("uaa-company-name", "name of company for UAA branding", "Pivotal"),
pcli.CreateStringFlag("uaa-product-logo", "product logo for UAA branding", "iVBORw0KGgoAAAANSUhEUgAAAfwAAAB0CAYAAABgxoASAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAEpBJREFUeNrsnd1RG80ShsenfG+dCCxHYDkClggQESAiAKp0wxVwpRuqgAgQERgiYInAIgLri+DTyeCoNbNGBokfTc/OzO7zVAnwD6vd1my/3T2zPZ/MJoyG9/OvhUmP2fw1Wfr50f1cLv58fD4xOaJl7+PzTwYAAFrpoz83zOydZ0bvu+8n7kMxLiCYuGCgzDYIAAAAaLHgv4eee1WR2cxVAO5cADBlWAAAAILfPDquEtB3AYBk/Dfz13gu/jPMAwAATeA/mGBlBeBi/vp3Lv7X81eBSQAAAMFvNoP5636xIAPhBwAABL/xFE74f85fXcwBAAAIfrORef7fc9E/xRQAAIDgN5+Tuej/ItsHAAAEv/nI4j4R/R6mAAAABL/ZdJzoDzAFAACkDM/h63C96OJ3fD7GFAAN5elJHfn+xdgqnwT9R/N7v8RAgOC3S/SlX/8tpgDIUtA7TsS77vXdCXol7AAIPvwl+lP68wNkIfCD+de9JVEHaDTM4evScaJPNgCQPiL2BWIPCD5sijiPE8wAAAAIfvM5pBUvAACkRApz+DLffbTB7z0X1GrVrJDCnJxk+aXKkY7PtxmqAACQu+DPNnyk5e3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o8FLIiNMHaEgTAdlxhwQxghTRygI00GZMQeEMcLUEQrCdFBmzAFhjDB1hIIwHZQZc0AYI0wdoSBMB2XGHBDGCFNHKAjTQZkxB4QxwtQRCsJ0UGbMAWGMMHWEgjAdlBlzQBgjTB2hIEwHZcYcEMYIU0coCNNBmTEHhDHC1BEKwnRQZswBYYwwdYSCMB2UGXNAGCNMHaEgTAdlxhziUu1Ei8M/+WFMh1CZEUi0/A+j7hNSB5Wo2wAAAABJRU5ErkJggg=="),
pcli.CreateStringFlag("uaa-footer-legal-txt", "legal text for UAA branding", "Legal Text"),
pcli.CreateBoolTFlag("uaa-enable-selfservice-links", "enable self service links"),
pcli.CreateBoolTFlag("uaa-signups-enabled", "enable signups"),
pcli.CreateStringFlag("uaa-login-protocol", "uaa login protocol, default https", "https"),
pcli.CreateStringFlag("uaa-saml-service-provider-key", "saml service provider key for uaa"),
pcli.CreateStringFlag("uaa-saml-service-provider-cert", "saml service provider certificate for uaa"),
pcli.CreateStringFlag("uaa-jwt-signing-key", "signing key for jwt used by UAA"),
pcli.CreateStringFlag("uaa-jwt-verification-key", "verification key for jwt used by UAA"),
pcli.CreateBoolFlag("uaa-ldap-enabled", "is ldap enabled for UAA"),
pcli.CreateStringFlag("uaa-ldap-url", "url for ldap server"),
pcli.CreateStringFlag("uaa-ldap-user-dn", "userDN to bind to ldap with"),
pcli.CreateStringFlag("uaa-ldap-user-password", "bind password for ldap user"),
pcli.CreateStringFlag("uaa-ldap-search-filter", "search filter for users"),
pcli.CreateStringFlag("uaa-ldap-search-base", "search base for users"),
pcli.CreateStringFlag("uaa-ldap-mail-attributename", "attribute name for mail"),
pcli.CreateStringFlag("uaa-admin-secret", "admin account client secret"),
//User accounts
pcli.CreateStringFlag("admin-password", "password for admin account"),
pcli.CreateStringFlag("push-apps-manager-password", "password for push_apps_manager account"),
pcli.CreateStringFlag("smoke-tests-password", "password for smoke_tests account"),
pcli.CreateStringFlag("system-services-password", "password for system_services account"),
pcli.CreateStringFlag("system-verification-password", "password for system_verification account"),
//Client secrets
pcli.CreateStringFlag("opentsdb-firehose-nozzle-client-secret", "client-secret for opentsdb firehose nozzle"),
pcli.CreateStringFlag("identity-client-secret", "client-secret for identity"),
pcli.CreateStringFlag("login-client-secret", "client-secret for login"),
pcli.CreateStringFlag("portal-client-secret", "client-secret for portal"),
pcli.CreateStringFlag("autoscaling-service-client-secret", "client-secret for autoscaling service"),
pcli.CreateStringFlag("system-passwords-client-secret", "client-secret for system-passwords"),
pcli.CreateStringFlag("cc-service-dashboards-client-secret", "client-secret for cc-service-dashboards"),
pcli.CreateStringFlag("doppler-client-secret", "client-secret for doppler"),
pcli.CreateStringFlag("gorouter-client-secret", "client-secret for gorouter"),
pcli.CreateStringFlag("notifications-client-secret", "client-secret for notifications"),
pcli.CreateStringFlag("notifications-ui-client-secret", "client-secret for notification-ui"),
pcli.CreateStringFlag("cloud-controller-username-lookup-client-secret", "client-secret for cloud controller username lookup"),
pcli.CreateStringFlag("cc-routing-client-secret", "client-secret for cc routing"),
pcli.CreateStringFlag("ssh-proxy-client-secret", "client-secret for ssh proxy"),
pcli.CreateStringFlag("apps-metrics-client-secret", "client-secret for apps metrics "),
pcli.CreateStringFlag("apps-metrics-processing-client-secret", "client-secret for apps metrics processing"),
pcli.CreateStringFlag("errand-vm-type", "vm type to be used for running errands"),
pcli.CreateStringFlag("haproxy-sslpem", "SSL pem for HAProxy"),
pcli.CreateStringFlag("apps-manager-secret-token", "apps manager secret token for signing cookies"),
//Vault stuff
pcli.CreateStringFlag("vault-domain", "the location of your vault server (ie. http://10.0.0.1:8200)"),
pcli.CreateStringFlag("vault-hash-misc", "the hashname for misc CLI flags"),
pcli.CreateStringFlag("vault-hash-password", "the hashname of your secret (ie. secret/pcf-1-passwords"),
pcli.CreateStringFlag("vault-hash-keycert", "the hashname of your secret (ie. secret/pcf-1-keycert"),
pcli.CreateStringFlag("vault-hash-ip", "the hashname of your secret (ie. secret/pcf-1-ips"),
pcli.CreateStringFlag("vault-hash-host", "the hashname of your secret (ie. secret/pcf-1-hosts"),
pcli.CreateStringFlag("vault-token", "the token to make connections to your vault"),
pcli.CreateBoolFlag("vault-rotate", "set this flag to true if you would like re/set the values in vault. this will rotate internal certs and passwords"),
pcli.CreateBoolTFlag("vault-active", "use the data which is stored in vault for the flag values it contains"),
}
}
//GetMeta -
func (s *Plugin) GetMeta() product.Meta {
return product.Meta{
Name: "cloudfoundry",
Stemcell: enaml.Stemcell{
Name: StemcellName,
Alias: StemcellAlias,
Version: StemcellVersion,
},
Releases: []enaml.Release{
enaml.Release{
Name: CFReleaseName,
Version: CFReleaseVersion,
URL: CFReleaseURI,
SHA1: CFReleaseSHA,
},
enaml.Release{
Name: CFMysqlReleaseName,
Version: CFMysqlReleaseVersion,
URL: CFMysqlReleaseURI,
SHA1: CFMysqlReleaseSHA,
},
enaml.Release{
Name: DiegoReleaseName,
Version: DiegoReleaseVersion,
URL: DiegoReleaseURI,
SHA1: DiegoReleaseSHA,
},
enaml.Release{
Name: GardenReleaseName,
Version: GardenReleaseVersion,
URL: GardenReleaseURI,
SHA1: GardenReleaseSHA,
},
enaml.Release{
Name: CFLinuxReleaseName,
Version: CFLinuxReleaseVersion,
URL: CFLinuxReleaseURI,
SHA1: CFLinuxReleaseSHA,
},
enaml.Release{
Name: EtcdReleaseName,
Version: EtcdReleaseVersion,
URL: EtcdReleaseURI,
SHA1: EtcdReleaseSHA,
},
},
Properties: map[string]interface{}{
"version": s.PluginVersion,
"cf-release": strings.Join([]string{CFReleaseName, CFReleaseVersion}, " / "),
"cf-mysql-release": strings.Join([]string{CFMysqlReleaseName, CFMysqlReleaseVersion}, " / "),
"diego-release": strings.Join([]string{DiegoReleaseName, DiegoReleaseVersion}, " / "),
"garden-linux-release": strings.Join([]string{GardenReleaseName, GardenReleaseVersion}, " / "),
"cflinuxfs2-rootfs-release": strings.Join([]string{CFLinuxReleaseName, CFLinuxReleaseVersion}, " / "),
"etcd-release": strings.Join([]string{EtcdReleaseName, EtcdReleaseVersion}, " / "),
"stemcell": StemcellVersion,
},
}
}
//GetProduct -
func (s *Plugin) GetProduct(args []string, cloudConfig []byte, cs cred.Store) (b []byte, err error) {
flgs := s.GetFlags()
InferFromCloudDecorate(flagsToInferFromCloudConfig, cloudConfig, args, flgs)
if err := VaultRotate(args, flgs); err != nil {
lo.G.Errorf("unable to rotate vault values: %v", err.Error())
return nil, err
}
VaultDecorate(args, flgs)
c := pluginutil.NewContext(args, pluginutil.ToCliFlagArray(flgs))
var dm *enaml.DeploymentManifest
var cfg *config.Config
if cfg, err = config.NewConfig(c); err == nil {
dm, err = s.getDeploymentManifest(c, cfg)
if err != nil {
lo.G.Errorf("error creating manifest: %v", err.Error())
}
} else {
lo.G.Errorf("error getting config: %v", err.Error())
}
return dm.Bytes(), err
}
func (s *Plugin) getDeploymentManifest(c *cli.Context, config *config.Config) (*enaml.DeploymentManifest, error) {
dm := enaml.NewDeploymentManifest([]byte(``))
dm.SetName(c.String("deployment-name"))
dm.AddRelease(enaml.Release{
Name: CFReleaseName,
Version: c.String("cf-release-version"),
URL: c.String("cf-release-url"),
SHA1: c.String("cf-release-sha"),
})
dm.AddRelease(enaml.Release{
Name: CFMysqlReleaseName,
Version: c.String("cf-mysql-release-version"),
URL: c.String("cf-mysql-release-url"),
SHA1: c.String("cf-mysql-release-sha"),
})
dm.AddRelease(enaml.Release{
Name: DiegoReleaseName,
Version: c.String("diego-release-version"),
URL: c.String("diego-release-url"),
SHA1: c.String("diego-release-sha"),
})
dm.AddRelease(enaml.Release{
Name: GardenReleaseName,
Version: c.String("garden-release-version"),
URL: c.String("garden-release-url"),
SHA1: c.String("garden-release-sha"),
})
dm.AddRelease(enaml.Release{
Name: CFLinuxReleaseName,
Version: c.String("cflinuxfs2-release-version"),
URL: c.String("cflinuxfs2-release-url"),
SHA1: c.String("cflinuxfs2-release-sha"),
})
dm.AddRelease(enaml.Release{
Name: EtcdReleaseName,
Version: c.String("etcd-release-version"),
URL: c.String("etcd-release-url"),
SHA1: c.String("etcd-release-sha"),
})
dm.AddStemcell(enaml.Stemcell{OS: StemcellName, Version: c.String("stemcell-version"), Alias: c.String("stemcell-name")})
dm.Update.MaxInFlight = 10
dm.Update.Canaries = 10
dm.Update.Serial = false
dm.Update.CanaryWatchTime = "30000-300000"
dm.Update.UpdateWatchTime = "30000-300000"
for _, factory := range factories {
grouper := factory(config)
if ig := grouper.ToInstanceGroup(); ig != nil {
lo.G.Debug("instance-group: ", ig)
dm.AddInstanceGroup(ig)
}
}
return dm, nil
}
func InferFromCloudDecorate(inferFlagMap map[string][]string, cloudConfig []byte, args []string, flgs []pcli.Flag) {
c := pluginutil.NewContext(args, pluginutil.ToCliFlagArray(flgs))
if c.Bool("infer-from-cloud") {
ccinf := pluginutil.NewCloudConfigInferFromBytes(cloudConfig)
setAllInferredFlagDefaults(inferFlagMap["disktype"], ccinf.InferDefaultDiskType(), flgs, c)
setAllInferredFlagDefaults(inferFlagMap["vmtype"], ccinf.InferDefaultVMType(), flgs, c)
setAllInferredFlagDefaults(inferFlagMap["az"], ccinf.InferDefaultAZ(), flgs, c)
setAllInferredFlagDefaults(inferFlagMap["network"], ccinf.InferDefaultNetwork(), flgs, c)
}
}
func setAllInferredFlagDefaults(matchlist []string, defaultvalue string, flgs []pcli.Flag, c *cli.Context) {
for _, match := range matchlist {
// only infer flags that weren't manually set
if !c.IsSet(match) {
setFlagDefault(match, defaultvalue, flgs)
}
}
}
func setFlagDefault(flagname, defaultvalue string, flgs []pcli.Flag) {
for idx, flg := range flgs {
if flg.Name == flagname {
flgs[idx].Value = defaultvalue
}
}
}
func VaultDecorate(args []string, flgs []pcli.Flag) {
c := pluginutil.NewContext(args, pluginutil.ToCliFlagArray(flgs))
if hasValidVaultFlags(c) {
lo.G.Debug("connecting to vault at: ", c.String("vault-domain"))
vault := pluginutil.NewVaultUnmarshal(c.String("vault-domain"), c.String("vault-token"))
hashes := []string{
c.String("vault-hash-misc"),
c.String("vault-hash-password"),
c.String("vault-hash-keycert"),
c.String("vault-hash-ip"),
c.String("vault-hash-host"),
}
for _, hash := range hashes {
if hash != "" {
vault.UnmarshalFlags(hash, flgs)
}
}
} else {
lo.G.Debug("complete vault flagset not found:",
"active: ", c.Bool("vault-active"),
"domain: ", c.String("vault-domain"),
"passhash: ", c.String("vault-hash-password"),
"keycerthash: ", c.String("vault-hash-keycert"),
"iphash: ", c.String("vault-hash-ip"),
"hosthash: ", c.String("vault-hash-host"),
"vaulttoken: ", c.String("vault-token"),
)
if c.Bool("vault-active") {
lo.G.Fatal("you've activated vault, but have not provided a complete set of values... exiting program now")
}
}
}
func hasValidVaultFlags(c *cli.Context) bool {
return c.Bool("vault-active") &&
c.String("vault-domain") != "" &&
c.String("vault-token") != ""
}
//GetContext -
func (s *Plugin) GetContext(args []string) (c *cli.Context) {
c = pluginutil.NewContext(args, pluginutil.ToCliFlagArray(s.GetFlags()))
return
}