heat_stack_server.yaml.j2 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. heat_template_version: {{ openshift_openstack_heat_template_version }}
  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. openshift_node_group_name:
  133. type: string
  134. default: ''
  135. description: The openshift node group name for this server.
  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. str_replace:
  195. template: {get_file: user-data}
  196. params:
  197. "%OPENSHIFT_NODE_CONFIG_NAME%": { get_param: openshift_node_group_name }
  198. user_data_format: RAW
  199. user_data_update_policy: IGNORE
  200. metadata:
  201. group: { get_param: group }
  202. environment: { get_param: cluster_env }
  203. clusterid: { get_param: cluster_id }
  204. host-type: { get_param: type }
  205. sub-host-type: { get_param: subtype }
  206. openshift_node_group_name: { get_param: openshift_node_group_name }
  207. {% if openshift_openstack_dns_nameservers %}
  208. openshift_hostname: { get_param: name }
  209. {% endif %}
  210. scheduler_hints: { get_param: scheduler_hints }
  211. {% if use_trunk_ports|default(false)|bool %}
  212. trunk_port:
  213. type: OS::Neutron::Trunk
  214. properties:
  215. name: { get_param: name }
  216. port: { get_resource: port }
  217. {% if openshift_kuryr_precreate_subports|default(false) %}
  218. sub_ports:
  219. repeat:
  220. for_each:
  221. <%port%>: { get_attr: [subports, subport_id] }
  222. <%vlan_id%>: { get_attr: [segmentation, vlan_ids] }
  223. template:
  224. port: <%port%>
  225. segmentation_type: vlan
  226. segmentation_id: <%vlan_id%>
  227. permutations: false
  228. segmentation:
  229. type: segmentation_ids.yaml
  230. properties:
  231. number_of_vlan_ids: {{ openshift_kuryr_precreate_subports }}
  232. subports:
  233. type: OS::Heat::ResourceGroup
  234. properties:
  235. count: {{ openshift_kuryr_precreate_subports }}
  236. resource_def:
  237. type: subports.yaml
  238. properties:
  239. network: { get_param: pod_net }
  240. subnet: { get_param: pod_subnet }
  241. pod_access_sg: { get_param: pod_secgrp }
  242. {% endif %}
  243. {% endif %}
  244. port:
  245. type: OS::Neutron::Port
  246. properties:
  247. network: { get_param: net }
  248. {% if not openshift_openstack_provider_network_name %}
  249. fixed_ips:
  250. - subnet: { get_param: subnet }
  251. {% endif %}
  252. security_groups: { get_param: secgrp }
  253. {% if openshift_use_flannel|default(False)|bool %}
  254. data_port:
  255. type: OS::Neutron::Port
  256. condition: { not: no_data_subnet }
  257. properties:
  258. network: { get_param: data_net }
  259. port_security_enabled: false
  260. {% if not openshift_openstack_provider_network_name %}
  261. fixed_ips:
  262. - subnet: { get_param: data_subnet }
  263. {% endif %}
  264. {% endif %}
  265. {% if not openshift_openstack_provider_network_name %}
  266. floating-ip:
  267. condition: { not: no_floating }
  268. type: OS::Neutron::FloatingIP
  269. properties:
  270. floating_network: { get_param: floating_network }
  271. port_id: { get_resource: port }
  272. {% endif %}
  273. {% if not openshift_openstack_ephemeral_volumes|default(false)|bool %}
  274. cinder_volume:
  275. type: OS::Cinder::Volume
  276. properties:
  277. size: { get_param: volume_size }
  278. availability_zone: { get_param: availability_zone }
  279. metadata:
  280. purpose: openshift_docker_storage
  281. volume_attachment:
  282. type: OS::Cinder::VolumeAttachment
  283. properties:
  284. volume_id: { get_resource: cinder_volume }
  285. instance_uuid: { get_resource: server }
  286. {% endif %}
  287. api_lb_member:
  288. type: OS::{{ openshift_openstack_lbaasv2_provider }}::PoolMember
  289. condition:
  290. not: {equals: [{get_param: api_lb_pool}, ""]}
  291. properties:
  292. pool: { get_param: api_lb_pool }
  293. protocol_port: {{ openshift_master_api_port }}
  294. address: { get_attr: [server, first_address]}
  295. {% if openshift_openstack_lbaasv2_provider != "Octavia" %}
  296. subnet: { get_param: subnet }
  297. {% endif %}
  298. router_lb_pool_member_http:
  299. condition:
  300. not: {equals: [{get_param: router_lb_pool_http}, ""]}
  301. type: OS::{{ openshift_openstack_lbaasv2_provider }}::PoolMember
  302. properties:
  303. pool: { get_param: router_lb_pool_http }
  304. protocol_port: 80
  305. address: { get_attr: [server, first_address]}
  306. subnet: { get_param: subnet }
  307. router_lb_pool_member_https:
  308. condition:
  309. not: {equals: [{get_param: router_lb_pool_https}, ""]}
  310. type: OS::{{ openshift_openstack_lbaasv2_provider }}::PoolMember
  311. properties:
  312. pool: { get_param: router_lb_pool_https }
  313. protocol_port: 443
  314. address: { get_attr: [server, first_address]}
  315. subnet: { get_param: subnet }