heat_stack.yaml.j2 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  1. heat_template_version: 2016-10-14
  2. description: OpenShift cluster
  3. parameters:
  4. outputs:
  5. {% if openshift_openstack_resolve_heat_outputs|default(True)|bool %}
  6. etcd_names:
  7. description: Name of the etcds
  8. value: { get_attr: [ etcd, name ] }
  9. etcd_ips:
  10. description: IPs of the etcds
  11. value: { get_attr: [ etcd, private_ip ] }
  12. etcd_floating_ips:
  13. description: Floating IPs of the etcds
  14. value: { get_attr: [ etcd, floating_ip ] }
  15. master_names:
  16. description: Name of the masters
  17. value: { get_attr: [ masters, name ] }
  18. master_ips:
  19. description: IPs of the masters
  20. value: { get_attr: [ masters, private_ip ] }
  21. master_floating_ips:
  22. description: Floating IPs of the masters
  23. value: { get_attr: [ masters, floating_ip ] }
  24. node_names:
  25. description: Name of the nodes
  26. value: { get_attr: [ compute_nodes, name ] }
  27. node_ips:
  28. description: IPs of the nodes
  29. value: { get_attr: [ compute_nodes, private_ip ] }
  30. node_floating_ips:
  31. description: Floating IPs of the nodes
  32. value: { get_attr: [ compute_nodes, floating_ip ] }
  33. infra_names:
  34. description: Name of the nodes
  35. value: { get_attr: [ infra_nodes, name ] }
  36. infra_ips:
  37. description: IPs of the nodes
  38. value: { get_attr: [ infra_nodes, private_ip ] }
  39. infra_floating_ips:
  40. description: Floating IPs of the nodes
  41. value: { get_attr: [ infra_nodes, floating_ip ] }
  42. {% endif %}
  43. public_api_ip:
  44. description: IP address for the API/UI endpoint
  45. {% if openshift_openstack_use_lbaas_load_balancer %}
  46. # TODO(shadower): Handle setups without floating IPs
  47. value: { get_attr: [api_lb_floating_ip, floating_ip_address] }
  48. {% elif openshift_openstack_use_vm_load_balancer %}
  49. value: { get_attr: [loadbalancer, resource.0, floating_ip] }
  50. {% else %}
  51. value: { get_attr: [masters, resource.0, floating_ip] }
  52. {% endif %}
  53. public_router_ip:
  54. description: IP address of the apps/router endpoint
  55. {% if openshift_openstack_use_lbaas_load_balancer %}
  56. value: { get_attr: [router_lb_floating_ip, floating_ip_address] }
  57. {% else %}
  58. # NOTE(shadower): The VM-based loadbalancer only supports master nodes
  59. value: { get_attr: [infra_nodes, resource.0, floating_ip] }
  60. {% endif %}
  61. private_api_ip:
  62. description: >
  63. The address of the private OpenShift API. This is used during OpenShift
  64. deployment and for API access by the internal pods and services.
  65. {% if openshift_openstack_use_lbaas_load_balancer %}
  66. value: { get_attr: [api_lb, vip_address] }
  67. {% elif openshift_openstack_use_vm_load_balancer %}
  68. value: { get_attr: [loadbalancer, resource.0, private_ip] }
  69. {% else %}
  70. value: { get_attr: [masters, resource.0, private_ip] }
  71. {% endif %}
  72. {% if openshift_use_kuryr|default(false)|bool %}
  73. vm_subnet:
  74. description: ID of the subnet the Pods will be on
  75. value: { get_resource: subnet }
  76. pod_subnet:
  77. description: ID of the subnet the Pods will be on
  78. value: { get_resource: pod_subnet }
  79. service_subnet:
  80. description: ID of the subnet the services will be on
  81. value: { get_resource: service_subnet }
  82. pod_access_sg_id:
  83. description: Id of the security group for services to be able to reach pods
  84. value: { get_resource: pod_access_sg }
  85. api_lb_vip_port_id:
  86. description: Id of the OpenShift API load balancer VIP port
  87. value: { get_attr: [api_lb, vip_port_id] }
  88. api_lb_sg_id:
  89. description: Security Group Id of the OpenShift API load balancer VIP port
  90. value: { get_resource: lb-secgrp }
  91. api_lb_provider:
  92. description: Id of the OpenShift API load balancer VIP port
  93. value: { get_attr: [api_lb, show, provider] }
  94. {% endif %}
  95. conditions:
  96. no_floating: {% if openshift_openstack_provider_network_name %}true{% else %}false{% endif %}
  97. resources:
  98. # NOTE: With Kuryr, the load balancer is necessary.
  99. {% if openshift_openstack_use_lbaas_load_balancer or (openshift_use_kuryr|default(false)|bool and not openshift_openstack_provider_network_name) %}
  100. api_lb:
  101. type: OS::{{ openshift_openstack_lbaasv2_provider }}::LoadBalancer
  102. properties:
  103. name:
  104. str_replace:
  105. template: openshift-ansible-cluster_id-api-lb
  106. params:
  107. cluster_id: {{ openshift_openstack_full_dns_domain }}
  108. {% if openshift_use_kuryr|default(false)|bool %}
  109. vip_address: {{ openshift_openstack_kuryr_service_subnet_cidr | ipaddr('1') | ipaddr('address') }}
  110. vip_subnet: { get_resource: service_subnet }
  111. {% else %}
  112. vip_subnet: { get_resource: subnet }
  113. {% endif %}
  114. api_lb_listener:
  115. type: OS::{{ openshift_openstack_lbaasv2_provider }}::Listener
  116. properties:
  117. name:
  118. str_replace:
  119. template: openshift-ansible-cluster_id-api-lb-listener
  120. params:
  121. cluster_id: {{ openshift_openstack_full_dns_domain }}
  122. loadbalancer: { get_resource: api_lb }
  123. protocol: HTTPS
  124. protocol_port: {{ openshift_master_api_port }}
  125. default_pool: { get_resource: api_lb_pool }
  126. {% if openshift_use_kuryr|default(false)|bool and openshift_master_api_port|default(8443) != 443 %}
  127. # 443 listener for pod access. In non-kuryr envs handled by iptables
  128. internal_api_lb_listener:
  129. type: OS::{{ openshift_openstack_lbaasv2_provider }}::Listener
  130. properties:
  131. name:
  132. str_replace:
  133. template: openshift-ansible-cluster_id-api-lb-internal-listener
  134. params:
  135. cluster_id: {{ openshift_openstack_full_dns_domain }}
  136. loadbalancer: { get_resource: api_lb }
  137. protocol: HTTPS
  138. protocol_port: 443
  139. default_pool: { get_resource: api_lb_pool }
  140. {% endif %}
  141. api_lb_pool:
  142. type: OS::{{ openshift_openstack_lbaasv2_provider }}::Pool
  143. properties:
  144. name:
  145. str_replace:
  146. template: openshift-ansible-cluster_id-api-lb-pool
  147. params:
  148. cluster_id: {{ openshift_openstack_full_dns_domain }}
  149. protocol: HTTPS
  150. # TODO(shadower): Make this configurable?
  151. lb_algorithm: ROUND_ROBIN
  152. loadbalancer: { get_resource: api_lb }
  153. {% endif %}
  154. {% if not openshift_openstack_provider_network_name %}
  155. {% if openshift_use_kuryr|default(false)|bool %}
  156. pod_net:
  157. type: OS::Neutron::Net
  158. properties:
  159. name:
  160. str_replace:
  161. template: openshift-ansible-cluster_id-pod-net
  162. params:
  163. cluster_id: {{ openshift_openstack_full_dns_domain }}
  164. pod_subnet:
  165. type: OS::Neutron::Subnet
  166. properties:
  167. network_id: { get_resource: pod_net }
  168. cidr: {{ openshift_openstack_kuryr_pod_subnet_cidr }}
  169. enable_dhcp: False
  170. name:
  171. str_replace:
  172. template: openshift-ansible-cluster_id-pod-subnet
  173. params:
  174. cluster_id: {{ openshift_openstack_full_dns_domain }}
  175. dns_nameservers:
  176. {% for nameserver in openshift_openstack_dns_nameservers %}
  177. - {{ nameserver }}
  178. {% endfor %}
  179. service_net:
  180. type: OS::Neutron::Net
  181. properties:
  182. name:
  183. str_replace:
  184. template: openshift-ansible-cluster_id-service-net
  185. params:
  186. cluster_id: {{ openshift_openstack_full_dns_domain }}
  187. service_subnet:
  188. type: OS::Neutron::Subnet
  189. properties:
  190. network_id: { get_resource: service_net }
  191. cidr: {{ openshift_openstack_kuryr_service_subnet_cidr }}
  192. gateway_ip: {{ openshift_openstack_kuryr_service_subnet_cidr | ipaddr('-2') | ipaddr('address') }}
  193. enable_dhcp: False
  194. allocation_pools:
  195. - start: {{ openshift_openstack_kuryr_service_pool_start }}
  196. end: {{ openshift_openstack_kuryr_service_pool_end }}
  197. name:
  198. str_replace:
  199. template: openshift-ansible-cluster_id-service-subnet
  200. params:
  201. cluster_id: {{ openshift_openstack_full_dns_domain }}
  202. {% endif %}
  203. net:
  204. type: OS::Neutron::Net
  205. properties:
  206. name:
  207. str_replace:
  208. template: openshift-ansible-cluster_id-net
  209. params:
  210. cluster_id: {{ openshift_openstack_full_dns_domain }}
  211. subnet:
  212. type: OS::Neutron::Subnet
  213. properties:
  214. name:
  215. str_replace:
  216. template: openshift-ansible-cluster_id-subnet
  217. params:
  218. cluster_id: {{ openshift_openstack_full_dns_domain }}
  219. network: { get_resource: net }
  220. cidr: {{ openshift_openstack_subnet_cidr }}
  221. allocation_pools:
  222. - start: {{ openshift_openstack_pool_start }}
  223. end: {{ openshift_openstack_pool_end }}
  224. dns_nameservers:
  225. {% for nameserver in openshift_openstack_dns_nameservers %}
  226. - {{ nameserver }}
  227. {% endfor %}
  228. {% if openshift_use_flannel|default(False)|bool %}
  229. data_net:
  230. type: OS::Neutron::Net
  231. properties:
  232. name: openshift-ansible-{{ openshift_openstack_full_dns_domain }}-data-net
  233. port_security_enabled: false
  234. data_subnet:
  235. type: OS::Neutron::Subnet
  236. properties:
  237. name: openshift-ansible-{{ openshift_openstack_full_dns_domain }}-data-subnet
  238. network: { get_resource: data_net }
  239. cidr: {{ openshift_cluster_network_cidr }}
  240. gateway_ip: null
  241. {% endif %}
  242. router:
  243. type: OS::Neutron::Router
  244. properties:
  245. name:
  246. str_replace:
  247. template: openshift-ansible-cluster_id-router
  248. params:
  249. cluster_id: {{ openshift_openstack_full_dns_domain }}
  250. external_gateway_info:
  251. network: {{ openshift_openstack_external_network_name }}
  252. interface:
  253. type: OS::Neutron::RouterInterface
  254. properties:
  255. router_id: { get_resource: router }
  256. subnet_id: { get_resource: subnet }
  257. {% if openshift_use_kuryr|default(false)|bool %}
  258. pod_subnet_interface:
  259. type: OS::Neutron::RouterInterface
  260. properties:
  261. router_id: { get_resource: router }
  262. subnet_id: { get_resource: pod_subnet }
  263. service_router_port:
  264. type: OS::Neutron::Port
  265. properties:
  266. network: { get_resource: service_net}
  267. fixed_ips:
  268. - subnet: { get_resource: service_subnet }
  269. ip_address: {{ openshift_openstack_kuryr_service_subnet_cidr | ipaddr('-2') | ipaddr('address') }}
  270. name:
  271. str_replace:
  272. template: openshift-ansible-cluster_id-service-subnet-router-port
  273. params:
  274. cluster_id: {{ openshift_openstack_full_dns_domain }}
  275. service_subnet_interface:
  276. type: OS::Neutron::RouterInterface
  277. properties:
  278. router_id: { get_resource: router }
  279. port: { get_resource: service_router_port }
  280. {% endif %}
  281. {% endif %}
  282. # keypair:
  283. # type: OS::Nova::KeyPair
  284. # properties:
  285. # name:
  286. # str_replace:
  287. # template: openshift-ansible-cluster_id-keypair
  288. # params:
  289. # cluster_id: {{ openshift_openstack_full_dns_domain }}
  290. # public_key: {{ openshift_openstack_keypair_name }}
  291. common-secgrp:
  292. type: OS::Neutron::SecurityGroup
  293. properties:
  294. name:
  295. str_replace:
  296. template: openshift-ansible-cluster_id-common-secgrp
  297. params:
  298. cluster_id: {{ openshift_openstack_full_dns_domain }}
  299. description:
  300. str_replace:
  301. template: Basic ssh/icmp security group for cluster_id OpenShift cluster
  302. params:
  303. cluster_id: {{ openshift_openstack_full_dns_domain }}
  304. rules: {{ openshift_openstack_common_secgroup_rules|to_json }}
  305. {% if openshift_use_kuryr|default(false)|bool %}
  306. pod_access_sg:
  307. type: OS::Neutron::SecurityGroup
  308. properties:
  309. name:
  310. str_replace:
  311. template: openshift-ansible-cluster_id-pod-service-secgrp
  312. params:
  313. cluster_id: {{ openshift_openstack_full_dns_domain }}
  314. description: Give services and nodes access to the pods
  315. rules:
  316. - ethertype: IPv4
  317. remote_ip_prefix: {{ openshift_openstack_kuryr_service_subnet_cidr }}
  318. - ethertype: IPv4
  319. remote_ip_prefix: {{ openshift_openstack_subnet_cidr }}
  320. - ethertype: IPv4
  321. remote_mode: remote_group_id
  322. {% endif %}
  323. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  324. flat-secgrp:
  325. type: OS::Neutron::SecurityGroup
  326. properties:
  327. name:
  328. str_replace:
  329. template: openshift-ansible-cluster_id-flat-secgrp
  330. params:
  331. cluster_id: {{ openshift_openstack_full_dns_domain }}
  332. description:
  333. str_replace:
  334. template: Security group for cluster_id OpenShift cluster
  335. params:
  336. cluster_id: {{ openshift_openstack_full_dns_domain }}
  337. rules:
  338. {% for rule in openshift_openstack_master_secgroup_rules|list %}
  339. - {{ rule|to_json }}
  340. {% endfor %}
  341. {% for rule in openshift_openstack_etcd_secgroup_rules|list %}
  342. - {{ rule|to_json }}
  343. {% endfor %}
  344. {% for rule in openshift_openstack_node_secgroup_rules|list %}
  345. - {{ rule|to_json }}
  346. {% endfor %}
  347. {% else %}
  348. master-secgrp:
  349. type: OS::Neutron::SecurityGroup
  350. properties:
  351. name:
  352. str_replace:
  353. template: openshift-ansible-cluster_id-master-secgrp
  354. params:
  355. cluster_id: {{ openshift_openstack_full_dns_domain }}
  356. description:
  357. str_replace:
  358. template: Security group for cluster_id OpenShift cluster master
  359. params:
  360. cluster_id: {{ openshift_openstack_full_dns_domain }}
  361. rules: {{ openshift_openstack_master_secgroup_rules|to_json }}
  362. etcd-secgrp:
  363. type: OS::Neutron::SecurityGroup
  364. properties:
  365. name:
  366. str_replace:
  367. template: openshift-ansible-cluster_id-etcd-secgrp
  368. params:
  369. cluster_id: {{ openshift_openstack_full_dns_domain }}
  370. description:
  371. str_replace:
  372. template: Security group for cluster_id etcd cluster
  373. params:
  374. cluster_id: {{ openshift_openstack_full_dns_domain }}
  375. rules: {{ openshift_openstack_etcd_secgroup_rules|to_json }}
  376. node-secgrp:
  377. type: OS::Neutron::SecurityGroup
  378. properties:
  379. name:
  380. str_replace:
  381. template: openshift-ansible-cluster_id-node-secgrp
  382. params:
  383. cluster_id: {{ openshift_openstack_full_dns_domain }}
  384. description:
  385. str_replace:
  386. template: Security group for cluster_id OpenShift cluster nodes
  387. params:
  388. cluster_id: {{ openshift_openstack_full_dns_domain }}
  389. rules: {{ openshift_openstack_node_secgroup_rules|to_json }}
  390. {% endif %}
  391. infra-secgrp:
  392. type: OS::Neutron::SecurityGroup
  393. properties:
  394. name:
  395. str_replace:
  396. template: openshift-ansible-cluster_id-infra-secgrp
  397. params:
  398. cluster_id: {{ openshift_openstack_full_dns_domain }}
  399. description:
  400. str_replace:
  401. template: Security group for cluster_id OpenShift infrastructure cluster nodes
  402. params:
  403. cluster_id: {{ openshift_openstack_full_dns_domain }}
  404. rules: {{ openshift_openstack_infra_secgroup_rules|to_json }}
  405. cns-secgrp:
  406. type: OS::Neutron::SecurityGroup
  407. properties:
  408. name:
  409. str_replace:
  410. template: openshift-ansible-cluster_id-cns-secgrp
  411. params:
  412. cluster_id: {{ openshift_openstack_full_dns_domain }}
  413. description:
  414. str_replace:
  415. template: Security group for cluster_id OpenShift cns cluster nodes
  416. params:
  417. cluster_id: {{ openshift_openstack_full_dns_domain }}
  418. rules: {{ openshift_openstack_cns_secgroup_rules|to_json }}
  419. lb-secgrp:
  420. type: OS::Neutron::SecurityGroup
  421. properties:
  422. name: openshift-ansible-{{ openshift_openstack_full_dns_domain }}-lb-secgrp
  423. description: Security group for {{ openshift_openstack_full_dns_domain }} cluster Load Balancer
  424. rules:
  425. {% if openshift_master_console_port is defined and openshift_master_console_port != openshift_master_api_port %}
  426. {% for rule in openshift_openstack_lb_base_secgroup_rules|list %}
  427. - {{ rule|to_json }}
  428. {% endfor %}
  429. {% for rule in openshift_openstack_lb_console_secgroup_rules|list %}
  430. - {{ rule|to_json }}
  431. {% endfor %}
  432. {% else %}
  433. {{ openshift_openstack_lb_base_secgroup_rules|to_json }}
  434. {% endif %}
  435. etcd:
  436. type: OS::Heat::ResourceGroup
  437. properties:
  438. count: {{ openshift_openstack_num_etcd }}
  439. resource_def:
  440. type: server.yaml
  441. properties:
  442. name:
  443. str_replace:
  444. template: k8s_type-%index%.cluster_id
  445. params:
  446. cluster_id: {{ openshift_openstack_full_dns_domain }}
  447. k8s_type: {{ openshift_openstack_etcd_hostname }}
  448. cluster_env: {{ openshift_openstack_public_dns_domain }}
  449. cluster_id: {{ openshift_openstack_full_dns_domain }}
  450. group:
  451. str_replace:
  452. template: k8s_type.cluster_id
  453. params:
  454. k8s_type: etcds
  455. cluster_id: {{ openshift_openstack_full_dns_domain }}
  456. type: etcd
  457. image: {{ openshift_openstack_etcd_image }}
  458. flavor: {{ openshift_openstack_etcd_flavor }}
  459. key_name: {{ openshift_openstack_keypair_name }}
  460. {% if openshift_openstack_provider_network_name %}
  461. net: {{ openshift_openstack_provider_network_name }}
  462. net_name: {{ openshift_openstack_provider_network_name }}
  463. {% else %}
  464. net: { get_resource: net }
  465. subnet: { get_resource: subnet }
  466. {% if openshift_use_kuryr|default(false)|bool %}
  467. pod_net: { get_resource: pod_net }
  468. pod_subnet: { get_resource: pod_subnet }
  469. {% endif %}
  470. net_name:
  471. str_replace:
  472. template: openshift-ansible-cluster_id-net
  473. params:
  474. cluster_id: {{ openshift_openstack_full_dns_domain }}
  475. {% endif %}
  476. secgrp:
  477. - { get_resource: {% if openshift_openstack_flat_secgrp|default(False)|bool %}flat-secgrp{% else %}etcd-secgrp{% endif %} }
  478. - { get_resource: common-secgrp }
  479. {% if openshift_use_kuryr|default(false)|bool %}
  480. pod_secgrp:
  481. - { get_resource: pod_access_sg }
  482. {% endif %}
  483. floating_network:
  484. if:
  485. - no_floating
  486. - ''
  487. - {{ openshift_openstack_external_network_name }}
  488. {% if openshift_openstack_provider_network_name %}
  489. attach_float_net: false
  490. {% endif %}
  491. volume_size: {{ openshift_openstack_etcd_volume_size }}
  492. {% if not openshift_openstack_provider_network_name %}
  493. depends_on:
  494. - interface
  495. {% endif %}
  496. {% if openshift_openstack_master_server_group_policies|length > 0 %}
  497. master_server_group:
  498. type: OS::Nova::ServerGroup
  499. properties:
  500. name: master_server_group
  501. policies: {{ openshift_openstack_master_server_group_policies }}
  502. {% endif %}
  503. {% if openshift_openstack_infra_server_group_policies|length > 0 %}
  504. infra_server_group:
  505. type: OS::Nova::ServerGroup
  506. properties:
  507. name: infra_server_group
  508. policies: {{ openshift_openstack_infra_server_group_policies }}
  509. {% endif %}
  510. {% if openshift_openstack_use_vm_load_balancer %}
  511. loadbalancer:
  512. type: OS::Heat::ResourceGroup
  513. properties:
  514. count: 1
  515. resource_def:
  516. type: server.yaml
  517. properties:
  518. name:
  519. str_replace:
  520. template: k8s_type-%index%.cluster_id
  521. params:
  522. cluster_id: {{ openshift_openstack_full_dns_domain }}
  523. k8s_type: {{ openshift_openstack_lb_hostname }}
  524. cluster_env: {{ openshift_openstack_public_dns_domain }}
  525. cluster_id: {{ openshift_openstack_full_dns_domain }}
  526. group:
  527. str_replace:
  528. template: k8s_type.cluster_id
  529. params:
  530. k8s_type: lb
  531. cluster_id: {{ openshift_openstack_full_dns_domain }}
  532. type: lb
  533. image: {{ openshift_openstack_lb_image }}
  534. flavor: {{ openshift_openstack_lb_flavor }}
  535. key_name: {{ openshift_openstack_keypair_name }}
  536. {% if openshift_openstack_provider_network_name %}
  537. net: {{ openshift_openstack_provider_network_name }}
  538. net_name: {{ openshift_openstack_provider_network_name }}
  539. {% else %}
  540. net: { get_resource: net }
  541. subnet: { get_resource: subnet }
  542. {% if openshift_use_kuryr|default(false)|bool %}
  543. pod_net: { get_resource: pod_net }
  544. pod_subnet: { get_resource: pod_subnet }
  545. {% endif %}
  546. net_name:
  547. str_replace:
  548. template: openshift-ansible-cluster_id-net
  549. params:
  550. cluster_id: {{ openshift_openstack_full_dns_domain }}
  551. {% endif %}
  552. secgrp:
  553. - { get_resource: lb-secgrp }
  554. - { get_resource: common-secgrp }
  555. {% if openshift_use_kuryr|default(false)|bool %}
  556. pod_secgrp:
  557. - { get_resource: pod_access_sg }
  558. {% endif %}
  559. floating_network:
  560. if:
  561. - no_floating
  562. - ''
  563. - {{ openshift_openstack_external_network_name }}
  564. {% if openshift_openstack_provider_network_name %}
  565. attach_float_net: false
  566. {% endif %}
  567. volume_size: {{ openshift_openstack_lb_volume_size }}
  568. {% if not openshift_openstack_provider_network_name %}
  569. depends_on:
  570. - interface
  571. {% endif %}
  572. {% endif %}
  573. masters:
  574. type: OS::Heat::ResourceGroup
  575. properties:
  576. count: {{ openshift_openstack_num_masters }}
  577. resource_def:
  578. type: server.yaml
  579. properties:
  580. name:
  581. str_replace:
  582. template: k8s_type-%index%.cluster_id
  583. params:
  584. cluster_id: {{ openshift_openstack_full_dns_domain }}
  585. k8s_type: {{ openshift_openstack_master_hostname }}
  586. cluster_env: {{ openshift_openstack_public_dns_domain }}
  587. cluster_id: {{ openshift_openstack_full_dns_domain }}
  588. group:
  589. str_replace:
  590. template: k8s_type.cluster_id
  591. params:
  592. k8s_type: masters
  593. cluster_id: {{ openshift_openstack_full_dns_domain }}
  594. type: master
  595. image: {{ openshift_openstack_master_image }}
  596. flavor: {{ openshift_openstack_master_flavor }}
  597. key_name: {{ openshift_openstack_keypair_name }}
  598. {% if openshift_openstack_use_lbaas_load_balancer or openshift_use_kuryr|default(false)|bool %}
  599. api_lb_pool: { get_resource: api_lb_pool }
  600. {% endif %}
  601. {% if openshift_openstack_provider_network_name %}
  602. net: {{ openshift_openstack_provider_network_name }}
  603. net_name: {{ openshift_openstack_provider_network_name }}
  604. {% else %}
  605. net: { get_resource: net }
  606. subnet: { get_resource: subnet }
  607. {% if openshift_use_kuryr|default(false)|bool %}
  608. pod_net: { get_resource: pod_net }
  609. pod_subnet: { get_resource: pod_subnet }
  610. {% endif %}
  611. net_name:
  612. str_replace:
  613. template: openshift-ansible-cluster_id-net
  614. params:
  615. cluster_id: {{ openshift_openstack_full_dns_domain }}
  616. {% if openshift_use_flannel|default(False)|bool %}
  617. attach_data_net: true
  618. data_net: { get_resource: data_net }
  619. data_subnet: { get_resource: data_subnet }
  620. {% endif %}
  621. {% endif %}
  622. {% if openshift_use_kuryr|default(false)|bool %}
  623. api_lb_pool: { get_resource: api_lb_pool }
  624. {% endif %}
  625. secgrp:
  626. - { get_resource: common-secgrp }
  627. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  628. - { get_resource: flat-secgrp }
  629. {% else %}
  630. - { get_resource: master-secgrp }
  631. - { get_resource: node-secgrp }
  632. {% if openshift_openstack_num_etcd|int == 0 %}
  633. - { get_resource: etcd-secgrp }
  634. {% endif %}
  635. {% if openshift_use_kuryr|default(false)|bool %}
  636. pod_secgrp:
  637. - { get_resource: pod_access_sg }
  638. {% endif %}
  639. {% endif %}
  640. floating_network:
  641. if:
  642. - no_floating
  643. - ''
  644. - {{ openshift_openstack_external_network_name }}
  645. {% if openshift_openstack_provider_network_name %}
  646. attach_float_net: false
  647. {% endif %}
  648. volume_size: {{ openshift_openstack_master_volume_size }}
  649. {% if openshift_openstack_master_server_group_policies|length > 0 %}
  650. scheduler_hints:
  651. group: { get_resource: master_server_group }
  652. {% endif %}
  653. {% if not openshift_openstack_provider_network_name %}
  654. depends_on:
  655. - interface
  656. {% endif %}
  657. compute_nodes:
  658. type: OS::Heat::ResourceGroup
  659. properties:
  660. count: {{ openshift_openstack_num_nodes }}
  661. removal_policies:
  662. - resource_list: {{ openshift_openstack_nodes_to_remove | to_json }}
  663. resource_def:
  664. type: server.yaml
  665. properties:
  666. name:
  667. str_replace:
  668. template: sub_type_k8s_type-%index%.cluster_id
  669. params:
  670. cluster_id: {{ openshift_openstack_full_dns_domain }}
  671. sub_type_k8s_type: {{ openshift_openstack_node_hostname }}
  672. cluster_env: {{ openshift_openstack_public_dns_domain }}
  673. cluster_id: {{ openshift_openstack_full_dns_domain }}
  674. group:
  675. str_replace:
  676. template: k8s_type.cluster_id
  677. params:
  678. k8s_type: nodes
  679. cluster_id: {{ openshift_openstack_full_dns_domain }}
  680. type: node
  681. subtype: app
  682. node_labels:
  683. {% for k, v in openshift_openstack_cluster_node_labels.app.items() %}
  684. {{ k|e }}: {{ v|e }}
  685. {% endfor %}
  686. image: {{ openshift_openstack_node_image }}
  687. flavor: {{ openshift_openstack_node_flavor }}
  688. key_name: {{ openshift_openstack_keypair_name }}
  689. {% if openshift_openstack_provider_network_name %}
  690. net: {{ openshift_openstack_provider_network_name }}
  691. net_name: {{ openshift_openstack_provider_network_name }}
  692. {% else %}
  693. net: { get_resource: net }
  694. subnet: { get_resource: subnet }
  695. {% if openshift_use_kuryr|default(false)|bool %}
  696. pod_net: { get_resource: pod_net }
  697. pod_subnet: { get_resource: pod_subnet }
  698. {% endif %}
  699. net_name:
  700. str_replace:
  701. template: openshift-ansible-cluster_id-net
  702. params:
  703. cluster_id: {{ openshift_openstack_full_dns_domain }}
  704. {% if openshift_use_flannel|default(False)|bool %}
  705. attach_data_net: true
  706. data_net: { get_resource: data_net }
  707. data_subnet: { get_resource: data_subnet }
  708. {% endif %}
  709. {% endif %}
  710. secgrp:
  711. - { get_resource: {% if openshift_openstack_flat_secgrp|default(False)|bool %}flat-secgrp{% else %}node-secgrp{% endif %} }
  712. - { get_resource: common-secgrp }
  713. {% if openshift_use_kuryr|default(false)|bool %}
  714. pod_secgrp:
  715. - { get_resource: pod_access_sg }
  716. {% endif %}
  717. floating_network:
  718. if:
  719. - no_floating
  720. - ''
  721. - {{ openshift_openstack_external_network_name }}
  722. {% if openshift_openstack_provider_network_name %}
  723. attach_float_net: false
  724. {% endif %}
  725. volume_size: {{ openshift_openstack_node_volume_size }}
  726. {% if not openshift_openstack_provider_network_name %}
  727. depends_on:
  728. - interface
  729. {% endif %}
  730. infra_nodes:
  731. type: OS::Heat::ResourceGroup
  732. properties:
  733. count: {{ openshift_openstack_num_infra }}
  734. resource_def:
  735. type: server.yaml
  736. properties:
  737. name:
  738. str_replace:
  739. template: sub_type_k8s_type-%index%.cluster_id
  740. params:
  741. cluster_id: {{ openshift_openstack_full_dns_domain }}
  742. sub_type_k8s_type: {{ openshift_openstack_infra_hostname }}
  743. cluster_env: {{ openshift_openstack_public_dns_domain }}
  744. cluster_id: {{ openshift_openstack_full_dns_domain }}
  745. group:
  746. str_replace:
  747. template: k8s_type.cluster_id
  748. params:
  749. k8s_type: infra
  750. cluster_id: {{ openshift_openstack_full_dns_domain }}
  751. type: node
  752. subtype: infra
  753. node_labels:
  754. {% for k, v in openshift_openstack_cluster_node_labels.infra.items() %}
  755. {{ k|e }}: {{ v|e }}
  756. {% endfor %}
  757. image: {{ openshift_openstack_infra_image }}
  758. flavor: {{ openshift_openstack_infra_flavor }}
  759. key_name: {{ openshift_openstack_keypair_name }}
  760. {% if openshift_openstack_use_lbaas_load_balancer %}
  761. router_lb_pool_http: { get_resource: router_lb_pool_http }
  762. router_lb_pool_https: { get_resource: router_lb_pool_https }
  763. {% endif %}
  764. {% if openshift_openstack_provider_network_name %}
  765. net: {{ openshift_openstack_provider_network_name }}
  766. net_name: {{ openshift_openstack_provider_network_name }}
  767. {% else %}
  768. net: { get_resource: net }
  769. subnet: { get_resource: subnet }
  770. {% if openshift_use_kuryr|default(false)|bool %}
  771. pod_net: { get_resource: pod_net }
  772. pod_subnet: { get_resource: pod_subnet }
  773. {% endif %}
  774. net_name:
  775. str_replace:
  776. template: openshift-ansible-cluster_id-net
  777. params:
  778. cluster_id: {{ openshift_openstack_full_dns_domain }}
  779. {% if openshift_use_flannel|default(False)|bool %}
  780. attach_data_net: true
  781. data_net: { get_resource: data_net }
  782. data_subnet: { get_resource: data_subnet }
  783. {% endif %}
  784. {% endif %}
  785. secgrp:
  786. # TODO(bogdando) filter only required node rules into infra-secgrp
  787. - { get_resource: common-secgrp }
  788. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  789. - { get_resource: flat-secgrp }
  790. {% else %}
  791. - { get_resource: node-secgrp }
  792. - { get_resource: infra-secgrp }
  793. {% if openshift_use_kuryr|default(false)|bool %}
  794. pod_secgrp:
  795. - { get_resource: pod_access_sg }
  796. {% endif %}
  797. {% endif %}
  798. floating_network:
  799. if:
  800. - no_floating
  801. - ''
  802. - {{ openshift_openstack_external_network_name }}
  803. {% if openshift_openstack_provider_network_name %}
  804. attach_float_net: false
  805. {% endif %}
  806. volume_size: {{ openshift_openstack_infra_volume_size }}
  807. {% if openshift_openstack_infra_server_group_policies|length > 0 %}
  808. scheduler_hints:
  809. group: { get_resource: infra_server_group }
  810. {% endif %}
  811. {% if not openshift_openstack_provider_network_name %}
  812. depends_on:
  813. - interface
  814. {% endif %}
  815. cns:
  816. type: OS::Heat::ResourceGroup
  817. properties:
  818. count: {{ openshift_openstack_num_cns }}
  819. resource_def:
  820. type: server.yaml
  821. properties:
  822. name:
  823. str_replace:
  824. template: sub_type_k8s_type-%index%.cluster_id
  825. params:
  826. cluster_id: {{ openshift_openstack_full_dns_domain }}
  827. sub_type_k8s_type: {{ openshift_openstack_cns_hostname }}
  828. cluster_env: {{ openshift_openstack_public_dns_domain }}
  829. cluster_id: {{ openshift_openstack_full_dns_domain }}
  830. group:
  831. str_replace:
  832. template: k8s_type.cluster_id
  833. params:
  834. k8s_type: cns
  835. cluster_id: {{ openshift_openstack_full_dns_domain }}
  836. type: cns
  837. image: {{ openshift_openstack_cns_image }}
  838. flavor: {{ openshift_openstack_cns_flavor }}
  839. key_name: {{ openshift_openstack_keypair_name }}
  840. {% if openshift_openstack_provider_network_name %}
  841. net: {{ openshift_openstack_provider_network_name }}
  842. net_name: {{ openshift_openstack_provider_network_name }}
  843. {% else %}
  844. net: { get_resource: net }
  845. subnet: { get_resource: subnet }
  846. {% if openshift_use_kuryr|default(false)|bool %}
  847. pod_net: { get_resource: pod_net }
  848. pod_subnet: { get_resource: pod_subnet }
  849. {% endif %}
  850. net_name:
  851. str_replace:
  852. template: openshift-ansible-cluster_id-net
  853. params:
  854. cluster_id: {{ openshift_openstack_full_dns_domain }}
  855. {% if openshift_use_flannel|default(False)|bool %}
  856. attach_data_net: true
  857. data_net: { get_resource: data_net }
  858. data_subnet: { get_resource: data_subnet }
  859. {% endif %}
  860. {% endif %}
  861. secgrp:
  862. - { get_resource: common-secgrp }
  863. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  864. - { get_resource: flat-secgrp }
  865. {% else %}
  866. - { get_resource: node-secgrp }
  867. - { get_resource: cns-secgrp }
  868. {% if openshift_use_kuryr|default(false)|bool %}
  869. pod_secgrp:
  870. - { get_resource: pod_access_sg }
  871. {% endif %}
  872. {% endif %}
  873. {% if not openshift_openstack_provider_network_name %}
  874. floating_network: {{ openshift_openstack_external_network_name }}
  875. {% endif %}
  876. volume_size: {{ openshift_openstack_cns_volume_size }}
  877. {% if not openshift_openstack_provider_network_name %}
  878. depends_on:
  879. - interface
  880. {% endif %}
  881. {% if openshift_openstack_use_lbaas_load_balancer %}
  882. api_lb_floating_ip:
  883. condition: { not: no_floating }
  884. depends_on:
  885. - api_lb
  886. - api_lb_listener
  887. - api_lb_pool
  888. type: OS::Neutron::FloatingIP
  889. properties:
  890. floating_network: {{ openshift_openstack_external_network_name }}
  891. port_id: { get_attr: [api_lb, vip_port_id] }
  892. router_lb:
  893. type: OS::{{ openshift_openstack_lbaasv2_provider }}::LoadBalancer
  894. properties:
  895. vip_subnet: { get_resource: subnet }
  896. router_lb_floating_ip:
  897. condition: { not: no_floating }
  898. depends_on:
  899. - router_lb
  900. - router_lb_listener_http
  901. - router_lb_pool_http
  902. - router_lb_listener_https
  903. - router_lb_pool_https
  904. type: OS::Neutron::FloatingIP
  905. properties:
  906. floating_network: {{ openshift_openstack_external_network_name }}
  907. port_id: { get_attr: [router_lb, vip_port_id] }
  908. router_lb_listener_http:
  909. type: OS::{{ openshift_openstack_lbaasv2_provider }}::Listener
  910. properties:
  911. protocol: HTTP
  912. protocol_port: 80
  913. loadbalancer: { get_resource: router_lb }
  914. router_lb_pool_http:
  915. type: OS::{{ openshift_openstack_lbaasv2_provider }}::Pool
  916. properties:
  917. # TODO(shadower): Make this configurable?
  918. lb_algorithm: ROUND_ROBIN
  919. protocol: HTTP
  920. listener: { get_resource: router_lb_listener_http }
  921. router_lb_listener_https:
  922. type: OS::{{ openshift_openstack_lbaasv2_provider }}::Listener
  923. properties:
  924. protocol: HTTPS
  925. protocol_port: 443
  926. loadbalancer: { get_resource: router_lb }
  927. router_lb_pool_https:
  928. type: OS::{{ openshift_openstack_lbaasv2_provider }}::Pool
  929. properties:
  930. # TODO(shadower): Make this configurable?
  931. lb_algorithm: ROUND_ROBIN
  932. protocol: HTTPS
  933. listener: { get_resource: router_lb_listener_https }
  934. {% endif %}