forked from broskos/heat-scale-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-cluster.yaml
267 lines (221 loc) · 6.86 KB
/
build-cluster.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
heat_template_version: 2014-10-16
description: >
Deploy a head server and a scalable number of HPC worker nodes
parameters:
# Access to the VMs
ssh_user:
type: string
description: >
The SSH user available on all nodes.
default: 'cloud-user'
ssh_key_name:
type: string
description: Name of the SSH keypair registered with Nova
constraints:
- custom_constraint: nova.keypair
# VM characteristics
server_image:
type: string
description: Name or ID of the host image registered with Glance
constraints:
- custom_constraint: glance.image
flavor:
type: string
description: The Nova flavor to use for the nodes
default: m1.medium
constraints:
- custom_constraint: nova.flavor
timeout:
description: Time to wait until the setup is ready.
type: number
default: 600
# Networks to connect to or create
external_network:
type: string
description: >
The external network that provides floating IP addresses for the nodes
constraints:
- custom_constraint: neutron.network
internal_subnet:
type: string
description: >
The subnet used for node-node and node-master communication
default: 192.168.0.0/24
dns_nameserver:
type: comma_delimited_list
description: address of a dns nameserver reachable in your environment
default: 8.8.8.8
head_hostname:
type: string
description: >
The hostname that is going to be set for the dedicated head node.
default: 'head'
worker_node_hostname:
type: string
description: >
The hostname that is going to be set for the worker nodes.
default: "node"
# Node scaling parameters
autoscaling:
type: boolean
description: >
Automatically scale up/down worker nodes.
default: true
worker_node_count:
type: number
description: >
Number of worker nodes to create.
default: 3
worker_nodes_min:
type: number
description: >
Minimum number of worker nodes if autoscaling is enabled.
default: 1
worker_nodes_max:
type: number
description: >
Maximum number of worker nodes if autoscaling is enabled.
default: 10
# Internal and Auxiliary Services
# Red Hat subscription parameters
rhn_username:
type: string
description: >
The username for registering the hosts with RHN. If empty, they will not
be registered.
default: ''
rhn_password:
type: string
description: >
The password for registering the hosts with RHN. If empty, they will not
be registered.
hidden: true
default: ''
rhn_pool:
type: string
description: >
The pool to attach. Will use `subscription-manager attach --auto` if left
blank.
hidden: true
resources:
# Network Components
fixed_network:
type: OS::Neutron::Net
fixed_subnet:
type: OS::Neutron::Subnet
properties:
cidr: {get_param: internal_subnet}
network: {get_resource: fixed_network}
dns_nameservers: {get_param: dns_nameserver}
external_router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: {get_param: external_network}
external_router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: {get_resource: external_router}
subnet: {get_resource: fixed_subnet}
# VM Host definitions
head_node:
depends_on: external_router_interface
type: head.yaml
properties:
image: {get_param: server_image}
flavor: {get_param: flavor}
key_name: {get_param: ssh_key_name}
ssh_user: {get_param: ssh_user}
rhn_username: {get_param: rhn_username}
rhn_password: {get_param: rhn_password}
rhn_pool: {get_param: rhn_pool}
timeout: {get_param: timeout}
hostname:
str_replace:
template: "%stackname%-%hostname%"
params:
'%stackname%': {get_param: 'OS::stack_name'}
'%hostname%': {get_param: head_hostname}
port: {get_resource: head_port}
worker_nodes:
depends_on: external_router_interface
type: OS::Heat::AutoScalingGroup
properties:
desired_capacity: {get_param: worker_node_count}
min_size: {get_param: worker_nodes_min}
max_size: {get_param: worker_nodes_max}
resource:
type: worker.yaml
properties:
image: {get_param: server_image}
flavor: {get_param: flavor}
key_name: {get_param: ssh_key_name}
ssh_user: {get_param: ssh_user}
fixed_network: {get_resource: fixed_network}
fixed_subnet: {get_resource: fixed_subnet}
rhn_username: {get_param: rhn_username}
rhn_password: {get_param: rhn_password}
rhn_pool: {get_param: rhn_pool}
timeout: {get_param: timeout}
hostname:
str_replace:
template: "%stackname%-%hostname%"
params:
'%stackname%': {get_param: 'OS::stack_name'}
'%hostname%': {get_param: worker_node_hostname}
# Scaling and Operational Controls
scale_up_policy:
type: OS::Heat::ScalingPolicy
properties:
adjustment_type: change_in_capacity
auto_scaling_group_id: {get_resource: worker_nodes}
cooldown: 60
scaling_adjustment: 1
scale_down_policy:
type: OS::Heat::ScalingPolicy
properties:
adjustment_type: change_in_capacity
auto_scaling_group_id: {get_resource: worker_nodes}
cooldown: 60
scaling_adjustment: '-1'
head_port:
type: OS::Neutron::Port
properties:
security_groups:
- {get_resource: head_security_group}
network: {get_resource: fixed_network}
fixed_ips:
- subnet: {get_resource: fixed_subnet}
replacement_policy: AUTO
head_security_group:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: icmp
- protocol: tcp
port_range_min: 22
port_range_max: 22
head_floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: external_network}
port_id: {get_resource: head_port}
outputs:
head_ip:
description: IP address of the head server
value: {get_attr: [head_floating_ip, floating_ip_address]}
worker_ips:
description: IP addresses of the worker nodes
value: {get_attr: [worker_nodes, outputs_list, ip_address]}
scale_up_url:
description: >
This URL is the webhook to scale up the autoscaling group. You
can invoke the scale-up operation by doing an HTTP POST to this
URL; no body nor extra headers are needed.
value: {get_attr: [scale_up_policy, alarm_url]}
scale_dn_url:
description: >
This URL is the webhook to scale down the autoscaling group.
You can invoke the scale-down operation by doing an HTTP POST to
this URL; no body nor extra headers are needed.
value: {get_attr: [scale_down_policy, alarm_url]}