Merge "Remove the quotes of True value in yaml file"
[iec.git] / src / foundation / hot / k8s_slaves.yaml
1 # yamllint disable-line rule:document-start
2 heat_template_version: 2016-10-14
3
4 description: "K8 slaves VM"
5
6 parameters:
7   key_name:
8     type: string
9     description: management ssh key
10     default: 'ak-key'
11
12   k8s_slave0_hostname:
13     type: string
14     description: Hostname of the K8s slave0 node
15     default: "k8s-slave0"
16
17   k8s_slave1_hostname:
18     type: string
19     description: Hostname of the K8s slave0 node
20     default: "k8s-slave1"
21
22   k8s_mgmt_net:
23     type: string
24     description: management network
25     default: "k8s_mgmt_net"
26
27   k8s_int_net:
28     type: string
29     description: Kubernetes service network
30     default: "k8s_int_net"
31
32   k8s_master_ip:
33     type: string
34     description: k8s_master management IP (fixed)
35
36   k8s_slave0_ip:
37     type: string
38     description: k8s_master management IP (fixed)
39     default: "172.16.10.37"
40
41   k8s_slave1_ip:
42     type: string
43     description: k8s_master management IP (fixed)
44     default: "172.16.10.38"
45
46   k8s_pod_net_cidr:
47     type: string
48     description: k8 pod_net cidr used for setting up k8s cluster
49
50   k8s_svc_net_cidr:
51     type: string
52     description: k8 pod_net cidr used for setting up k8s cluster
53
54   k8s_cluster_ip:
55     type: string
56     description: k8 service IP addr used for setting up k8s cluster
57
58   k8s_user:
59     type: string
60     description: User id to connect to the VMs (ssh)
61     default: "ubuntu"
62
63   k8s_password:
64     type: string
65     description: Access password for the user to connect to the VMs (ssh)
66     default: "ubuntu"
67
68   public_ip_pool:
69     type: string
70     description: Public IP pool
71     default: "external"
72
73   enable_floating_ip:
74     type: boolean
75     default: true
76
77   has_dpdk:
78     type: boolean
79     default: false
80
81 conditions:
82   cond_floating_ip: {equals: [{get_param: enable_floating_ip}, true]}
83   has_dpdk: {equals: [{get_param: has_dpdk}, true]}
84
85 resources:
86   flavor:
87     type: OS::Nova::Flavor
88     properties:
89       ram: 10240
90       vcpus: 4
91       disk: 10
92
93   flavor_dpdk:
94     type: OS::Nova::Flavor
95     properties:
96       ram: 10240
97       vcpus: 8
98       disk: 40
99       extra_specs:
100         "hw:mem_page_size": large
101         "hw:cpu_policy": dedicated
102         "aggregate_instance_extra_specs:pinned": "true"
103         "hw:numa_node.0": 0
104         "hw:numa_nodes": 1
105
106   server_cloudinit_config:
107     type: OS::Heat::CloudConfig
108     properties:
109       cloud_config:
110         password: ubuntu
111         chpasswd: {expire: false}
112         ssh_pwauth: true
113         manage_etc_hosts: true
114         disable_root: false
115
116   server_config0:
117     type: OS::Heat::SoftwareConfig
118     properties:
119       config:
120         str_replace:
121           template: {get_file: k8s_slaves_init.sh}
122           params:
123             k8s_slave_hostname: {get_param: k8s_slave0_hostname}
124             k8s_master_ip: {get_param: k8s_master_ip}
125             k8s_slave_ip: {get_param: k8s_slave0_ip}
126             k8s_pod_net_cidr: {get_param: k8s_pod_net_cidr}
127             k8s_svc_net_cidr: {get_param: k8s_svc_net_cidr}
128             k8s_cluster_ip: {get_param: k8s_cluster_ip}
129             k8s_user: {get_param: k8s_user}
130             k8s_password: {get_param: k8s_password}
131
132   server_user_data0:
133     type: OS::Heat::MultipartMime
134     properties:
135       parts:
136         - config: {get_resource: server_cloudinit_config}
137         - config: {get_resource: server_config0}
138
139   server_config1:
140     type: OS::Heat::SoftwareConfig
141     properties:
142       config:
143         str_replace:
144           template: {get_file: k8s_slaves_init.sh}
145           params:
146             k8s_slave_hostname: {get_param: k8s_slave1_hostname}
147             k8s_master_ip: {get_param: k8s_master_ip}
148             k8s_slave_ip: {get_param: k8s_slave1_ip}
149             k8s_pod_net_cidr: {get_param: k8s_pod_net_cidr}
150             k8s_svc_net_cidr: {get_param: k8s_svc_net_cidr}
151             k8s_cluster_ip: {get_param: k8s_cluster_ip}
152             k8s_user: {get_param: k8s_user}
153             k8s_password: {get_param: k8s_password}
154
155   server_user_data1:
156     type: OS::Heat::MultipartMime
157     properties:
158       parts:
159         - config: {get_resource: server_cloudinit_config}
160         - config: {get_resource: server_config1}
161
162   server_security_group:
163     type: OS::Neutron::SecurityGroup
164     properties:
165       description: Security group for ssh and icmp
166       name: test-security-group
167       rules: [
168         {remote_ip_prefix: 0.0.0.0/0,
169          protocol: tcp,
170          port_range_min: 1,
171          port_range_max: 65535},
172         {remote_ip_prefix: 0.0.0.0/0,
173          protocol: udp,
174          port_range_min: 1,
175          port_range_max: 65535},
176         {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}
177       ]
178
179   slave_fip0:
180     type: OS::Nova::FloatingIP
181     condition: cond_floating_ip
182     properties:
183       pool: {get_param: public_ip_pool}
184
185   server_association_fip0:
186     type: OS::Nova::FloatingIPAssociation
187     condition: cond_floating_ip
188     properties:
189       floating_ip: {get_resource: slave_fip0}
190       server_id: {get_resource: slave0}
191
192   slave_fip1:
193     type: OS::Nova::FloatingIP
194     condition: cond_floating_ip
195     properties:
196       pool: {get_param: public_ip_pool}
197
198   server_association_fip1:
199     type: OS::Nova::FloatingIPAssociation
200     condition: cond_floating_ip
201     properties:
202       floating_ip: {get_resource: slave_fip1}
203       server_id: {get_resource: slave1}
204
205   mgmt_port0:
206     type: OS::Neutron::Port
207     properties:
208       network: {get_param: k8s_mgmt_net}
209       port_security_enabled: false
210       # security_groups:
211       #   - {get_resource: server_security_group}
212
213   int_net_port0:
214     type: OS::Neutron::Port
215     properties:
216       network: {get_param: k8s_int_net}
217       port_security_enabled: false
218       # security_groups:
219       #   - {get_resource: server_security_group}
220       fixed_ips: [{"ip_address": {get_param: k8s_slave0_ip}}]
221
222   mgmt_port1:
223     type: OS::Neutron::Port
224     properties:
225       network: {get_param: k8s_mgmt_net}
226       port_security_enabled: false
227       # security_groups:
228       #   - {get_resource: server_security_group}
229
230   int_net_port1:
231     type: OS::Neutron::Port
232     properties:
233       network: {get_param: k8s_int_net}
234       port_security_enabled: false
235       # security_groups:
236       #   - {get_resource: server_security_group}
237       fixed_ips: [{"ip_address": {get_param: k8s_slave1_ip}}]
238
239   slave0:
240     type: OS::Nova::Server
241     properties:
242       name: "k8s-slave0"
243       key_name: {get_param: key_name}
244       flavor: {get_resource: {if: ["has_dpdk", "flavor_dpdk", "flavor"]}}
245       image: "xenial"
246       user_data: {get_resource: server_user_data0}
247       user_data_format: RAW
248       # security_groups:
249       #   - {get_resource: server_security_group}
250       networks:
251         - port: {get_resource: mgmt_port0}
252         - port: {get_resource: int_net_port0}
253
254   slave1:
255     type: OS::Nova::Server
256     properties:
257       name: "k8s-slave1"
258       key_name: {get_param: key_name}
259       flavor: {get_resource: {if: ["has_dpdk", "flavor_dpdk", "flavor"]}}
260       image: "xenial"
261       user_data: {get_resource: server_user_data1}
262       user_data_format: RAW
263       # security_groups:
264       #   - {get_resource: server_security_group}
265       networks:
266         - port: {get_resource: mgmt_port1}
267         - port: {get_resource: int_net_port1}