heat_stack_server.yaml.j2 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. heat_template_version: pike
  2. description: OpenShift cluster server
  3. parameters:
  4. name:
  5. type: string
  6. label: Name
  7. description: Name
  8. group:
  9. type: string
  10. label: Host Group
  11. description: The Primary Ansible Host Group
  12. default: host
  13. cluster_env:
  14. type: string
  15. label: Cluster environment
  16. description: Environment of the cluster
  17. cluster_id:
  18. type: string
  19. label: Cluster ID
  20. description: Identifier of the cluster
  21. type:
  22. type: string
  23. label: Type
  24. description: Type master or node
  25. subtype:
  26. type: string
  27. label: Sub-type
  28. description: Sub-type compute or infra for nodes, default otherwise
  29. default: default
  30. key_name:
  31. type: string
  32. label: Key name
  33. description: Key name of keypair
  34. image:
  35. type: string
  36. label: Image
  37. description: Name of the image
  38. flavor:
  39. type: string
  40. label: Flavor
  41. description: Name of the flavor
  42. net:
  43. type: string
  44. label: Net ID
  45. description: Net resource
  46. net_name:
  47. type: string
  48. label: Net name
  49. description: Net name
  50. {% if not openshift_openstack_provider_network_name %}
  51. subnet:
  52. type: string
  53. label: Subnet ID
  54. description: Subnet resource
  55. {% endif %}
  56. {% if openshift_use_kuryr|default(false)|bool %}
  57. pod_net:
  58. type: string
  59. label: Pod Net ID
  60. description: Net resource
  61. default: ''
  62. pod_subnet:
  63. type: string
  64. label: Pod Subnet ID
  65. description: Subnet resource
  66. default: ''
  67. {% endif %}
  68. {% if openshift_use_flannel|default(False)|bool %}
  69. attach_data_net:
  70. type: boolean
  71. default: false
  72. label: Attach-data-net
  73. description: A switch for data port connection
  74. data_net:
  75. type: string
  76. default: ''
  77. label: Net ID
  78. description: Net resource
  79. {% if not openshift_openstack_provider_network_name %}
  80. data_subnet:
  81. type: string
  82. default: ''
  83. label: Subnet ID
  84. description: Subnet resource
  85. {% endif %}
  86. {% endif %}
  87. secgrp:
  88. type: comma_delimited_list
  89. label: Security groups
  90. description: Security group resources
  91. api_lb_pool:
  92. default: ''
  93. type: string
  94. label: API LoadBalancer pool ID
  95. description: API Loadbalancer pool resource
  96. router_lb_pool_http:
  97. type: string
  98. label: Router LoadBalancer pool ID for HTTP
  99. default: ""
  100. router_lb_pool_https:
  101. type: string
  102. label: Router LoadBalancer pool ID for HTTPS
  103. default: ""
  104. {% if openshift_use_kuryr|default(false)|bool %}
  105. pod_secgrp:
  106. type: comma_delimited_list
  107. label: Subports Security groups
  108. description: Security group resources for subports
  109. default: ''
  110. {% endif %}
  111. attach_float_net:
  112. type: boolean
  113. default: true
  114. label: Attach-float-net
  115. description: A switch for floating network port connection
  116. floating_network:
  117. type: string
  118. default: ''
  119. label: Floating network
  120. description: Network to allocate floating IP from
  121. availability_zone:
  122. type: string
  123. description: The Availability Zone to launch the instance.
  124. default: nova
  125. volume_size:
  126. type: number
  127. description: Size of the volume to be created.
  128. default: 1
  129. constraints:
  130. - range: { min: 1, max: 1024 }
  131. description: must be between 1 and 1024 Gb.
  132. node_labels:
  133. type: json
  134. description: OpenShift Node Labels
  135. default: {"region": "default" }
  136. scheduler_hints:
  137. type: json
  138. description: Server scheduler hints.
  139. default: {}
  140. outputs:
  141. name:
  142. description: Name of the server
  143. value: { get_attr: [ server, name ] }
  144. private_ip:
  145. description: Private IP of the server
  146. value:
  147. get_attr:
  148. - server
  149. - addresses
  150. - { get_param: net_name }
  151. - 0
  152. - addr
  153. floating_ip:
  154. description: Floating IP of the server
  155. value:
  156. get_attr:
  157. - server
  158. - addresses
  159. - { get_param: net_name }
  160. {% if openshift_openstack_provider_network_name %}
  161. - 0
  162. {% else %}
  163. - 1
  164. {% endif %}
  165. - addr
  166. conditions:
  167. no_floating: {not: { get_param: attach_float_net} }
  168. {% if openshift_use_flannel|default(False)|bool %}
  169. no_data_subnet: {not: { get_param: attach_data_net} }
  170. {% endif %}
  171. resources:
  172. server:
  173. type: OS::Nova::Server
  174. properties:
  175. name: { get_param: name }
  176. key_name: { get_param: key_name }
  177. image: { get_param: image }
  178. flavor: { get_param: flavor }
  179. networks:
  180. {% if openshift_use_flannel|default(False)|bool %}
  181. if:
  182. - no_data_subnet
  183. - - port: { get_resource: port }
  184. - - port: { get_resource: port }
  185. - port: { get_resource: data_port }
  186. {% else %}
  187. {% if use_trunk_ports|default(False)|bool %}
  188. - port: { get_attr: [trunk_port, port_id]}
  189. {% else %}
  190. - port: { get_resource: port }
  191. {% endif %}
  192. {% endif %}
  193. user_data:
  194. get_file: user-data
  195. user_data_format: RAW
  196. user_data_update_policy: IGNORE
  197. metadata:
  198. group: { get_param: group }
  199. environment: { get_param: cluster_env }
  200. clusterid: { get_param: cluster_id }
  201. host-type: { get_param: type }
  202. sub-host-type: { get_param: subtype }
  203. node_labels: { get_param: node_labels }
  204. {% if openshift_openstack_dns_nameservers %}
  205. openshift_hostname: { get_param: name }
  206. {% endif %}
  207. scheduler_hints: { get_param: scheduler_hints }
  208. {% if use_trunk_ports|default(false)|bool %}
  209. trunk_port:
  210. type: OS::Neutron::Trunk
  211. properties:
  212. name: { get_param: name }
  213. port: { get_resource: port }
  214. {% if openshift_kuryr_precreate_subports|default(false) %}
  215. sub_ports:
  216. repeat:
  217. for_each:
  218. <%port%>: { get_attr: [subports, subport_id] }
  219. <%vlan_id%>: { get_attr: [segmentation, vlan_ids] }
  220. template:
  221. port: <%port%>
  222. segmentation_type: vlan
  223. segmentation_id: <%vlan_id%>
  224. permutations: false
  225. segmentation:
  226. type: segmentation_ids.yaml
  227. properties:
  228. number_of_vlan_ids: {{ openshift_kuryr_precreate_subports }}
  229. subports:
  230. type: OS::Heat::ResourceGroup
  231. properties:
  232. count: {{ openshift_kuryr_precreate_subports }}
  233. resource_def:
  234. type: subports.yaml
  235. properties:
  236. network: { get_param: pod_net }
  237. subnet: { get_param: pod_subnet }
  238. pod_access_sg: { get_param: pod_secgrp }
  239. {% endif %}
  240. {% endif %}
  241. port:
  242. type: OS::Neutron::Port
  243. properties:
  244. network: { get_param: net }
  245. {% if not openshift_openstack_provider_network_name %}
  246. fixed_ips:
  247. - subnet: { get_param: subnet }
  248. {% endif %}
  249. security_groups: { get_param: secgrp }
  250. {% if openshift_use_flannel|default(False)|bool %}
  251. data_port:
  252. type: OS::Neutron::Port
  253. condition: { not: no_data_subnet }
  254. properties:
  255. network: { get_param: data_net }
  256. port_security_enabled: false
  257. {% if not openshift_openstack_provider_network_name %}
  258. fixed_ips:
  259. - subnet: { get_param: data_subnet }
  260. {% endif %}
  261. {% endif %}
  262. {% if not openshift_openstack_provider_network_name %}
  263. floating-ip:
  264. condition: { not: no_floating }
  265. type: OS::Neutron::FloatingIP
  266. properties:
  267. floating_network: { get_param: floating_network }
  268. port_id: { get_resource: port }
  269. {% endif %}
  270. {% if not openshift_openstack_ephemeral_volumes|default(false)|bool %}
  271. cinder_volume:
  272. type: OS::Cinder::Volume
  273. properties:
  274. size: { get_param: volume_size }
  275. availability_zone: { get_param: availability_zone }
  276. metadata:
  277. purpose: openshift_docker_storage
  278. volume_attachment:
  279. type: OS::Cinder::VolumeAttachment
  280. properties:
  281. volume_id: { get_resource: cinder_volume }
  282. instance_uuid: { get_resource: server }
  283. {% endif %}
  284. api_lb_member:
  285. type: OS::{{ openshift_openstack_lbaasv2_provider }}::PoolMember
  286. condition:
  287. not: {equals: [{get_param: api_lb_pool}, ""]}
  288. properties:
  289. pool: { get_param: api_lb_pool }
  290. protocol_port: {{ openshift_master_api_port }}
  291. address: { get_attr: [server, first_address]}
  292. {% if openshift_openstack_lbaasv2_provider != "Octavia" %}
  293. subnet: { get_param: subnet }
  294. {% endif %}
  295. router_lb_pool_member_http:
  296. condition:
  297. not: {equals: [{get_param: router_lb_pool_http}, ""]}
  298. type: OS::{{ openshift_openstack_lbaasv2_provider }}::PoolMember
  299. properties:
  300. pool: { get_param: router_lb_pool_http }
  301. protocol_port: 80
  302. address: { get_attr: [server, first_address]}
  303. subnet: { get_param: subnet }
  304. router_lb_pool_member_https:
  305. condition:
  306. not: {equals: [{get_param: router_lb_pool_https}, ""]}
  307. type: OS::{{ openshift_openstack_lbaasv2_provider }}::PoolMember
  308. properties:
  309. pool: { get_param: router_lb_pool_https }
  310. protocol_port: 443
  311. address: { get_attr: [server, first_address]}
  312. subnet: { get_param: subnet }