-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmesoscluster-condor.yaml
616 lines (548 loc) · 21.1 KB
/
mesoscluster-condor.yaml
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
heat_template_version: 2014-10-16
description: >
This template defines a Mesos Cluster that consist of:
a set of masters running also Marathon and Chronos Frameworks;
a set of slaves;
two Load Balancers with a Virtual IP.
Service-discovery and load-balacing is implemented using Consul, dnsmasq,
mesos-consul, marathon-consul and haproxy-consul
parameters:
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
network:
type: string
description: uuid/name of a network to use for ip addresses
server_image:
type: string
default: "ubuntu-16.04"
description: glance image used to boot the server
master_flavor:
type: string
default: m1.medium
description: flavor to use when booting the server
number_of_masters:
type: number
description: how many mesos masters to spawn initially
default: 1
slave_flavor:
type: string
default: m1.small
description: flavor to use when booting the server
number_of_slaves:
type: number
description: how many mesos slaves to spawn initially
constraints:
- range: { min: 2 }
default: 4
loadbalancer_flavor:
type: string
default: m1.small
description: flavor to use when booting the loadbalancer server
availability_zone:
type: string
default: nova
description: where to create the cluster
marathon_username:
type: string
description: username to access Marathon endpoint
marathon_password:
type: string
description: password to access Marathon endpoint
ams_default_squid_port:
type: string
default: 3128
ams_default_squid:
type: string
default: cream-bdii.pg.infn.it
ams_use_local_squid:
type: boolean
default: false
number_of_wn_instances:
type: number
description: Number WN instances
cpu_x_wn:
type: number
description: Number of vCPU for each WN
ram_x_wn:
type: number
description: Amount of RAM for each WN
docker_cpu_x_wn:
type: number
description: Amount of RAM for each WN in docker
docker_ram_x_wn:
type: number
description: Amount of RAM for each WN in docker
ams_repo_server_url:
type: string
ams_repo_public_key_path:
type: string
ams_repo_http_proxy:
type: string
ams_repo_repository_name:
type: string
ams_repo_public_key:
type: string
ams_repo_public_key_url:
type: string
default: ""
resources:
######################################################################
#
# security groups. we need to permit network traffic of various
# sorts.
#
secgroup_base:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: icmp
- protocol: tcp
port_range_min: 22
port_range_max: 22
- protocol: tcp
remote_mode: remote_group_id
secgroup_mesos:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: tcp
port_range_min: 5050
port_range_max: 5050
- protocol: tcp
port_range_min: 8443
port_range_max: 8443
- protocol: tcp
port_range_min: 4443
port_range_max: 4443
# Required by <slave>/monitoring/statisics.json resource
secgroup_slaves:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: tcp
port_range_min: 5051
port_range_max: 5051
secgroup_condor:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: tcp
port_range_min: 9618
port_range_max: 9618
- protocol: tcp
port_range_min: 9614
port_range_max: 9614
- protocol: tcp
port_range_min: 5651
port_range_max: 5651
- protocol: tcp
port_range_min: 5652
port_range_max: 5652
- protocol: tcp
port_range_min: 5653
port_range_max: 5653
- protocol: tcp
port_range_min: 5654
port_range_max: 5654
secgroup_schedd:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: tcp
port_range_min: 31042
port_range_max: 31042
secgroup_all_open:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: icmp
- protocol: tcp
- protocol: udp
vip_port:
type: OS::Neutron::Port
properties:
network: {get_param: network}
security_groups:
- get_resource: secgroup_all_open
replacement_policy: AUTO
#########
# Common config
ansible_setup_config:
type: OS::Heat::SoftwareConfig
properties:
group: script
inputs:
- name: role_list
type: CommaDelimitedList
config: { get_file: 'https://raw.githubusercontent.com/Cloud-PG/mesos-cluster/devel/heat-templates-v2/setup.sh' }
######################################################################
#
# Load Balancers SoftwareConfig.
#
loadbalancer_setup_deployment:
type: OS::Heat::SoftwareDeployments
properties:
config: {get_resource: ansible_setup_config}
servers: {get_attr: [loadbalancers, attributes, loadbalancer_id]}
input_values:
role_list: "consul,keepalived,marathon-lb"
#,gateway_config"
loadbalancer_config:
type: OS::Heat::SoftwareConfig
properties:
group: ansible
inputs:
- name: consul_servers
type: CommaDelimitedList
- name: keepalived_virtual_ip
config: |
---
- hosts: localhost
vars:
docker_bridge_ip: "172.0.17.1"
connection: local
pre_tasks:
- name: Fix /etc/hosts
lineinfile: dest=/etc/hosts regexp='^127\.0\.1\.1' line="{{ ansible_default_ipv4.address }}\t{{ansible_fqdn}} {{ ansible_hostname }}"
- name: Update /etc/hosts
lineinfile: dest=/etc/hosts line="{{ ansible_default_ipv4.address }}\t{{ansible_fqdn}} {{ ansible_hostname }}"
roles:
- { role: indigo-dc.consul, consul_mode: "agent"}
- { role: indigo-dc.marathon-lb }
- { role: indigo-dc.keepalived }
# - { role: Cloud-PG.gateway_config, availability_zone: {get_param: availability_zone} }
loadbalancer_deployment:
type: OS::Heat::SoftwareDeployments
depends_on:
- loadbalancer_setup_deployment
- master_deployment
properties:
config: {get_resource: loadbalancer_config}
servers: {get_attr: [loadbalancers, attributes, loadbalancer_id]}
input_values:
consul_servers: {get_attr: [mesos_masters, mesos_server_ip]}
load_balancers_list: {get_attr: [loadbalancers, loadbalancer_ip]}
keepalived_virtual_ip: {get_attr: [vip_port, fixed_ips, 0, ip_address]}
marathon_lb_auth_creds:
list_join:
- ':'
- - {get_param: marathon_username }
- {get_param: marathon_password }
loadbalancers:
type: OS::Heat::ResourceGroup
properties:
count: 2
resource_def:
type: https://raw.githubusercontent.com/Cloud-PG/mesos-condor-ams-cluster/master/heat-templates/loadbalancer.yaml
properties:
server_name: lb%index%
ssh_key_name: {get_param: ssh_key_name}
server_image: {get_param: server_image}
server_flavor: {get_param: loadbalancer_flavor}
availability_zone: {get_param: availability_zone}
network: {get_param: network}
virtual_ip: {get_attr: [vip_port, fixed_ips, 0, ip_address]}
security_groups:
- {get_resource: secgroup_base}
- {get_resource: secgroup_all_open}
######################################################################
#
# Master SoftwareConfig.
#
master_config:
type: OS::Heat::SoftwareConfig
properties:
group: ansible
inputs:
- name: mesos_masters_list
type: CommaDelimitedList
- name: zookeeper_host_list
type: CommaDelimitedList
- name: zookeeper_peers
type: CommaDelimitedList
- name: consul_servers
- name: marathon_username
- name: marathon_password
- name: ams_use_local_squid
- name: ams_default_squid
- name: ams_default_squid_port
- name: htcondor_config_schedd_ip
- name: ams_number_of_wn_instances
- name: ams_number_of_slaves
- name: ams_cpu_x_wn
- name: ams_ram_x_wn
- name: ams_docker_cpu_x_wn
- name: ams_docker_ram_x_wn
config: |
---
- hosts: localhost
vars:
docker_bridge_ip: "172.0.17.1"
connection: local
pre_tasks:
- name: Fix /etc/hosts
lineinfile: dest=/etc/hosts regexp='^127\.0\.1\.1' line="{{ ansible_default_ipv4.address }}\t{{ansible_fqdn}} {{ ansible_hostname }}"
- name: Update /etc/hosts
lineinfile: dest=/etc/hosts line="{{ ansible_default_ipv4.address }}\t{{ansible_fqdn}} {{ ansible_hostname }}"
roles:
- { role: indigo-dc.consul, consul_mode: "server" }
- { role: indigo-dc.zookeeper }
- { role: indigo-dc.mesos, mesos_install_mode: "master" }
- { role: indigo-dc.marathon }
- { role: indigo-dc.htcondor_config, config_mode: "master", htcondor_config_schedd_ip: {get_attr: [mesos_slaveschedd, resource.0, mesos_server_ip]}, zookeeper_peers: {get_attr: [mesos_masters, mesos_server_ip]}, lb_peers: {get_attr: [vip_port, fixed_ips, 0, ip_address]} }
- { role: indigo-dc.ams_config, ams_config_node: "master", htcondor_config_schedd_ip: {get_attr: [mesos_slaveschedd, resource.0, mesos_server_ip]}, ams_use_local_squid: "{{ams_use_local_squid}}" }
# - { role: Cloud-PG.gateway_config, availability_zone: {get_param: availability_zone} }
######################################################################
#
# Master SoftwareDeployment.
#
master_setup_deployment:
type: OS::Heat::SoftwareDeployments
properties:
config: {get_resource: ansible_setup_config}
servers: {get_attr: [mesos_masters, attributes, mesos_server_id]}
input_values:
role_list: "consul,zookeeper,mesos,marathon,htcondor_config,ams_config"
#,gateway_config"
master_deployment:
type: OS::Heat::SoftwareDeployments
depends_on:
- master_setup_deployment
properties:
config: {get_resource: master_config}
servers: {get_attr: [mesos_masters, attributes, mesos_server_id]}
input_values:
mesos_masters_list: {get_attr: [mesos_masters, mesos_server_ip]}
ams_use_local_squid: {get_param: ams_use_local_squid}
consul_servers: "{{mesos_masters_list}}"
zookeeper_host_list: "{{mesos_masters_list}}"
zookeeper_peers: "{{mesos_masters_list}}"
marathon_username: {get_param: marathon_username}
marathon_password: {get_param: marathon_password}
htcondor_config_schedd_ip: {get_attr: [mesos_slaveschedd, resource.0, mesos_server_ip]}
ams_default_squid: {get_param: ams_default_squid}
ams_default_squid_port: {get_param: ams_default_squid_port}
ams_number_of_wn_instances: {get_param: number_of_wn_instances}
ams_number_of_slaves: {get_param: number_of_slaves}
ams_cpu_x_wn: {get_param: cpu_x_wn}
ams_ram_x_wn: {get_param: ram_x_wn}
ams_docker_cpu_x_wn: {get_param: docker_cpu_x_wn}
ams_docker_ram_x_wn: {get_param: docker_ram_x_wn}
mesos_masters:
type: OS::Heat::ResourceGroup
properties:
count: {get_param: number_of_masters}
resource_def:
type: https://raw.githubusercontent.com/Cloud-PG/mesos-condor-ams-cluster/master/heat-templates/mesosnode.yaml
properties:
server_name: mesos-m%index%
ssh_key_name: {get_param: ssh_key_name}
server_image: {get_param: server_image}
server_flavor: {get_param: master_flavor}
availability_zone: {get_param: availability_zone}
network: {get_param: network}
security_groups:
- {get_resource: secgroup_base}
- {get_resource: secgroup_mesos}
######################################################################
#
# Mesos slaves. This is a resource group that will initially
# create <number_of_slaves> slaves, and needs to be manually scaled.
#
slave_setup_deployment:
type: OS::Heat::SoftwareDeployments
properties:
config: {get_resource: ansible_setup_config}
servers: {get_attr: [mesos_slaves, attributes, mesos_server_id]}
input_values:
role_list: "docker,consul,mesos,htcondor_config,ams_config"
#,gateway_config"
slave_config:
type: OS::Heat::SoftwareConfig
properties:
group: ansible
inputs:
- name: zookeeper_peers
type: CommaDelimitedList
- name: consul_servers
type: CommaDelimitedList
- name: mesos_masters_list
- name: htcondor_config_schedd_ip
- name: ams_use_local_squid
- name: ams_default_squid
- name: ams_default_squid_port
- name: ams_repo_server_url
- name: ams_repo_public_key_path
- name: ams_repo_http_proxy
- name: ams_repo_repository_name
- name: ams_repo_public_key
- name: ams_repo_public_key_url
config: |
---
- hosts: localhost
vars:
docker_bridge_ip: "172.0.17.1"
connection: local
pre_tasks:
- name: Fix /etc/hosts
lineinfile: dest=/etc/hosts regexp='^127\.0\.1\.1' line="{{ ansible_default_ipv4.address }}\t{{ansible_fqdn}} {{ ansible_hostname }}"
- name: Update /etc/hosts
lineinfile: dest=/etc/hosts line="{{ ansible_default_ipv4.address }}\t{{ansible_fqdn}} {{ ansible_hostname }}"
roles:
- { role: indigo-dc.consul, consul_mode: "agent", consul_bootstrap: 0 }
- { role: indigo-dc.mesos, mesos_install_mode: "slave" }
- { role: indigo-dc.ams_config, ams_config_node: "wn" }
# - { role: Cloud-PG.gateway_config, availability_zone: {get_param: availability_zone} }
slave_deployment:
type: OS::Heat::SoftwareDeployments
depends_on:
- slave_setup_deployment
properties:
config: {get_resource: slave_config}
servers: {get_attr: [mesos_slaves, attributes, mesos_server_id]}
input_values:
htcondor_config_schedd_ip: {get_attr: [mesos_slaveschedd, resource.0, mesos_server_ip]}
mesos_masters_list: {get_attr: [mesos_masters, mesos_server_ip]}
zookeeper_peers: {get_attr: [mesos_masters, mesos_server_ip]}
consul_servers: {get_attr: [mesos_masters, mesos_server_ip]}
ams_use_local_squid: {get_param: ams_use_local_squid}
ams_default_squid: {get_param: ams_default_squid}
ams_default_squid_port: {get_param: ams_default_squid_port}
ams_repo_server_url: {get_param: ams_repo_server_url}
ams_repo_public_key_path: {get_param: ams_repo_public_key_path}
ams_repo_http_proxy: {get_param: ams_repo_http_proxy}
ams_repo_repository_name: {get_param: ams_repo_repository_name}
ams_repo_public_key: {get_param: ams_repo_public_key}
ams_repo_public_key_url: {get_param: ams_repo_public_key_url}
mesos_slaves:
type: OS::Heat::ResourceGroup
properties:
count: {get_param: number_of_slaves}
resource_def:
type: https://raw.githubusercontent.com/Cloud-PG/mesos-condor-ams-cluster/master/heat-templates/mesosnode.yaml
properties:
server_name: mesos-s%index%
ssh_key_name: {get_param: ssh_key_name}
server_image: {get_param: server_image}
server_flavor: {get_param: slave_flavor}
availability_zone: {get_param: availability_zone}
network: {get_param: network}
security_groups:
- {get_resource: secgroup_base}
- {get_resource: secgroup_slaves}
- {get_resource: secgroup_condor}
########## Slave for the condor schedd
slaveschedd_setup_deployment:
type: OS::Heat::SoftwareDeployments
properties:
config: {get_resource: ansible_setup_config}
servers: {get_attr: [mesos_slaveschedd, attributes, mesos_server_id]}
input_values:
role_list: "docker,consul,mesos,htcondor_config,ams_config"
#,gateway_config"
slaveschedd_config:
type: OS::Heat::SoftwareConfig
properties:
group: ansible
inputs:
- name: zookeeper_peers
type: CommaDelimitedList
- name: consul_servers
type: CommaDelimitedList
- name: htcondor_config_schedd_ip
- name: mesos_masters_list
- name: ams_use_local_squid
- name: ams_default_squid
- name: ams_default_squid_port
- name: ams_repo_server_url
- name: ams_repo_public_key_path
- name: ams_repo_http_proxy
- name: ams_repo_repository_name
- name: ams_repo_public_key
- name: ams_repo_public_key_url
config: |
---
- hosts: localhost
vars:
docker_bridge_ip: "172.0.17.1"
connection: local
pre_tasks:
- name: Fix /etc/hosts
lineinfile: dest=/etc/hosts regexp='^127\.0\.1\.1' line="{{ ansible_default_ipv4.address }}\t{{ansible_fqdn}} {{ ansible_hostname }}"
- name: Update /etc/hosts
lineinfile: dest=/etc/hosts line="{{ ansible_default_ipv4.address }}\t{{ansible_fqdn}} {{ ansible_hostname }}"
roles:
- { role: indigo-dc.consul, consul_mode: "agent", consul_bootstrap: 0 }
- { role: indigo-dc.mesos, mesos_install_mode: "slave" }
- { role: indigo-dc.ams_config, ams_config_node: "wn" }
# - { role: Cloud-PG.gateway_config, availability_zone: {get_param: availability_zone} }
slaveschedd_deployment:
type: OS::Heat::SoftwareDeployments
depends_on:
- slaveschedd_setup_deployment
properties:
config: {get_resource: slaveschedd_config}
servers: {get_attr: [mesos_slaveschedd, attributes, mesos_server_id]}
input_values:
zookeeper_peers: {get_attr: [mesos_masters, mesos_server_ip]}
consul_servers: {get_attr: [mesos_masters, mesos_server_ip]}
htcondor_config_schedd_ip: {get_attr: [mesos_slaveschedd, resource.0, mesos_server_ip]}
mesos_masters_list: {get_attr: [mesos_masters, mesos_server_ip]}
ams_use_local_squid: {get_param: ams_use_local_squid}
ams_default_squid: {get_param: ams_default_squid}
ams_default_squid_port: {get_param: ams_default_squid_port}
ams_repo_server_url: {get_param: ams_repo_server_url}
ams_repo_public_key_path: {get_param: ams_repo_public_key_path}
ams_repo_http_proxy: {get_param: ams_repo_http_proxy}
ams_repo_repository_name: {get_param: ams_repo_repository_name}
ams_repo_public_key: {get_param: ams_repo_public_key}
ams_repo_public_key_url: {get_param: ams_repo_public_key_url}
mesos_slaveschedd:
type: OS::Heat::ResourceGroup
properties:
resource_def:
type: https://raw.githubusercontent.com/Cloud-PG/mesos-condor-ams-cluster/master/heat-templates/mesosscheddnode.yaml
properties:
server_name: mesos-condor-schedd
ssh_key_name: {get_param: ssh_key_name}
server_image: {get_param: server_image}
server_flavor: {get_param: slave_flavor}
availability_zone: {get_param: availability_zone}
network: {get_param: network}
security_groups:
- {get_resource: secgroup_base}
- {get_resource: secgroup_slaves}
- {get_resource: secgroup_condor}
- {get_resource: secgroup_schedd}
outputs:
mesos_master_ips:
value: {get_attr: [mesos_masters, mesos_server_ip]}
description: >
This is a list of the addresses of all the Mesos masters.
mesos_slaves_ips:
value: {get_attr: [mesos_slaves, mesos_server_ip]}
description: >
This is a list of the addresses of all the Mesos slaves
loadbalancers_vip:
value: {get_attr: [vip_port, fixed_ips, 0, ip_address]}
description: >
This is the Load Balancers Virtual IP
cluster_endpoints:
description: Cluster endpoints
value:
"Mesos":
str_replace:
params:
host: { get_attr: [ mesos_masters, resource.0, mesos_server_ip ] }
template: "http://host:5050"
"Marathon":
str_replace:
params:
host: { get_attr: [ mesos_masters, resource.0, mesos_server_ip ] }
template: "https://host:8443"
"Chronos":
str_replace:
params:
host: { get_attr: [ mesos_masters, resource.0, mesos_server_ip ] }
template: "https://host:4443"