forked from redhat-openstack/openshift-on-openstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.yaml
383 lines (334 loc) · 9.76 KB
/
node.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
heat_template_version: 2014-10-16
description: >
OpenShift Node
parameters:
key_name:
type: string
constraints:
- custom_constraint: nova.keypair
image:
type: string
constraints:
- custom_constraint: glance.image
flavor:
type: string
constraints:
- custom_constraint: nova.flavor
external_network:
type: string
constraints:
- custom_constraint: neutron.network
fixed_network:
type: string
constraints:
- custom_constraint: neutron.network
fixed_subnet:
type: string
constraints:
- custom_constraint: neutron.subnet
dns_ip:
type: string
description: IP address of the DNS server
docker_volume_size:
type: number
description: >
size of a cinder volume in GB to allocate to docker for container/image
storage
default: 25
rhn_username:
type: string
rhn_password:
type: string
hidden: true
rhn_pool:
type: string
hidden: true
hostname_prefix:
type: string
domain_name:
type: string
ansible_public_key:
type: string
ssh_user:
type: string
master_node:
type: string
default: ''
all_master_nodes:
type: string
default: ''
master_run_ansible:
type: string
default: ''
infra_node:
type: string
default: ''
infra_node_add:
type: string
default: ''
infra_node_cleanup:
type: string
default: ''
timeout:
description: Time to wait until the master setup is ready.
type: number
default: 4000
metadata:
type: json
resources:
random_hostname_suffix:
type: OS::Heat::RandomString
properties:
character_classes: [{"class": lowercase}, {"class": digits}]
length: 8
host:
type: OS::Nova::Server
properties:
name:
str_replace:
template: "HOST-SUFFIX.DOMAIN"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
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}
user_data_format: SOFTWARE_CONFIG
user_data: {get_resource: init}
metadata: {get_param: metadata}
docker_volume:
type: OS::Cinder::Volume
properties:
size: {get_param: docker_volume_size}
docker_volume_attach:
type: OS::Cinder::VolumeAttachment
properties:
instance_uuid: {get_resource: host}
volume_id: {get_resource: docker_volume}
init:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: set_hostname}
- config: {get_resource: included_files}
- config: {get_resource: rhn_register}
- config: {get_resource: host_update}
- config: {get_resource: node_boot}
set_hostname:
type: OS::Heat::CloudConfig
properties:
cloud_config:
hostname:
str_replace:
template: "HOST-SUFFIX"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
fqdn:
str_replace:
template: "HOST-SUFFIX.DOMAIN"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
DOMAIN: {get_param: domain_name}
included_files:
type: OS::Heat::CloudConfig
properties:
cloud_config:
write_files:
- path: /etc/hosts
content:
str_replace:
params:
$NODE_IP: {get_attr: [floating_ip, floating_ip_address]}
$NODE_HOSTNAME:
str_replace:
template: "HOST-SUFFIX"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
$NODE_DOMAIN: {get_param: domain_name}
template: {get_file: fragments/etc-node-hosts}
- path: /usr/local/bin/retry
permissions: 0755
content: {get_file: fragments/retry.sh}
ssh_authorized_keys:
- {get_param: ansible_public_key}
rhn_register:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params:
$RHN_USERNAME: {get_param: rhn_username}
$RHN_PASSWORD: {get_param: rhn_password}
$POOL_ID: {get_param: rhn_pool}
template: {get_file: fragments/rhn-register.sh}
host_update:
type: OS::Heat::SoftwareConfig
properties:
config:
get_file: fragments/host-update.sh
node_boot:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params:
$DNS_IP: {get_param: dns_ip}
$WC_NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] }
template: {get_file: fragments/node-boot.sh}
port:
type: OS::Neutron::Port
properties:
security_groups:
- {get_resource: security_group}
network: {get_param: fixed_network}
fixed_ips:
- subnet: {get_param: fixed_subnet}
replacement_policy: AUTO
security_group:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: icmp
# Just open everything for now:
- protocol: tcp
port_range_min: 0
port_range_max: 65535
- protocol: udp
port_range_min: 0
port_range_max: 65535
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: external_network}
port_id: {get_resource: port}
master_node_cleanup:
type: OS::Heat::SoftwareConfig
properties:
group: script
inputs:
- name: node_name
outputs:
- name: result
config: |
#!/bin/bash -x
oc --config ~/.kube/config delete node "$node_name"
cp /var/lib/openshift_nodes /var/lib/openshift_nodes.bkp
grep -v "$node_name" /var/lib/openshift_nodes.bkp > /var/lib/openshift_nodes
echo "Deleted node $node_name"
deployment_master_node_cleanup:
type: OS::Heat::SoftwareDeployment
properties:
actions: ['DELETE']
input_values:
node_name:
str_replace:
template: "HOST-SUFFIX.DOMAIN"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
DOMAIN: {get_param: domain_name}
config:
get_resource: master_node_cleanup
server:
get_param: master_node
deployment_infra_node_cleanup:
type: OS::Heat::SoftwareDeployment
properties:
actions: ['DELETE']
input_values:
node_name:
str_replace:
template: "HOST-SUFFIX.DOMAIN"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
DOMAIN: {get_param: domain_name}
config:
get_param: infra_node_cleanup
server:
get_param: infra_node
deployment_infra_node_add:
type: OS::Heat::SoftwareDeployment
properties:
config:
get_param: infra_node_add
server:
get_param: infra_node
input_values:
node_etc_host:
str_replace:
template: "IP HOST-SUFFIX.DOMAIN HOST-SUFFIX #openshift"
params:
IP: {get_attr: [floating_ip, floating_ip_address]}
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
DOMAIN: {get_param: domain_name}
deployment_run_ansible:
depends_on: [wait_condition, deployment_infra_node_add]
type: OS::Heat::SoftwareDeployment
properties:
config:
get_param: master_run_ansible
server:
get_param: master_node
input_values:
node_hostname:
str_replace:
template: "HOST-SUFFIX.DOMAIN"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
DOMAIN: {get_param: domain_name}
all_master_nodes: {get_param: all_master_nodes}
wait_condition:
type: OS::Heat::WaitCondition
properties:
handle: {get_resource: wait_handle}
timeout: {get_param: timeout}
wait_handle:
type: OS::Heat::WaitConditionHandle
outputs:
hostname:
description: Hostname of this OpenShift node
value:
str_replace:
template: "HOST-SUFFIX.DOMAIN"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
DOMAIN: {get_param: domain_name}
ansible_entry:
description: Ansible inventory line for this OpenShift node
value:
str_replace:
template: "HOST-SUFFIX.DOMAIN openshift_hostname=HOST-SUFFIX.DOMAIN openshift_public_hostname=HOST-SUFFIX.DOMAIN"
params:
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
DOMAIN: {get_param: domain_name}
etc_hosts:
description: A hostname/IP entry for /etc/hosts
value:
str_replace:
template: "IP HOST-SUFFIX.DOMAIN HOST-SUFFIX #openshift"
params:
IP: {get_attr: [floating_ip, floating_ip_address]}
HOST: {get_param: hostname_prefix}
SUFFIX: {get_attr: [random_hostname_suffix, value]}
DOMAIN: {get_param: domain_name}
ip_address:
description: IP address of the node
value: {get_attr: [floating_ip, floating_ip_address]}
wc_data:
value: {get_attr: ['wait_condition', 'data']}
ca_cert:
value: {get_attr: [deployment_run_ansible, ca_cert]}
ca_key:
value: {get_attr: [deployment_run_ansible, ca_key]}