heat_stack.yaml.j2 35 KB

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