heat_stack_server.yaml.j2 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. {% if openshift_use_kuryr|default(false)|bool %}
  92. api_lb_pool:
  93. default: ''
  94. type: string
  95. label: API LoadBalancer pool ID
  96. description: API Loadbalancer pool resource
  97. {% endif %}
  98. {% if openshift_use_kuryr|default(false)|bool %}
  99. pod_secgrp:
  100. type: comma_delimited_list
  101. label: Subports Security groups
  102. description: Security group resources for subports
  103. default: ''
  104. {% endif %}
  105. attach_float_net:
  106. type: boolean
  107. default: true
  108. label: Attach-float-net
  109. description: A switch for floating network port connection
  110. floating_network:
  111. type: string
  112. default: ''
  113. label: Floating network
  114. description: Network to allocate floating IP from
  115. availability_zone:
  116. type: string
  117. description: The Availability Zone to launch the instance.
  118. default: nova
  119. volume_size:
  120. type: number
  121. description: Size of the volume to be created.
  122. default: 1
  123. constraints:
  124. - range: { min: 1, max: 1024 }
  125. description: must be between 1 and 1024 Gb.
  126. node_labels:
  127. type: json
  128. description: OpenShift Node Labels
  129. default: {"region": "default" }
  130. scheduler_hints:
  131. type: json
  132. description: Server scheduler hints.
  133. default: {}
  134. outputs:
  135. name:
  136. description: Name of the server
  137. value: { get_attr: [ server, name ] }
  138. private_ip:
  139. description: Private IP of the server
  140. value:
  141. get_attr:
  142. - server
  143. - addresses
  144. - { get_param: net_name }
  145. - 0
  146. - addr
  147. floating_ip:
  148. description: Floating IP of the server
  149. value:
  150. get_attr:
  151. - server
  152. - addresses
  153. - { get_param: net_name }
  154. {% if openshift_openstack_provider_network_name %}
  155. - 0
  156. {% else %}
  157. - 1
  158. {% endif %}
  159. - addr
  160. conditions:
  161. no_floating: {not: { get_param: attach_float_net} }
  162. {% if openshift_use_flannel|default(False)|bool %}
  163. no_data_subnet: {not: { get_param: attach_data_net} }
  164. {% endif %}
  165. resources:
  166. server:
  167. type: OS::Nova::Server
  168. properties:
  169. name: { get_param: name }
  170. key_name: { get_param: key_name }
  171. image: { get_param: image }
  172. flavor: { get_param: flavor }
  173. networks:
  174. {% if openshift_use_flannel|default(False)|bool %}
  175. if:
  176. - no_data_subnet
  177. - - port: { get_resource: port }
  178. - - port: { get_resource: port }
  179. - port: { get_resource: data_port }
  180. {% else %}
  181. {% if use_trunk_ports|default(False)|bool %}
  182. - port: { get_attr: [trunk_port, port_id]}
  183. {% else %}
  184. - port: { get_resource: port }
  185. {% endif %}
  186. {% endif %}
  187. user_data:
  188. get_file: user-data
  189. user_data_format: RAW
  190. user_data_update_policy: IGNORE
  191. metadata:
  192. group: { get_param: group }
  193. environment: { get_param: cluster_env }
  194. clusterid: { get_param: cluster_id }
  195. host-type: { get_param: type }
  196. sub-host-type: { get_param: subtype }
  197. node_labels: { get_param: node_labels }
  198. {% if openshift_openstack_dns_nameservers %}
  199. openshift_hostname: { get_param: name }
  200. {% endif %}
  201. scheduler_hints: { get_param: scheduler_hints }
  202. {% if use_trunk_ports|default(false)|bool %}
  203. trunk_port:
  204. type: OS::Neutron::Trunk
  205. properties:
  206. name: { get_param: name }
  207. port: { get_resource: port }
  208. {% if openshift_kuryr_precreate_subports|default(false) %}
  209. sub_ports:
  210. repeat:
  211. for_each:
  212. <%port%>: { get_attr: [subports, subport_id] }
  213. <%vlan_id%>: { get_attr: [segmentation, vlan_ids] }
  214. template:
  215. port: <%port%>
  216. segmentation_type: vlan
  217. segmentation_id: <%vlan_id%>
  218. permutations: false
  219. segmentation:
  220. type: segmentation_ids.yaml
  221. properties:
  222. number_of_vlan_ids: {{ openshift_kuryr_precreate_subports }}
  223. subports:
  224. type: OS::Heat::ResourceGroup
  225. properties:
  226. count: {{ openshift_kuryr_precreate_subports }}
  227. resource_def:
  228. type: subports.yaml
  229. properties:
  230. network: { get_param: pod_net }
  231. subnet: { get_param: pod_subnet }
  232. pod_access_sg: { get_param: pod_secgrp }
  233. {% endif %}
  234. {% endif %}
  235. port:
  236. type: OS::Neutron::Port
  237. properties:
  238. network: { get_param: net }
  239. {% if not openshift_openstack_provider_network_name %}
  240. fixed_ips:
  241. - subnet: { get_param: subnet }
  242. {% endif %}
  243. security_groups: { get_param: secgrp }
  244. {% if openshift_use_flannel|default(False)|bool %}
  245. data_port:
  246. type: OS::Neutron::Port
  247. condition: { not: no_data_subnet }
  248. properties:
  249. network: { get_param: data_net }
  250. port_security_enabled: false
  251. {% if not openshift_openstack_provider_network_name %}
  252. fixed_ips:
  253. - subnet: { get_param: data_subnet }
  254. {% endif %}
  255. {% endif %}
  256. {% if not openshift_openstack_provider_network_name %}
  257. floating-ip:
  258. condition: { not: no_floating }
  259. type: OS::Neutron::FloatingIP
  260. properties:
  261. floating_network: { get_param: floating_network }
  262. port_id: { get_resource: port }
  263. {% endif %}
  264. {% if not openshift_openstack_ephemeral_volumes|default(false)|bool %}
  265. cinder_volume:
  266. type: OS::Cinder::Volume
  267. properties:
  268. size: { get_param: volume_size }
  269. availability_zone: { get_param: availability_zone }
  270. metadata:
  271. purpose: openshift_docker_storage
  272. volume_attachment:
  273. type: OS::Cinder::VolumeAttachment
  274. properties:
  275. volume_id: { get_resource: cinder_volume }
  276. instance_uuid: { get_resource: server }
  277. {% endif %}
  278. {% if openshift_use_kuryr|default(false)|bool %}
  279. lb_member:
  280. type: OS::Neutron::LBaaS::PoolMember
  281. condition:
  282. equals:
  283. - get_param: type
  284. - master
  285. properties:
  286. pool: { get_param: api_lb_pool }
  287. protocol_port: {{ openshift_master_api_port|default(8443) }}
  288. address: { get_attr: [server, first_address]}
  289. subnet: { get_param: subnet }
  290. {% endif %}