blob: d4a97f4ce8ed4531d8cac18309e2497bec9980f7 [file] [log] [blame]
Fatih Degirmencied945712020-01-12 15:07:51 +00001---
2# ============LICENSE_START=======================================================
3# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19
20heat_template_version: pike
21
22description: Kubespray cluster template to deploy ONAP
23
24parameters:
25 # parameteres for jumphost instance
26 jumphost_image:
27 type: string
28 label: Image name or ID
29 description: Image to use for jumphost instance
30
31 jumphost_flavor:
32 type: string
33 label: Flavor
34 description: Flavor to use for jumphost instance
35
36 jumphost_volume_size:
37 type: string
38 label: Volume size of the jumphost
39 description: Size of the volume
40 default: 0
41
42 # parameters for master instances
43 no_of_master_nodes:
44 type: number
45 label: No of k8s master nodes
46 description: Number of master nodes in cluster
47
48 master_image:
49 type: string
50 label: Image name or ID
51 description: Image to use for master instances
52
53 master_flavor:
54 type: string
55 label: Flavor
56 description: Flavor to use for master instances
57
58 master_volume_size:
59 type: string
60 label: Volume size of the master nodes
61 description: Size of the volume
62 default: 0
63
64 # parameters for worker instances
65 no_of_worker_nodes:
66 type: number
67 label: No of k8s worker nodes
68 description: Number of worker nodes in cluster
69
70 worker_image:
71 type: string
72 label: Image name or ID
73 description: Image to use for worker instances
74
75 worker_flavor:
76 type: string
77 label: Flavor
78 description: Flavor to use for worker instances
79
80 worker_volume_size:
81 type: string
82 label: Volume size of the worker nodes
83 description: Size of the volume
84 default: 0
85
86 # common parameters
87 keypair:
88 type: string
89 label: Key name
90 description: Keypair to use for instances
91
92 public_network:
93 type: string
94 label: Public Network
95 description: Public network
96
97 dns_nameservers:
98 type: comma_delimited_list
99 label: DNS nameservers
100 description: DNS nameservers
101
102 use_tenant_network:
103 type: boolean
104 label: Use private tenant network or not
105 description: Use private tenant network or public flat
106 default: true
107
108conditions:
109 use_private_network: {equals: [{get_param: use_tenant_network}, true]}
110
111resources:
112 # create external security group
113 external_security_group:
114 type: OS::Neutron::SecurityGroup
115 properties:
116 name:
117 list_join: ['.', ['external-sg', {get_param: 'OS::stack_name'}]]
118 description: |
119 Security Group to place jumphost in
120 rules: [
121 {
122 remote_ip_prefix: 0.0.0.0/0,
123 protocol: tcp,
124 port_range_min: 22,
125 port_range_max: 22
126 }
127 ]
128
129 # create internal security group
130 internal_security_group:
131 type: OS::Neutron::SecurityGroup
132 properties:
133 name:
134 list_join: ['.', ['internal-sg', {get_param: 'OS::stack_name'}]]
135 description: |
136 Security Group to place jumphost and cluster instances in
137 rules: [
138 {
139 remote_ip_prefix: 0.0.0.0/0,
140 direction: ingress,
141 protocol: icmp
142 }
143 ]
144
145 # create tcp security group rule for internal_security_group
146 internal_security_group_rule_tcp:
147 type: OS::Neutron::SecurityGroupRule
148 properties:
149 security_group: {get_resource: internal_security_group}
150 remote_group: {get_resource: internal_security_group}
151 direction: ingress
152 protocol: tcp
153
154 # create udp security group rule for internal_security_group
155 internal_security_group_rule_udp:
156 type: OS::Neutron::SecurityGroupRule
157 properties:
158 security_group: {get_resource: internal_security_group}
159 remote_group: {get_resource: internal_security_group}
160 direction: ingress
161 protocol: udp
162
163 # create private network subnet
164 private_network:
165 type: OS::Neutron::Net
166 properties:
167 name:
168 list_join: ['.', ['network', {get_param: 'OS::stack_name'}]]
169
170 private_subnet:
171 type: OS::Neutron::Subnet
172 properties:
173 name:
174 list_join: ['.', ['subnet', {get_param: 'OS::stack_name'}]]
175 network_id: {get_resource: private_network}
176 cidr: 10.1.0.0/24
177 dns_nameservers: {get_param: dns_nameservers}
178
179 router:
180 type: OS::Neutron::Router
181 properties:
182 name:
183 list_join: ['.', ['router', {get_param: 'OS::stack_name'}]]
184 external_gateway_info:
185 network: {get_param: public_network}
186
187 router_interface:
188 type: OS::Neutron::RouterInterface
189 properties:
190 router_id: {get_resource: router}
191 subnet: {get_resource: private_subnet}
192
193 # create jumphost
194 jumphost:
195 type: OS::Heat::ResourceGroup
196 properties:
197 resource_def:
198 type: heat-jumphost.yaml
199 properties:
200 instance_name:
201 list_join: ['.', ['jumphost', {get_param: 'OS::stack_name'}]]
202 image: {get_param: jumphost_image}
203 flavor: {get_param: jumphost_flavor}
204 volume_size: {get_param: jumphost_volume_size}
205 keypair: {get_param: keypair}
206 private_network: {get_resource: private_network}
207 public_network: {get_param: public_network}
208 internal_security_group: {get_resource: internal_security_group}
209 external_security_group: {get_resource: external_security_group}
210 depends_on:
211 - router_interface
212
213 # create master nodes
214 master_nodes:
215 type: OS::Heat::ResourceGroup
216 properties:
217 count: {get_param: no_of_master_nodes}
218 resource_def:
219 type: heat-server.yaml
220 properties:
221 instance_name:
222 list_join: ['.', ['master%index%', {get_param: 'OS::stack_name'}]]
223 image: {get_param: master_image}
224 flavor: {get_param: master_flavor}
225 volume_size: {get_param: master_volume_size}
226 keypair: {get_param: keypair}
227 private_network: {get_resource: private_network}
228 public_network: {get_param: public_network}
229 internal_security_group: {get_resource: internal_security_group}
230 external_security_group: {get_resource: external_security_group}
231 use_network: {if: ["use_private_network", "private", "public"]}
232
233 # create worker nodes
234 worker_nodes:
235 type: OS::Heat::ResourceGroup
236 properties:
237 count: {get_param: no_of_worker_nodes}
238 resource_def:
239 type: heat-server.yaml
240 properties:
241 instance_name:
242 list_join: ['.', ['worker%index%', {get_param: 'OS::stack_name'}]]
243 image: {get_param: worker_image}
244 flavor: {get_param: worker_flavor}
245 volume_size: {get_param: worker_volume_size}
246 keypair: {get_param: keypair}
247 private_network: {get_resource: private_network}
248 public_network: {get_param: public_network}
249 internal_security_group: {get_resource: internal_security_group}
250 external_security_group: {get_resource: external_security_group}
251 use_network: {if: ["use_private_network", "private", "public"]}
252
253
254outputs:
Fatih Degirmenci8c7e23c2020-03-03 10:24:02 +0000255 jumphost_public_ip:
256 value: {get_attr: [jumphost, instance_public_ip]}
257 jumphost_private_ip:
258 value: {get_attr: [jumphost, instance_private_ip]}
259 master_private_ip:
260 value: {get_attr: [master_nodes, instance_private_ip]}
261 worker_private_ip:
262 value: {get_attr: [worker_nodes, instance_private_ip]}
Fatih Degirmencied945712020-01-12 15:07:51 +0000263
264# vim: set ts=2 sw=2 expandtab: