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
|
heat_template_version: 2014-10-16
description: OpenShift cluster
parameters:
cluster_env:
type: string
label: Cluster environment
description: Environment of the cluster
cluster_id:
type: string
label: Cluster ID
description: Identifier of the cluster
subnet_24_prefix:
type: string
label: subnet /24 prefix
description: /24 subnet prefix of the network of the cluster (dot separated number triplet)
dns_nameservers:
type: comma_delimited_list
label: DNS nameservers list
description: List of DNS nameservers
external_net:
type: string
label: External network
description: Name of the external network
default: external
ssh_public_key:
type: string
label: SSH public key
description: SSH public key
hidden: true
ssh_incoming:
type: string
label: Source of ssh connections
description: Source of legitimate ssh connections
default: 0.0.0.0/0
num_etcd:
type: number
label: Number of etcd nodes
description: Number of etcd nodes
num_masters:
type: number
label: Number of masters
description: Number of masters
num_nodes:
type: number
label: Number of compute nodes
description: Number of compute nodes
num_infra:
type: number
label: Number of infrastructure nodes
description: Number of infrastructure nodes
etcd_image:
type: string
label: Etcd image
description: Name of the image for the etcd servers
master_image:
type: string
label: Master image
description: Name of the image for the master servers
node_image:
type: string
label: Node image
description: Name of the image for the compute node servers
infra_image:
type: string
label: Infra image
description: Name of the image for the infra node servers
dns_image:
type: string
label: DNS image
description: Name of the image for the DNS server
etcd_flavor:
type: string
label: Etcd flavor
description: Flavor of the etcd servers
master_flavor:
type: string
label: Master flavor
description: Flavor of the master servers
node_flavor:
type: string
label: Node flavor
description: Flavor of the compute node servers
infra_flavor:
type: string
label: Infra flavor
description: Flavor of the infra node servers
dns_flavor:
type: string
label: DNS flavor
description: Flavor of the DNS server
outputs:
etcd_names:
description: Name of the etcds
value: { get_attr: [ etcd, name ] }
etcd_ips:
description: IPs of the etcds
value: { get_attr: [ etcd, private_ip ] }
etcd_floating_ips:
description: Floating IPs of the etcds
value: { get_attr: [ etcd, floating_ip ] }
master_names:
description: Name of the masters
value: { get_attr: [ masters, name ] }
master_ips:
description: IPs of the masters
value: { get_attr: [ masters, private_ip ] }
master_floating_ips:
description: Floating IPs of the masters
value: { get_attr: [ masters, floating_ip ] }
node_names:
description: Name of the nodes
value: { get_attr: [ compute_nodes, name ] }
node_ips:
description: IPs of the nodes
value: { get_attr: [ compute_nodes, private_ip ] }
node_floating_ips:
description: Floating IPs of the nodes
value: { get_attr: [ compute_nodes, floating_ip ] }
infra_names:
description: Name of the nodes
value: { get_attr: [ infra_nodes, name ] }
infra_ips:
description: IPs of the nodes
value: { get_attr: [ infra_nodes, private_ip ] }
infra_floating_ips:
description: Floating IPs of the nodes
value: { get_attr: [ infra_nodes, floating_ip ] }
dns_name:
description: Name of the DNS
value:
get_attr:
- dns
- name
dns_floating_ip:
description: Floating IP of the DNS
value:
get_attr:
- dns
- addresses
- str_replace:
template: openshift-ansible-cluster_id-net
params:
cluster_id: { get_param: cluster_id }
- 1
- addr
resources:
net:
type: OS::Neutron::Net
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-net
params:
cluster_id: { get_param: cluster_id }
subnet:
type: OS::Neutron::Subnet
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-subnet
params:
cluster_id: { get_param: cluster_id }
network: { get_resource: net }
cidr:
str_replace:
template: subnet_24_prefix.0/24
params:
subnet_24_prefix: { get_param: subnet_24_prefix }
allocation_pools:
- start:
str_replace:
template: subnet_24_prefix.3
params:
subnet_24_prefix: { get_param: subnet_24_prefix }
end:
str_replace:
template: subnet_24_prefix.254
params:
subnet_24_prefix: { get_param: subnet_24_prefix }
dns_nameservers:
- str_replace:
template: subnet_24_prefix.2
params:
subnet_24_prefix: { get_param: subnet_24_prefix }
router:
type: OS::Neutron::Router
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-router
params:
cluster_id: { get_param: cluster_id }
external_gateway_info:
network: { get_param: external_net }
interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router }
subnet_id: { get_resource: subnet }
keypair:
type: OS::Nova::KeyPair
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-keypair
params:
cluster_id: { get_param: cluster_id }
public_key: { get_param: ssh_public_key }
master-secgrp:
type: OS::Neutron::SecurityGroup
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-master-secgrp
params:
cluster_id: { get_param: cluster_id }
description:
str_replace:
template: Security group for cluster_id OpenShift cluster master
params:
cluster_id: { get_param: cluster_id }
rules:
- direction: ingress
protocol: tcp
port_range_min: 22
port_range_max: 22
remote_ip_prefix: { get_param: ssh_incoming }
- direction: ingress
protocol: tcp
port_range_min: 4001
port_range_max: 4001
- direction: ingress
protocol: tcp
port_range_min: 8443
port_range_max: 8443
- direction: ingress
protocol: tcp
port_range_min: 53
port_range_max: 53
- direction: ingress
protocol: udp
port_range_min: 53
port_range_max: 53
- direction: ingress
protocol: tcp
port_range_min: 24224
port_range_max: 24224
- direction: ingress
protocol: udp
port_range_min: 24224
port_range_max: 24224
etcd-secgrp:
type: OS::Neutron::SecurityGroup
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-etcd-secgrp
params:
cluster_id: { get_param: cluster_id }
description:
str_replace:
template: Security group for cluster_id etcd cluster
params:
cluster_id: { get_param: cluster_id }
rules:
- direction: ingress
protocol: tcp
port_range_min: 22
port_range_max: 22
remote_ip_prefix: { get_param: ssh_incoming }
- direction: ingress
protocol: tcp
port_range_min: 2379
port_range_max: 2379
remote_mode: remote_group_id
remote_group_id: { get_resource: master-secgrp }
- direction: ingress
protocol: tcp
port_range_min: 2380
port_range_max: 2380
remote_mode: remote_group_id
node-secgrp:
type: OS::Neutron::SecurityGroup
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-node-secgrp
params:
cluster_id: { get_param: cluster_id }
description:
str_replace:
template: Security group for cluster_id OpenShift cluster nodes
params:
cluster_id: { get_param: cluster_id }
rules:
- direction: ingress
protocol: tcp
port_range_min: 22
port_range_max: 22
remote_ip_prefix: { get_param: ssh_incoming }
- direction: ingress
protocol: tcp
port_range_min: 10250
port_range_max: 10250
remote_mode: remote_group_id
remote_group_id: { get_resource: master-secgrp }
- direction: ingress
protocol: udp
port_range_min: 4789
port_range_max: 4789
remote_mode: remote_group_id
infra-secgrp:
type: OS::Neutron::SecurityGroup
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-infra-secgrp
params:
cluster_id: { get_param: cluster_id }
description:
str_replace:
template: Security group for cluster_id OpenShift infrastructure cluster nodes
params:
cluster_id: { get_param: cluster_id }
rules:
- direction: ingress
protocol: tcp
port_range_min: 80
port_range_max: 80
- direction: ingress
protocol: tcp
port_range_min: 443
port_range_max: 443
dns-secgrp:
type: OS::Neutron::SecurityGroup
properties:
name:
str_replace:
template: openshift-ansible-cluster_id-dns-secgrp
params:
cluster_id: { get_param: cluster_id }
description:
str_replace:
template: Security group for cluster_id cluster DNS
params:
cluster_id: { get_param: cluster_id }
rules:
- direction: ingress
protocol: tcp
port_range_min: 22
port_range_max: 22
remote_ip_prefix: { get_param: ssh_incoming }
- direction: ingress
protocol: udp
port_range_min: 53
port_range_max: 53
remote_mode: remote_group_id
remote_group_id: { get_resource: etcd-secgrp }
- direction: ingress
protocol: udp
port_range_min: 53
port_range_max: 53
remote_mode: remote_group_id
remote_group_id: { get_resource: master-secgrp }
- direction: ingress
protocol: udp
port_range_min: 53
port_range_max: 53
remote_mode: remote_group_id
remote_group_id: { get_resource: node-secgrp }
etcd:
type: OS::Heat::ResourceGroup
properties:
count: { get_param: num_etcd }
resource_def:
type: heat_stack_server.yaml
properties:
name:
str_replace:
template: cluster_id-k8s_type-%index%
params:
cluster_id: { get_param: cluster_id }
k8s_type: etcd
cluster_env: { get_param: cluster_env }
cluster_id: { get_param: cluster_id }
type: etcd
image: { get_param: etcd_image }
flavor: { get_param: etcd_flavor }
key_name: { get_resource: keypair }
net: { get_resource: net }
subnet: { get_resource: subnet }
secgrp:
- { get_resource: etcd-secgrp }
floating_network: { get_param: external_net }
net_name:
str_replace:
template: openshift-ansible-cluster_id-net
params:
cluster_id: { get_param: cluster_id }
depends_on:
- interface
masters:
type: OS::Heat::ResourceGroup
properties:
count: { get_param: num_masters }
resource_def:
type: heat_stack_server.yaml
properties:
name:
str_replace:
template: cluster_id-k8s_type-%index%
params:
cluster_id: { get_param: cluster_id }
k8s_type: master
cluster_env: { get_param: cluster_env }
cluster_id: { get_param: cluster_id }
type: master
image: { get_param: master_image }
flavor: { get_param: master_flavor }
key_name: { get_resource: keypair }
net: { get_resource: net }
subnet: { get_resource: subnet }
secgrp:
- { get_resource: master-secgrp }
- { get_resource: node-secgrp }
floating_network: { get_param: external_net }
net_name:
str_replace:
template: openshift-ansible-cluster_id-net
params:
cluster_id: { get_param: cluster_id }
depends_on:
- interface
compute_nodes:
type: OS::Heat::ResourceGroup
properties:
count: { get_param: num_nodes }
resource_def:
type: heat_stack_server.yaml
properties:
name:
str_replace:
template: cluster_id-k8s_type-sub_host_type-%index%
params:
cluster_id: { get_param: cluster_id }
k8s_type: node
sub_host_type: compute
cluster_env: { get_param: cluster_env }
cluster_id: { get_param: cluster_id }
type: node
subtype: compute
image: { get_param: node_image }
flavor: { get_param: node_flavor }
key_name: { get_resource: keypair }
net: { get_resource: net }
subnet: { get_resource: subnet }
secgrp:
- { get_resource: node-secgrp }
floating_network: { get_param: external_net }
net_name:
str_replace:
template: openshift-ansible-cluster_id-net
params:
cluster_id: { get_param: cluster_id }
depends_on:
- interface
infra_nodes:
type: OS::Heat::ResourceGroup
properties:
count: { get_param: num_infra }
resource_def:
type: heat_stack_server.yaml
properties:
name:
str_replace:
template: cluster_id-k8s_type-sub_host_type-%index%
params:
cluster_id: { get_param: cluster_id }
k8s_type: node
sub_host_type: infra
cluster_env: { get_param: cluster_env }
cluster_id: { get_param: cluster_id }
type: node
subtype: infra
image: { get_param: infra_image }
flavor: { get_param: infra_flavor }
key_name: { get_resource: keypair }
net: { get_resource: net }
subnet: { get_resource: subnet }
secgrp:
- { get_resource: node-secgrp }
- { get_resource: infra-secgrp }
floating_network: { get_param: external_net }
net_name:
str_replace:
template: openshift-ansible-cluster_id-net
params:
cluster_id: { get_param: cluster_id }
depends_on:
- interface
dns:
type: OS::Nova::Server
properties:
name:
str_replace:
template: cluster_id-dns
params:
cluster_id: { get_param: cluster_id }
key_name: { get_resource: keypair }
image: { get_param: dns_image }
flavor: { get_param: dns_flavor }
networks:
- port: { get_resource: dns-port }
user_data: { get_resource: dns-config }
user_data_format: RAW
dns-port:
type: OS::Neutron::Port
properties:
network: { get_resource: net }
fixed_ips:
- subnet: { get_resource: subnet }
ip_address:
str_replace:
template: subnet_24_prefix.2
params:
subnet_24_prefix: { get_param: subnet_24_prefix }
security_groups:
- { get_resource: dns-secgrp }
dns-floating-ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: { get_param: external_net }
port_id: { get_resource: dns-port }
dns-config:
type: OS::Heat::MultipartMime
properties:
parts:
- config: { get_file: user-data }
- config:
str_replace:
template: |
#cloud-config
write_files:
- path: /etc/sudoers.d/00-openshift-no-requiretty
permissions: 440
content: |
Defaults:openshift !requiretty
- path: /etc/sysconfig/network-scripts/ifcfg-eth0
content: |
DEVICE="eth0"
BOOTPROTO="dhcp"
DNS1="$dns1"
DNS2="$dns2"
PEERDNS="no"
ONBOOT="yes"
runcmd:
- [ "/usr/bin/systemctl", "restart", "network" ]
params:
$dns1:
get_param:
- dns_nameservers
- 0
$dns2:
get_param:
- dns_nameservers
- 1
|