-
Notifications
You must be signed in to change notification settings - Fork 188
/
SingularityDeployBuilder.java
635 lines (521 loc) · 20.2 KB
/
SingularityDeployBuilder.java
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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
package com.hubspot.singularity;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Optional;
import com.hubspot.deploy.ExecutorData;
import com.hubspot.deploy.HealthcheckOptions;
import com.hubspot.mesos.Resources;
import com.hubspot.mesos.SingularityContainerInfo;
import com.hubspot.mesos.SingularityMesosTaskLabel;
public class SingularityDeployBuilder {
private final String requestId;
private String id;
private Optional<String> version;
private Optional<Long> timestamp;
private Optional<Map<String, String>> metadata;
private Optional<SingularityContainerInfo> containerInfo;
private Optional<String> customExecutorCmd;
private Optional<String> customExecutorId;
private Optional<String> customExecutorSource;
private Optional<Resources> customExecutorResources;
private Optional<Resources> resources;
private Optional<String> command;
private Optional<List<String>> arguments;
private Optional<Map<String, String>> env;
private Optional<Map<Integer, Map<String, String>>> taskEnv;
private Optional<List<String>> uris;
private Optional<ExecutorData> executorData;
private Optional<Map<String, String>> labels;
private Optional<List<SingularityMesosTaskLabel>> mesosLabels;
private Optional<Map<Integer, Map<String, String>>> taskLabels;
private Optional<Map<Integer, List<SingularityMesosTaskLabel>>> mesosTaskLabels;
/**
* @deprecated use {@link #healthcheck}
*/
@Deprecated
private Optional<String> healthcheckUri;
/**
* @deprecated use {@link #healthcheck}
*/
@Deprecated
private Optional<Long> healthcheckIntervalSeconds;
/**
* @deprecated use {@link #healthcheck}
*/
@Deprecated
private Optional<Long> healthcheckTimeoutSeconds;
/**
* @deprecated use {@link #healthcheck}
*/
@Deprecated
private Optional<Integer> healthcheckPortIndex;
/**
* @deprecated use {@link #healthcheck}
*/
@Deprecated
private Optional<HealthcheckProtocol> healthcheckProtocol;
/**
* @deprecated use {@link #healthcheck}
*/
@Deprecated
private Optional<Integer> healthcheckMaxRetries;
/**
* @deprecated use {@link #healthcheck}
*/
@Deprecated
private Optional<Long> healthcheckMaxTotalTimeoutSeconds;
private Optional<Boolean> skipHealthchecksOnDeploy;
private Optional<HealthcheckOptions> healthcheck;
private Optional<Long> deployHealthTimeoutSeconds;
private Optional<Long> considerHealthyAfterRunningForSeconds;
private Optional<String> serviceBasePath;
private Optional<Set<String>> loadBalancerGroups;
private Optional<Integer> loadBalancerPortIndex;
private Optional<Map<String, Object>> loadBalancerOptions;
private Optional<Set<String>> loadBalancerDomains;
private Optional<List<String>> loadBalancerAdditionalRoutes;
private Optional<String> loadBalancerTemplate;
private Optional<String> loadBalancerServiceIdOverride;
private Optional<String> loadBalancerUpstreamGroup;
private Optional<Integer> deployInstanceCountPerStep;
private Optional<Integer> deployStepWaitTimeMs;
private Optional<Boolean> autoAdvanceDeploySteps;
private Optional<Integer> maxTaskRetries;
private Optional<Boolean> shell;
private Optional<String> user;
public SingularityDeployBuilder(String requestId, String id) {
this.requestId = requestId;
this.id = id;
this.version = Optional.absent();
this.timestamp = Optional.absent();
this.metadata = Optional.absent();
this.containerInfo = Optional.absent();
this.customExecutorCmd = Optional.absent();
this.customExecutorId = Optional.absent();
this.customExecutorSource = Optional.absent();
this.customExecutorResources = Optional.absent();
this.resources = Optional.absent();
this.command = Optional.absent();
this.arguments = Optional.absent();
this.env = Optional.absent();
this.taskEnv = Optional.absent();
this.uris = Optional.absent();
this.executorData = Optional.absent();
this.labels = Optional.absent();
this.mesosLabels = Optional.absent();
this.taskLabels = Optional.absent();
this.mesosTaskLabels = Optional.absent();
this.healthcheckUri = Optional.absent();
this.healthcheckIntervalSeconds = Optional.absent();
this.healthcheckTimeoutSeconds = Optional.absent();
this.healthcheckPortIndex = Optional.absent();
this.skipHealthchecksOnDeploy = Optional.absent();
this.deployHealthTimeoutSeconds = Optional.absent();
this.healthcheck = Optional.absent();
this.healthcheckProtocol = Optional.absent();
this.healthcheckMaxTotalTimeoutSeconds = Optional.absent();
this.healthcheckMaxRetries = Optional.absent();
this.considerHealthyAfterRunningForSeconds = Optional.absent();
this.serviceBasePath = Optional.absent();
this.loadBalancerGroups = Optional.absent();
this.loadBalancerPortIndex = Optional.absent();
this.loadBalancerOptions = Optional.absent();
this.loadBalancerDomains = Optional.absent();
this.loadBalancerAdditionalRoutes = Optional.absent();
this.loadBalancerTemplate = Optional.absent();
this.loadBalancerServiceIdOverride = Optional.absent();
this.loadBalancerUpstreamGroup = Optional.absent();
this.deployInstanceCountPerStep = Optional.absent();
this.deployStepWaitTimeMs = Optional.absent();
this.autoAdvanceDeploySteps = Optional.absent();
this.maxTaskRetries = Optional.absent();
this.shell = Optional.absent();
this.user = Optional.absent();
}
public SingularityDeploy build() {
return new SingularityDeploy(requestId, id, command, arguments, containerInfo, customExecutorCmd, customExecutorId, customExecutorSource, customExecutorResources, resources,
env, taskEnv, uris, metadata, executorData, version, timestamp, labels, mesosLabels, taskLabels, mesosTaskLabels, deployHealthTimeoutSeconds, healthcheckUri, healthcheckIntervalSeconds, healthcheckTimeoutSeconds, healthcheckPortIndex, healthcheckMaxRetries,
healthcheckMaxTotalTimeoutSeconds, healthcheck, serviceBasePath, loadBalancerGroups, loadBalancerPortIndex, considerHealthyAfterRunningForSeconds, loadBalancerOptions, loadBalancerDomains, loadBalancerAdditionalRoutes,
loadBalancerTemplate, loadBalancerServiceIdOverride, loadBalancerUpstreamGroup, skipHealthchecksOnDeploy, healthcheckProtocol, deployInstanceCountPerStep, deployStepWaitTimeMs, autoAdvanceDeploySteps, maxTaskRetries, shell, user);
}
public String getRequestId() {
return requestId;
}
public String getId() {
return id;
}
public SingularityDeployBuilder setId(String id) {
this.id = id;
return this;
}
public Optional<Long> getConsiderHealthyAfterRunningForSeconds() {
return considerHealthyAfterRunningForSeconds;
}
public SingularityDeployBuilder setConsiderHealthyAfterRunningForSeconds(Optional<Long> considerHealthyAfterRunningForSeconds) {
this.considerHealthyAfterRunningForSeconds = considerHealthyAfterRunningForSeconds;
return this;
}
public Optional<String> getVersion() {
return version;
}
public SingularityDeployBuilder setVersion(Optional<String> version) {
this.version = version;
return this;
}
public Optional<Long> getTimestamp() {
return timestamp;
}
public SingularityDeployBuilder setTimestamp(Optional<Long> timestamp) {
this.timestamp = timestamp;
return this;
}
public Optional<Map<String, String>> getMetadata() {
return metadata;
}
public SingularityDeployBuilder setMetadata(Optional<Map<String, String>> metadata) {
this.metadata = metadata;
return this;
}
public Optional<SingularityContainerInfo> getContainerInfo() {
return containerInfo;
}
public SingularityDeployBuilder setContainerInfo(Optional<SingularityContainerInfo> containerInfo) {
this.containerInfo = containerInfo;
return this;
}
public Optional<String> getCustomExecutorCmd() {
return customExecutorCmd;
}
public SingularityDeployBuilder setCustomExecutorCmd(Optional<String> customExecutorCmd) {
this.customExecutorCmd = customExecutorCmd;
return this;
}
public Optional<String> getCustomExecutorId() {
return customExecutorId;
}
public SingularityDeployBuilder setCustomExecutorId(Optional<String> customExecutorId) {
this.customExecutorId = customExecutorId;
return this;
}
public Optional<String> getCustomExecutorSource() {
return customExecutorSource;
}
public SingularityDeployBuilder setCustomExecutorSource(Optional<String> customExecutorSource) {
this.customExecutorSource = customExecutorSource;
return this;
}
public Optional<Resources> getCustomExecutorResources() {
return customExecutorResources;
}
public SingularityDeployBuilder setCustomExecutorResources(Optional<Resources> customExecutorResources) {
this.customExecutorResources = customExecutorResources;
return this;
}
public Optional<Long> getDeployHealthTimeoutSeconds() {
return deployHealthTimeoutSeconds;
}
public SingularityDeployBuilder setDeployHealthTimeoutSeconds(Optional<Long> deployHealthTimeoutSeconds) {
this.deployHealthTimeoutSeconds = deployHealthTimeoutSeconds;
return this;
}
public Optional<Resources> getResources() {
return resources;
}
public SingularityDeployBuilder setResources(Optional<Resources> resources) {
this.resources = resources;
return this;
}
public Optional<String> getCommand() {
return command;
}
public SingularityDeployBuilder setCommand(Optional<String> command) {
this.command = command;
return this;
}
public Optional<List<String>> getArguments() {
return arguments;
}
public SingularityDeployBuilder setArguments(Optional<List<String>> arguments) {
this.arguments = arguments;
return this;
}
public Optional<Map<String, String>> getEnv() {
return env;
}
public SingularityDeployBuilder setEnv(Optional<Map<String, String>> env) {
this.env = env;
return this;
}
public Optional<Map<Integer, Map<String, String>>> getTaskEnv() {
return taskEnv;
}
public SingularityDeployBuilder setTaskEnv(Optional<Map<Integer, Map<String, String>>> taskEnv) {
this.taskEnv = taskEnv;
return this;
}
public Optional<List<String>> getUris() {
return uris;
}
public SingularityDeployBuilder setUris(Optional<List<String>> uris) {
this.uris = uris;
return this;
}
public Optional<ExecutorData> getExecutorData() {
return executorData;
}
public SingularityDeployBuilder setExecutorData(Optional<ExecutorData> executorData) {
this.executorData = executorData;
return this;
}
public Optional<String> getHealthcheckUri() {
return healthcheckUri;
}
public SingularityDeployBuilder setHealthcheckUri(Optional<String> healthcheckUri) {
this.healthcheckUri = healthcheckUri;
return this;
}
public Optional<Long> getHealthcheckIntervalSeconds() {
return healthcheckIntervalSeconds;
}
public SingularityDeployBuilder setHealthcheckIntervalSeconds(Optional<Long> healthcheckIntervalSeconds) {
this.healthcheckIntervalSeconds = healthcheckIntervalSeconds;
return this;
}
public Optional<Long> getHealthcheckTimeoutSeconds() {
return healthcheckTimeoutSeconds;
}
public SingularityDeployBuilder setHealthcheckTimeoutSeconds(Optional<Long> healthcheckTimeoutSeconds) {
this.healthcheckTimeoutSeconds = healthcheckTimeoutSeconds;
return this;
}
public Optional<Integer> getHealthcheckPortIndex() {
return healthcheckPortIndex;
}
public SingularityDeployBuilder setHealthcheckPortIndex(Optional<Integer> healthcheckPortIndex) {
this.healthcheckPortIndex = healthcheckPortIndex;
return this;
}
public Optional<String> getServiceBasePath() {
return serviceBasePath;
}
public SingularityDeployBuilder setServiceBasePath(Optional<String> serviceBasePath) {
this.serviceBasePath = serviceBasePath;
return this;
}
public Optional<Set<String>> getLoadBalancerGroups() {
return loadBalancerGroups;
}
public SingularityDeployBuilder setLoadBalancerGroups(Optional<Set<String>> loadBalancerGroups) {
this.loadBalancerGroups = loadBalancerGroups;
return this;
}
public Optional<Integer> getLoadBalancerPortIndex() {
return loadBalancerPortIndex;
}
public SingularityDeployBuilder setLoadBalancerPortIndex(Optional<Integer> loadBalancerPortIndex) {
this.loadBalancerPortIndex = loadBalancerPortIndex;
return this;
}
public Optional<Map<String, Object>> getLoadBalancerOptions() {
return loadBalancerOptions;
}
public SingularityDeployBuilder setLoadBalancerOptions(Optional<Map<String, Object>> loadBalancerOptions) {
this.loadBalancerOptions = loadBalancerOptions;
return this;
}
public Optional<Set<String>> getLoadBalancerDomains() {
return loadBalancerDomains;
}
public SingularityDeployBuilder setLoadBalancerDomains(Optional<Set<String>> loadBalancerDomains) {
this.loadBalancerDomains = loadBalancerDomains;
return this;
}
public Optional<List<String>> getLoadBalancerAdditionalRoutes() {
return loadBalancerAdditionalRoutes;
}
public SingularityDeployBuilder setLoadBalancerAdditionalRoutes(Optional<List<String>> loadBalancerAdditionalRoutes) {
this.loadBalancerAdditionalRoutes = loadBalancerAdditionalRoutes;
return this;
}
public Optional<String> getLoadBalancerTemplate() {
return loadBalancerTemplate;
}
public SingularityDeployBuilder setLoadBalancerTemplate(Optional<String> loadBalancerTemplate) {
this.loadBalancerTemplate = loadBalancerTemplate;
return this;
}
@Deprecated
public Optional<Map<String, String>> getLabels() {
return labels;
}
@Deprecated
public SingularityDeployBuilder setLabels(Optional<Map<String, String>> labels) {
this.labels = labels;
return this;
}
public Optional<List<SingularityMesosTaskLabel>> getMesosLabels() {
return mesosLabels;
}
public SingularityDeployBuilder setMesosLabels(Optional<List<SingularityMesosTaskLabel>> mesosLabels) {
this.mesosLabels = mesosLabels;
return this;
}
@Deprecated
public Optional<Map<Integer, Map<String, String>>> getTaskLabels() {
return taskLabels;
}
@Deprecated
public SingularityDeployBuilder setTaskLabels(Optional<Map<Integer, Map<String, String>>> taskLabels) {
this.taskLabels = taskLabels;
return this;
}
public Optional<Map<Integer, List<SingularityMesosTaskLabel>>> getMesosTaskLabels() {
return mesosTaskLabels;
}
public SingularityDeployBuilder setMesosTaskLabels(Optional<Map<Integer, List<SingularityMesosTaskLabel>>> mesosTaskLabels) {
this.mesosTaskLabels = mesosTaskLabels;
return this;
}
public Optional<Boolean> getSkipHealthchecksOnDeploy() {
return skipHealthchecksOnDeploy;
}
public SingularityDeployBuilder setSkipHealthchecksOnDeploy(Optional<Boolean> skipHealthchecksOnDeploy) {
this.skipHealthchecksOnDeploy = skipHealthchecksOnDeploy;
return this;
}
public Optional<HealthcheckProtocol> getHealthcheckProtocol() {
return healthcheckProtocol;
}
public SingularityDeployBuilder setHealthcheckProtocol(Optional<HealthcheckProtocol> healthcheckProtocol) {
this.healthcheckProtocol = healthcheckProtocol;
return this;
}
public Optional<Integer> getHealthcheckMaxRetries() {
return healthcheckMaxRetries;
}
public Optional<Long> getHealthcheckMaxTotalTimeoutSeconds() {
return healthcheckMaxTotalTimeoutSeconds;
}
public SingularityDeployBuilder setHealthcheckMaxRetries(Optional<Integer> healthcheckMaxRetries) {
this.healthcheckMaxRetries = healthcheckMaxRetries;
return this;
}
public SingularityDeployBuilder setHealthcheckMaxTotalTimeoutSeconds(Optional<Long> healthcheckMaxTotalTimeoutSeconds) {
this.healthcheckMaxTotalTimeoutSeconds = healthcheckMaxTotalTimeoutSeconds;
return this;
}
public Optional<HealthcheckOptions> getHealthcheck() {
return healthcheck;
}
public SingularityDeployBuilder setHealthcheck(Optional<HealthcheckOptions> healthcheck) {
this.healthcheck = healthcheck;
return this;
}
public Optional<Integer> getDeployInstanceCountPerStep() {
return deployInstanceCountPerStep;
}
public SingularityDeployBuilder setDeployInstanceCountPerStep(Optional<Integer> deployInstanceCountPerStep) {
this.deployInstanceCountPerStep = deployInstanceCountPerStep;
return this;
}
public Optional<Integer> getDeployStepWaitTimeMs() {
return deployStepWaitTimeMs;
}
public SingularityDeployBuilder setDeployStepWaitTimeMs(Optional<Integer> deployStepWaitTimeMs) {
this.deployStepWaitTimeMs = deployStepWaitTimeMs;
return this;
}
public Optional<Boolean> getAutoAdvanceDeploySteps() {
return autoAdvanceDeploySteps;
}
public SingularityDeployBuilder setAutoAdvanceDeploySteps(Optional<Boolean> autoAdvanceDeploySteps) {
this.autoAdvanceDeploySteps = autoAdvanceDeploySteps;
return this;
}
public Optional<Integer> getMaxTaskRetries() {
return maxTaskRetries;
}
public SingularityDeployBuilder setMaxTaskRetries(Optional<Integer> maxTaskRetries) {
this.maxTaskRetries = maxTaskRetries;
return this;
}
public Optional<Boolean> getShell() {
return shell;
}
public SingularityDeployBuilder setShell(Optional<Boolean> shell) {
this.shell = shell;
return this;
}
public Optional<String> getUser() {
return user;
}
public SingularityDeployBuilder setUser(Optional<String> user) {
this.user = user;
return this;
}
public Optional<String> getLoadBalancerServiceIdOverride() {
return loadBalancerServiceIdOverride;
}
public SingularityDeployBuilder setLoadBalancerServiceIdOverride(Optional<String> loadBalancerServiceIdOverride) {
this.loadBalancerServiceIdOverride = loadBalancerServiceIdOverride;
return this;
}
public Optional<String> getLoadBalancerUpstreamGroup() {
return loadBalancerUpstreamGroup;
}
public SingularityDeployBuilder setLoadBalancerUpstreamGroup(Optional<String> loadBalancerUpstreamGroup) {
this.loadBalancerUpstreamGroup = loadBalancerUpstreamGroup;
return this;
}
@Override
public String toString() {
return "SingularityDeployBuilder{" +
"requestId='" + requestId + '\'' +
", id='" + id + '\'' +
", version=" + version +
", timestamp=" + timestamp +
", metadata=" + metadata +
", containerInfo=" + containerInfo +
", customExecutorCmd=" + customExecutorCmd +
", customExecutorId=" + customExecutorId +
", customExecutorSource=" + customExecutorSource +
", customExecutorResources=" + customExecutorResources +
", resources=" + resources +
", command=" + command +
", arguments=" + arguments +
", env=" + env +
", taskEnv=" + taskEnv +
", uris=" + uris +
", executorData=" + executorData +
", labels=" + labels +
", taskLabels=" + taskLabels +
", healthcheckUri=" + healthcheckUri +
", healthcheckIntervalSeconds=" + healthcheckIntervalSeconds +
", healthcheckTimeoutSeconds=" + healthcheckTimeoutSeconds +
", healthcheckPortIndex=" + healthcheckPortIndex +
", skipHealthchecksOnDeploy=" + skipHealthchecksOnDeploy +
", healthcheckProtocol=" + healthcheckProtocol +
", healthcheckMaxRetries=" + healthcheckMaxRetries +
", healthcheckMaxTotalTimeoutSeconds=" + healthcheckMaxTotalTimeoutSeconds +
", healthcheck=" + healthcheck +
", deployHealthTimeoutSeconds=" + deployHealthTimeoutSeconds +
", considerHealthyAfterRunningForSeconds=" + considerHealthyAfterRunningForSeconds +
", serviceBasePath=" + serviceBasePath +
", loadBalancerGroups=" + loadBalancerGroups +
", loadBalancerPortIndex=" + loadBalancerPortIndex +
", loadBalancerOptions=" + loadBalancerOptions +
", loadBalancerDomains=" + loadBalancerDomains +
", loadBalancerAdditionalRoutes=" + loadBalancerAdditionalRoutes +
", loadBalancerTemplate=" + loadBalancerTemplate +
", loadBalancerServiceIdOverride=" + loadBalancerServiceIdOverride +
", loadBalancerUpstreamGroup=" + loadBalancerUpstreamGroup +
", deployInstanceCountPerStep=" + deployInstanceCountPerStep +
", deployStepWaitTimeMs=" + deployStepWaitTimeMs +
", autoAdvanceDeploySteps=" + autoAdvanceDeploySteps +
", maxTaskRetries=" + maxTaskRetries +
", shell=" + shell +
", user=" + user +
'}';
}
}