-
Notifications
You must be signed in to change notification settings - Fork 87
/
loadbalancer_dedicated.yaml
468 lines (411 loc) · 13 KB
/
loadbalancer_dedicated.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
heat_template_version: 2016-10-14
description: >
A template which provides a creates a loadbalancer using neutron's LBaaS.
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 bastion server
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
hostname:
description: >
The load balancer hostname portion of the FQDN
type: string
constraints:
- allowed_pattern: '[a-z0-9\-\.]*'
description: Hostname must contain only characters [a-z0-9\-\.].
domain_name:
description: >
All VMs will be placed in this domain
type: string
app_subdomain:
type: string
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
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: ''
ssh_user:
description: >
The user for SSH access to the VM hosts
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
fixed_subnet:
description: >
The name or ID of the internal IPv4 space
type: string
constraints:
- custom_constraint: neutron.subnet
members:
type: comma_delimited_list
master_hostname:
type: string
floatingip_id:
type: string
floatingip:
type: string
fixed_network:
description: >
The name or ID of the internal network
type: string
constraints:
- custom_constraint: neutron.network
fixed_subnet:
description: >
The name or ID of the internal IPv4 space
type: string
constraints:
- custom_constraint: neutron.subnet
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: ''
stack_name:
type: string
default: ''
# Delay openshift installation until the master is ready to accept
timeout:
description: Time to wait until the master setup is ready.
type: number
default: 4000
bastion_node:
type: string
description: >
The name or ID of an bastion instance.
default: ''
stack_name:
description: Top level stack name.
type: string
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:
floating_ip_assoc:
type: OS::Neutron::FloatingIPAssociation
properties:
port_id: {get_resource: port}
floatingip_id: {get_param: floatingip_id}
# bind the IP to the host with security port filters
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
# Define network access policy for access to the laod balancer
security_group:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: icmp
- protocol: tcp
port_range_min: 8443
port_range_max: 8443
- protocol: tcp
port_range_min: 443
port_range_max: 443
- protocol: tcp
port_range_min: 80
port_range_max: 80
- protocol: tcp
port_range_min: 22
port_range_max: 22
# The VM which will host the load balancer service
host:
type: OS::Nova::Server
properties:
name:
str_replace:
template: "%stack_name%-%hostname%.%domainname%"
params:
'%stack_name%': {get_param: stack_name}
'%hostname%': {get_param: hostname}
'%domainname%': {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_update_policy: IGNORE
user_data: {get_resource: init}
# Collect a set of host configuration information in 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: add_wildcard_record}
- config: {get_resource: lb_boot}
# Compose the FQDN and set the hostname in the cloud-init data structure
set_hostname:
type: OS::Heat::CloudConfig
properties:
cloud_config:
hostname:
str_replace:
template: "%stack_name%-%hostname%"
params:
'%stack_name%': {get_param: stack_name}
'%hostname%': {get_param: hostname}
fqdn:
str_replace:
template: "%stack_name%-%hostname%.%domainname%"
params:
'%stack_name%': {get_param: stack_name}
'%hostname%': {get_param: hostname}
'%domainname%': {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/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: /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: /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:
str_replace:
params:
$CA_CERT: {get_param: ca_cert}
template: {get_file: fragments/ca_cert.sh}
# Connect to a software source for updates on 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:
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_param: floatingip}
template: {get_file: fragments/add_dns_record.sh}
add_wildcard_record:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params:
'%DNS_ENTRY%': {list_join: ["", ["*.", {get_param: app_subdomain}]]}
'%ZONE%': {get_param: domain_name}
'%DNS_SERVER%': {get_param: [dns_servers, 0]}
'%DNS_UPDATE_KEY%': {get_param: dns_update_key}
'%IP_ADDRESS%': {get_param: floatingip}
template: {get_file: fragments/add_dns_record.sh}
# Prepare the host for SSH access for ansible
lb_boot:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
params: {}
template: {get_file: fragments/lb-boot.sh}
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: loadbalancer
node_name:
str_replace:
template: "%stack_name%-%hostname%.%domainname%"
params:
'%stack_name%': {get_param: stack_name}
'%hostname%': {get_param: hostname}
'%domainname%': {get_param: domain_name}
config:
get_resource: node_cleanup
server:
get_param: bastion_node
# Wait for the load balancer host to complete cloud-init or time out
wait_condition:
type: OS::Heat::WaitCondition
properties:
handle: {get_resource: wait_handle}
timeout: {get_param: timeout}
# Provide a curl CLI to the cloud-init script. On completion, notify Heat
wait_handle:
type: OS::Heat::WaitConditionHandle
outputs:
console_url:
description: URL of the OpenShift web console
value:
str_replace:
template: "https://%stack_name%-%hostname%.%domainname%:8443/console/"
params:
'%stack_name%': {get_param: stack_name}
'%hostname%': {get_param: hostname}
'%domainname%': {get_param: domain_name}
api_url:
description: URL entrypoint to the OpenShift API
value:
str_replace:
template: "https://%stack_name%-%hostname%.%domainname%:8443/"
params:
'%stack_name%': {get_param: stack_name}
'%hostname%': {get_param: hostname}
'%domainname%': {get_param: domain_name}
hostname:
description: Loadbalancer hostname
value:
str_replace:
template: "%stack_name%-%hostname%.%domainname%"
params:
'%stack_name%': {get_param: stack_name}
'%hostname%': {get_param: hostname}
'%domainname%': {get_param: domain_name}