-
Notifications
You must be signed in to change notification settings - Fork 87
/
master.yaml
541 lines (476 loc) · 14.9 KB
/
master.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
heat_template_version: 2016-10-14
description: >
OpenShift Master
parameters:
# What version of OpenShift Container Platform to install
# This value is used to select the RPM repo for the OCP release to install
ocp_version:
type: string
description: >
The version of OpenShift Container Platform to deploy
key_name:
description: >
A pre-submitted SSH key to access the VM hosts
type: string
constraints:
- custom_constraint: nova.keypair
image:
description: >
Select a base image to use for the master servers
type: string
constraints:
- custom_constraint: glance.image
flavor:
description: >
Define the hardware characteristics for the VMs: CPU, Memory, base disk
type: string
constraints:
- custom_constraint: nova.flavor
docker_volume_size:
description: >
size of a cinder volume in GB to allocate to docker for container/image
storage
type: number
default: 25
rhn_username:
description: >
A valid user with entitlements to RHEL and OpenShift software repos
type: string
rhn_password:
description: >
The password for the RHN user
type: string
hidden: true
# Red Hat satellite subscription parameters
sat6_hostname:
type: string
description: >
The hostname of the Satellite 6 server which will provide software updates
default: ''
sat6_organization:
type: string
description: >
An organization string provided by Sat6 to group subscriptions
default: ''
sat6_activationkey:
type: string
description: >
An activation key string provided by Sat6 to enable subscriptions
default: ''
rhn_pool:
description: >
A subscription pool containing the RHEL and OpenShift software repos
OPTIONAL
type: string
hidden: true
extra_rhn_pools:
type: comma_delimited_list
description: List of rhn pools which will be installed on each node.
default: ''
hostname:
description: >
A string to identify master hostnames.
type: string
constraints:
- allowed_pattern: '[a-z0-9\-]*'
description: Hostname must contain only characters [a-z0-9\-].
domain_name:
description: >
The DNS domain suffix. All VMs will be placed in this domain
type: string
ansible_public_key:
description: >
The SSH public key that Ansible will use to access master and node hosts
This will be placed on each VM host in /root/.ssh/authorized_keys
type: string
ssh_user:
description: >
The user for SSH access to the VM hosts
type: string
timeout:
description: Time to wait until the master setup is ready.
type: number
default: 10800
external_network:
description: >
The name of the inbound access network
type: string
constraints:
- custom_constraint: neutron.network
bastion_node:
description: >
The hostname of the bastion node in the deployment
type: string
default: ''
fixed_network:
description: >
The name or ID of the admin and public network
type: string
constraints:
- custom_constraint: neutron.network
fixed_subnet:
description: >
The name or ID of the admin and public IPv4 space
type: string
constraints:
- custom_constraint: neutron.subnet
internal_network:
description: >
The name or ID of the internal network
type: string
constraints:
- custom_constraint: neutron.network
internal_subnet:
description: >
The name or ID of the internal IPv4 space
type: string
constraints:
- custom_constraint: neutron.subnet
ldap_url:
description: >
The LDAP url for access to the LDAP service (redundant? ML)
type: string
default: ''
ldap_preferred_username:
description: >
What field to use to look up and identify users in the database
type: string
default: 'uid'
ldap_bind_dn:
description: >
LDAP service access user identifier
type: string
default: ''
ldap_bind_password:
description: >
LDAP service access password
type: string
default: ''
ldap_ca:
description: >
The Certificate Authority file to confirm SSL encryption security
type: string
default: ''
ldap_insecure:
description: >
Toggle SSL encryption for LDAP communications
type: string
default: false
master_server_group:
description: >
ID of a server group containing all of the master hosts
type: string
master_security_group:
description: >
ID of the network access policies for the OpenShift master hosts
type: string
system_update:
type: boolean
extra_repository_urls:
type: comma_delimited_list
description: List of repository URLs which will be installed on each node.
default: ''
extra_docker_repository_urls:
type: comma_delimited_list
description: List of docker repository URLs which will be installed on each node, if a repo is insecure use '#insecure' suffix.
default: ''
dns_servers:
type: comma_delimited_list
description: address of dns nameservers reachable in your environment
dns_update_key:
type: string
hidden: true
ca_cert:
type: string
description: Certificate Authority Certificate to be added to trust chain
resources:
# Create a network connection on the internal communications network
port:
type: OS::Neutron::Port
properties:
security_groups:
- {get_param: master_security_group}
network: {get_param: fixed_network}
fixed_ips:
- subnet: {get_param: fixed_subnet}
replacement_policy: AUTO
# Create a network connection on the internal communications network
internal_port:
type: OOShift::ContainerPort
properties:
security_group: {get_param: master_security_group}
network: {get_param: internal_network}
subnet: {get_param: internal_subnet}
# Create the VM instance to host the OpenShift master service
host:
type: OS::Nova::Server
properties:
name:
str_replace:
template: "HOST.DOMAIN"
params:
HOST: {get_param: hostname}
DOMAIN: {get_param: domain_name}
admin_user: {get_param: ssh_user}
image: {get_param: image}
flavor: {get_param: flavor}
key_name: {get_param: key_name}
networks:
- port: {get_resource: port}
- port: {get_attr: [internal_port, port]}
user_data_format: SOFTWARE_CONFIG
user_data_update_policy: IGNORE
user_data: {get_resource: init}
scheduler_hints:
group: {get_param: master_server_group}
# Create space for Docker containers and images
docker_volume:
type: OS::Cinder::Volume
properties:
size: {get_param: docker_volume_size}
# Bind the docker storage to the VM
docker_volume_attach:
type: OS::Cinder::VolumeAttachment
properties:
instance_uuid: {get_resource: host}
volume_id: {get_resource: docker_volume}
# Provide access to the Master on the public network
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: external_network}
port_id: {get_resource: port}
# Compose configuration data into a single structure
init:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: set_hostname}
- config: {get_resource: included_files}
- config: {get_resource: update_ca_cert}
- config: {get_resource: rhn_register}
- config: {get_resource: set_extra_repos}
- config: {get_resource: set_extra_docker_repos}
- config: {get_resource: host_update}
- config: {get_resource: add_dns_record}
- config: {get_resource: master_boot}
# Compose the short hostname and fully qualified domain name for the new host
set_hostname:
type: OS::Heat::CloudConfig
properties:
cloud_config:
hostname: {get_param: hostname}
fqdn:
str_replace:
template: "HOST.DOMAIN"
params:
HOST: {get_param: hostname}
DOMAIN: {get_param: domain_name}
# Compile a set of standard configuration files to provide identity and access
included_files:
type: OS::Heat::CloudConfig
properties:
cloud_config:
write_files:
- path: /usr/local/share/openshift-on-openstack/common_functions.sh
permissions: 0755
content:
str_replace:
params:
$WC_NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] }
template: {get_file: fragments/common_functions.sh}
- path: /usr/local/share/openshift-on-openstack/common_openshift_functions.sh
permissions: 0755
content: {get_file: fragments/common_openshift_functions.sh}
- path: /usr/local/bin/retry
permissions: 0755
content: {get_file: fragments/retry.sh}
- path: /usr/local/bin/update_dns
permissions: 0755
content: {get_file: fragments/update_dns.py}
- path: /etc/sysconfig/network-scripts/ifcfg-eth1
content:
str_replace:
params:
$IFNAME: eth1
template: {get_file: fragments/ifcfg-eth}
- path: /etc/pki/ca-trust/source/anchors/ca.crt
permissions: 0600
content: {get_param: ca_cert}
ssh_authorized_keys:
- {get_param: ansible_public_key}
# Add CA Cert to trust chain
update_ca_cert:
type: OS::Heat::SoftwareConfig
properties:
config: {get_file: fragments/ca_cert.sh}
# Attach to a source of software updates for RHEL
rhn_register:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params:
$OCP_VERSION: {get_param: ocp_version}
$RHN_USERNAME: {get_param: rhn_username}
$RHN_PASSWORD: {get_param: rhn_password}
$SAT6_HOSTNAME: {get_param: sat6_hostname}
$SAT6_ORGANIZATION: {get_param: sat6_organization}
$SAT6_ACTIVATIONKEY: {get_param: sat6_activationkey}
$POOL_ID: {get_param: rhn_pool}
$EXTRA_POOL_IDS:
list_join:
- " --pool="
- {get_param: extra_rhn_pools}
template: {get_file: fragments/rhn-register.sh}
# Enable any extra repositories
set_extra_repos:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params:
$REPOLIST:
list_join:
- " "
- {get_param: extra_repository_urls}
template: {get_file: fragments/set-extra-repos.sh}
set_extra_docker_repos:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params:
$REPOLIST:
list_join:
- " "
- {get_param: extra_docker_repository_urls}
template: {get_file: fragments/set-extra-docker-repos.sh}
# Insure that the host software is current
host_update:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params:
$SYSTEM_UPDATE: {get_param: system_update}
template: {get_file: fragments/host-update.sh}
add_dns_record:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params:
'%ZONE%': {get_param: domain_name}
'%DNS_SERVER%': {get_param: [dns_servers, 0]}
'%DNS_UPDATE_KEY%': {get_param: dns_update_key}
'%IP_ADDRESS%': {get_attr: [port, fixed_ips, 0, ip_address]}
template: {get_file: fragments/add_dns_record.sh}
# Prepare the host to run Docker and Ansible for OpenShift install and config
master_boot:
type: OS::Heat::SoftwareConfig
properties:
group: script
config:
str_replace:
params:
$DOCKER_VOLUME_ID: {get_resource: docker_volume}
template: {get_file: fragments/master-boot.sh}
# Add a node's IP/Name mapping to DNS
node_add:
type: OS::Heat::SoftwareConfig
properties:
group: script
inputs:
- name: node_hostname
- name: node_type
outputs:
- name: result
config: {get_file: fragments/bastion-node-add.sh}
# Add the hostname and address of the bastion host to the master host
deployment_bastion_node_add:
depends_on: wait_condition
type: OS::Heat::SoftwareDeployment
properties:
config:
get_resource: node_add
server:
get_param: bastion_node
input_values:
node_type: master
node_hostname:
str_replace:
template: "HOST.DOMAIN"
params:
HOST: {get_param: hostname}
DOMAIN: {get_param: domain_name}
node_cleanup:
type: OS::Heat::SoftwareConfig
properties:
group: script
inputs:
- name: node_name
- name: node_type
- name: ssh_user
default: {get_param: ssh_user}
outputs:
- name: result
config: {get_file: fragments/bastion-node-cleanup.sh}
# activation hook for removing the node from DNS and from the Kubernetes
# cluster
deployment_bastion_node_cleanup:
depends_on: [host, wait_condition]
type: OS::Heat::SoftwareDeployment
properties:
actions: ['DELETE']
input_values:
node_type: master
node_name:
str_replace:
template: "HOST.DOMAIN"
params:
HOST: {get_param: hostname}
DOMAIN: {get_param: domain_name}
config:
get_resource: node_cleanup
server:
get_param: bastion_node
# Wait for master_boot (cloud-init) to complete or time out
wait_condition:
type: OS::Heat::WaitCondition
properties:
handle: {get_resource: wait_handle}
timeout: {get_param: timeout}
# This provides a curl CLI string to the cloud-init script which is queried
# with a status at the end of of the cloud-init process
wait_handle:
type: OS::Heat::WaitConditionHandle
outputs:
console_url:
description: Compose the access URL for the OpenShift web UI
value:
str_replace:
params:
HOSTNAME: {get_param: hostname}
DOMAINNAME: {get_param: domain_name}
template: "https://HOSTNAME.DOMAINNAME:8443/console/"
api_url:
description: Compose the access URL for the OpenShift REST API
value:
str_replace:
params:
HOSTNAME: {get_param: hostname}
DOMAINNAME: {get_param: domain_name}
template: "https://HOSTNAME.DOMAINNAME:8443/"
wc_data:
description: Syncronization data
value: { get_attr: ['wait_condition', 'data'] }
hostname:
description: The actual short name for the host
value: {get_param: hostname}
host:
description: A reference to the master host identifier
value: {get_resource: host}
ip_address:
description: IP address of the node
value: {get_attr: [floating_ip, floating_ip_address]}