heat_stack.yaml.j2 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. heat_template_version: 2016-10-14
  2. description: OpenShift cluster
  3. parameters:
  4. outputs:
  5. etcd_names:
  6. description: Name of the etcds
  7. value: { get_attr: [ etcd, name ] }
  8. etcd_ips:
  9. description: IPs of the etcds
  10. value: { get_attr: [ etcd, private_ip ] }
  11. etcd_floating_ips:
  12. description: Floating IPs of the etcds
  13. value: { get_attr: [ etcd, floating_ip ] }
  14. master_names:
  15. description: Name of the masters
  16. value: { get_attr: [ masters, name ] }
  17. master_ips:
  18. description: IPs of the masters
  19. value: { get_attr: [ masters, private_ip ] }
  20. master_floating_ips:
  21. description: Floating IPs of the masters
  22. value: { get_attr: [ masters, floating_ip ] }
  23. node_names:
  24. description: Name of the nodes
  25. value: { get_attr: [ compute_nodes, name ] }
  26. node_ips:
  27. description: IPs of the nodes
  28. value: { get_attr: [ compute_nodes, private_ip ] }
  29. node_floating_ips:
  30. description: Floating IPs of the nodes
  31. value: { get_attr: [ compute_nodes, floating_ip ] }
  32. infra_names:
  33. description: Name of the nodes
  34. value: { get_attr: [ infra_nodes, name ] }
  35. infra_ips:
  36. description: IPs of the nodes
  37. value: { get_attr: [ infra_nodes, private_ip ] }
  38. infra_floating_ips:
  39. description: Floating IPs of the nodes
  40. value: { get_attr: [ infra_nodes, floating_ip ] }
  41. {% if openshift_openstack_num_dns|int > 0 %}
  42. dns_name:
  43. description: Name of the DNS
  44. value:
  45. get_attr:
  46. - dns
  47. - name
  48. dns_floating_ips:
  49. description: Floating IPs of the DNS
  50. value: { get_attr: [ dns, floating_ip ] }
  51. dns_private_ips:
  52. description: Private IPs of the DNS
  53. value: { get_attr: [ dns, private_ip ] }
  54. {% endif %}
  55. conditions:
  56. no_floating: {% if openshift_openstack_provider_network_name %}true{% else %}false{% endif %}
  57. resources:
  58. {% if not openshift_openstack_provider_network_name %}
  59. net:
  60. type: OS::Neutron::Net
  61. properties:
  62. name:
  63. str_replace:
  64. template: openshift-ansible-cluster_id-net
  65. params:
  66. cluster_id: {{ openshift_openstack_stack_name }}
  67. subnet:
  68. type: OS::Neutron::Subnet
  69. properties:
  70. name:
  71. str_replace:
  72. template: openshift-ansible-cluster_id-subnet
  73. params:
  74. cluster_id: {{ openshift_openstack_stack_name }}
  75. network: { get_resource: net }
  76. cidr:
  77. str_replace:
  78. template: subnet_24_prefix.0/24
  79. params:
  80. subnet_24_prefix: {{ openshift_openstack_subnet_prefix }}
  81. allocation_pools:
  82. - start:
  83. str_replace:
  84. template: subnet_24_prefix.3
  85. params:
  86. subnet_24_prefix: {{ openshift_openstack_subnet_prefix }}
  87. end:
  88. str_replace:
  89. template: subnet_24_prefix.254
  90. params:
  91. subnet_24_prefix: {{ openshift_openstack_subnet_prefix }}
  92. dns_nameservers:
  93. {% for nameserver in openshift_openstack_dns_nameservers %}
  94. - {{ nameserver }}
  95. {% endfor %}
  96. {% if openshift_use_flannel|default(False)|bool %}
  97. data_net:
  98. type: OS::Neutron::Net
  99. properties:
  100. name: openshift-ansible-{{ openshift_openstack_stack_name }}-data-net
  101. port_security_enabled: false
  102. data_subnet:
  103. type: OS::Neutron::Subnet
  104. properties:
  105. name: openshift-ansible-{{ openshift_openstack_stack_name }}-data-subnet
  106. network: { get_resource: data_net }
  107. cidr: {{ osm_cluster_network_cidr|default('10.128.0.0/14') }}
  108. gateway_ip: null
  109. {% endif %}
  110. router:
  111. type: OS::Neutron::Router
  112. properties:
  113. name:
  114. str_replace:
  115. template: openshift-ansible-cluster_id-router
  116. params:
  117. cluster_id: {{ openshift_openstack_stack_name }}
  118. external_gateway_info:
  119. network: {{ openshift_openstack_external_network_name }}
  120. interface:
  121. type: OS::Neutron::RouterInterface
  122. properties:
  123. router_id: { get_resource: router }
  124. subnet_id: { get_resource: subnet }
  125. {% endif %}
  126. # keypair:
  127. # type: OS::Nova::KeyPair
  128. # properties:
  129. # name:
  130. # str_replace:
  131. # template: openshift-ansible-cluster_id-keypair
  132. # params:
  133. # cluster_id: {{ openshift_openstack_stack_name }}
  134. # public_key: {{ openshift_openstack_keypair_name }}
  135. common-secgrp:
  136. type: OS::Neutron::SecurityGroup
  137. properties:
  138. name:
  139. str_replace:
  140. template: openshift-ansible-cluster_id-common-secgrp
  141. params:
  142. cluster_id: {{ openshift_openstack_stack_name }}
  143. description:
  144. str_replace:
  145. template: Basic ssh/icmp security group for cluster_id OpenShift cluster
  146. params:
  147. cluster_id: {{ openshift_openstack_stack_name }}
  148. rules:
  149. - direction: ingress
  150. protocol: tcp
  151. port_range_min: 22
  152. port_range_max: 22
  153. remote_ip_prefix: {{ openshift_openstack_ssh_ingress_cidr }}
  154. - direction: ingress
  155. protocol: icmp
  156. remote_ip_prefix: {{ openshift_openstack_ssh_ingress_cidr }}
  157. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  158. flat-secgrp:
  159. type: OS::Neutron::SecurityGroup
  160. properties:
  161. name:
  162. str_replace:
  163. template: openshift-ansible-cluster_id-flat-secgrp
  164. params:
  165. cluster_id: {{ openshift_openstack_stack_name }}
  166. description:
  167. str_replace:
  168. template: Security group for cluster_id OpenShift cluster
  169. params:
  170. cluster_id: {{ openshift_openstack_stack_name }}
  171. rules:
  172. - direction: ingress
  173. protocol: tcp
  174. port_range_min: 4001
  175. port_range_max: 4001
  176. - direction: ingress
  177. protocol: tcp
  178. port_range_min: {{ openshift_master_api_port|default(8443) }}
  179. port_range_max: {{ openshift_master_api_port|default(8443) }}
  180. - direction: ingress
  181. protocol: tcp
  182. port_range_min: {{ openshift_master_console_port|default(8443) }}
  183. port_range_max: {{ openshift_master_console_port|default(8443) }}
  184. - direction: ingress
  185. protocol: tcp
  186. port_range_min: 8053
  187. port_range_max: 8053
  188. - direction: ingress
  189. protocol: udp
  190. port_range_min: 8053
  191. port_range_max: 8053
  192. - direction: ingress
  193. protocol: tcp
  194. port_range_min: 24224
  195. port_range_max: 24224
  196. - direction: ingress
  197. protocol: udp
  198. port_range_min: 24224
  199. port_range_max: 24224
  200. - direction: ingress
  201. protocol: tcp
  202. port_range_min: 2224
  203. port_range_max: 2224
  204. - direction: ingress
  205. protocol: udp
  206. port_range_min: 5404
  207. port_range_max: 5405
  208. - direction: ingress
  209. protocol: tcp
  210. port_range_min: 9090
  211. port_range_max: 9090
  212. - direction: ingress
  213. protocol: tcp
  214. port_range_min: 2379
  215. port_range_max: 2380
  216. remote_mode: remote_group_id
  217. - direction: ingress
  218. protocol: tcp
  219. port_range_min: 10250
  220. port_range_max: 10250
  221. remote_mode: remote_group_id
  222. - direction: ingress
  223. protocol: udp
  224. port_range_min: 10250
  225. port_range_max: 10250
  226. remote_mode: remote_group_id
  227. - direction: ingress
  228. protocol: tcp
  229. port_range_min: 10255
  230. port_range_max: 10255
  231. remote_mode: remote_group_id
  232. - direction: ingress
  233. protocol: udp
  234. port_range_min: 10255
  235. port_range_max: 10255
  236. remote_mode: remote_group_id
  237. - direction: ingress
  238. protocol: udp
  239. port_range_min: 4789
  240. port_range_max: 4789
  241. remote_mode: remote_group_id
  242. - direction: ingress
  243. protocol: tcp
  244. port_range_min: 30000
  245. port_range_max: 32767
  246. remote_ip_prefix: {{ openshift_openstack_node_ingress_cidr }}
  247. - direction: ingress
  248. protocol: tcp
  249. port_range_min: 30000
  250. port_range_max: 32767
  251. remote_ip_prefix: "{{ openshift_openstack_subnet_prefix }}.0/24"
  252. {% else %}
  253. master-secgrp:
  254. type: OS::Neutron::SecurityGroup
  255. properties:
  256. name:
  257. str_replace:
  258. template: openshift-ansible-cluster_id-master-secgrp
  259. params:
  260. cluster_id: {{ openshift_openstack_stack_name }}
  261. description:
  262. str_replace:
  263. template: Security group for cluster_id OpenShift cluster master
  264. params:
  265. cluster_id: {{ openshift_openstack_stack_name }}
  266. rules:
  267. - direction: ingress
  268. protocol: tcp
  269. port_range_min: 4001
  270. port_range_max: 4001
  271. - direction: ingress
  272. protocol: tcp
  273. port_range_min: {{ openshift_master_api_port|default(8443) }}
  274. port_range_max: {{ openshift_master_api_port|default(8443) }}
  275. - direction: ingress
  276. protocol: tcp
  277. port_range_min: {{ openshift_master_console_port|default(8443) }}
  278. port_range_max: {{ openshift_master_console_port|default(8443) }}
  279. - direction: ingress
  280. protocol: tcp
  281. port_range_min: 8053
  282. port_range_max: 8053
  283. - direction: ingress
  284. protocol: udp
  285. port_range_min: 8053
  286. port_range_max: 8053
  287. - direction: ingress
  288. protocol: tcp
  289. port_range_min: 24224
  290. port_range_max: 24224
  291. - direction: ingress
  292. protocol: udp
  293. port_range_min: 24224
  294. port_range_max: 24224
  295. - direction: ingress
  296. protocol: tcp
  297. port_range_min: 2224
  298. port_range_max: 2224
  299. - direction: ingress
  300. protocol: udp
  301. port_range_min: 5404
  302. port_range_max: 5405
  303. - direction: ingress
  304. protocol: tcp
  305. port_range_min: 9090
  306. port_range_max: 9090
  307. {% if openshift_use_flannel|default(False)|bool %}
  308. - direction: ingress
  309. protocol: tcp
  310. port_range_min: 2379
  311. port_range_max: 2379
  312. {% endif %}
  313. etcd-secgrp:
  314. type: OS::Neutron::SecurityGroup
  315. properties:
  316. name:
  317. str_replace:
  318. template: openshift-ansible-cluster_id-etcd-secgrp
  319. params:
  320. cluster_id: {{ openshift_openstack_stack_name }}
  321. description:
  322. str_replace:
  323. template: Security group for cluster_id etcd cluster
  324. params:
  325. cluster_id: {{ openshift_openstack_stack_name }}
  326. rules:
  327. - direction: ingress
  328. protocol: tcp
  329. port_range_min: 2379
  330. port_range_max: 2379
  331. remote_mode: remote_group_id
  332. remote_group_id: { get_resource: master-secgrp }
  333. - direction: ingress
  334. protocol: tcp
  335. port_range_min: 2380
  336. port_range_max: 2380
  337. remote_mode: remote_group_id
  338. node-secgrp:
  339. type: OS::Neutron::SecurityGroup
  340. properties:
  341. name:
  342. str_replace:
  343. template: openshift-ansible-cluster_id-node-secgrp
  344. params:
  345. cluster_id: {{ openshift_openstack_stack_name }}
  346. description:
  347. str_replace:
  348. template: Security group for cluster_id OpenShift cluster nodes
  349. params:
  350. cluster_id: {{ openshift_openstack_stack_name }}
  351. rules:
  352. - direction: ingress
  353. protocol: tcp
  354. port_range_min: 10250
  355. port_range_max: 10250
  356. remote_mode: remote_group_id
  357. - direction: ingress
  358. protocol: tcp
  359. port_range_min: 10255
  360. port_range_max: 10255
  361. remote_mode: remote_group_id
  362. - direction: ingress
  363. protocol: udp
  364. port_range_min: 10255
  365. port_range_max: 10255
  366. remote_mode: remote_group_id
  367. - direction: ingress
  368. protocol: udp
  369. port_range_min: 4789
  370. port_range_max: 4789
  371. remote_mode: remote_group_id
  372. - direction: ingress
  373. protocol: tcp
  374. port_range_min: 30000
  375. port_range_max: 32767
  376. remote_ip_prefix: {{ openshift_openstack_node_ingress_cidr }}
  377. - direction: ingress
  378. protocol: tcp
  379. port_range_min: 30000
  380. port_range_max: 32767
  381. remote_ip_prefix: "{{ openshift_openstack_subnet_prefix }}.0/24"
  382. {% endif %}
  383. infra-secgrp:
  384. type: OS::Neutron::SecurityGroup
  385. properties:
  386. name:
  387. str_replace:
  388. template: openshift-ansible-cluster_id-infra-secgrp
  389. params:
  390. cluster_id: {{ openshift_openstack_stack_name }}
  391. description:
  392. str_replace:
  393. template: Security group for cluster_id OpenShift infrastructure cluster nodes
  394. params:
  395. cluster_id: {{ openshift_openstack_stack_name }}
  396. rules:
  397. - direction: ingress
  398. protocol: tcp
  399. port_range_min: 80
  400. port_range_max: 80
  401. - direction: ingress
  402. protocol: tcp
  403. port_range_min: 443
  404. port_range_max: 443
  405. {% if openshift_openstack_num_dns|int > 0 %}
  406. dns-secgrp:
  407. type: OS::Neutron::SecurityGroup
  408. properties:
  409. name:
  410. str_replace:
  411. template: openshift-ansible-cluster_id-dns-secgrp
  412. params:
  413. cluster_id: {{ openshift_openstack_stack_name }}
  414. description:
  415. str_replace:
  416. template: Security group for cluster_id cluster DNS
  417. params:
  418. cluster_id: {{ openshift_openstack_stack_name }}
  419. rules:
  420. - direction: ingress
  421. protocol: udp
  422. port_range_min: 53
  423. port_range_max: 53
  424. remote_ip_prefix: {{ openshift_openstack_node_ingress_cidr }}
  425. - direction: ingress
  426. protocol: udp
  427. port_range_min: 53
  428. port_range_max: 53
  429. remote_ip_prefix: "{{ openshift_openstack_subnet_prefix }}.0/24"
  430. - direction: ingress
  431. protocol: tcp
  432. port_range_min: 53
  433. port_range_max: 53
  434. remote_ip_prefix: {{ openshift_openstack_node_ingress_cidr }}
  435. - direction: ingress
  436. protocol: tcp
  437. port_range_min: 53
  438. port_range_max: 53
  439. remote_ip_prefix: "{{ openshift_openstack_subnet_prefix }}.0/24"
  440. {% endif %}
  441. {% if openshift_openstack_num_masters|int > 1 %}
  442. lb-secgrp:
  443. type: OS::Neutron::SecurityGroup
  444. properties:
  445. name: openshift-ansible-{{ openshift_openstack_stack_name }}-lb-secgrp
  446. description: Security group for {{ openshift_openstack_stack_name }} cluster Load Balancer
  447. rules:
  448. - direction: ingress
  449. protocol: tcp
  450. port_range_min: {{ openshift_master_api_port | default(8443) }}
  451. port_range_max: {{ openshift_master_api_port | default(8443) }}
  452. remote_ip_prefix: {{ openshift_openstack_lb_ingress_cidr }}
  453. {% if openshift_master_console_port is defined and openshift_master_console_port != openshift_master_api_port %}
  454. - direction: ingress
  455. protocol: tcp
  456. port_range_min: {{ openshift_master_console_port | default(8443) }}
  457. port_range_max: {{ openshift_master_console_port | default(8443) }}
  458. remote_ip_prefix: {{ openshift_openstack_lb_ingress_cidr }}
  459. {% endif %}
  460. {% endif %}
  461. etcd:
  462. type: OS::Heat::ResourceGroup
  463. properties:
  464. count: {{ openshift_openstack_num_etcd }}
  465. resource_def:
  466. type: server.yaml
  467. properties:
  468. name:
  469. str_replace:
  470. template: k8s_type-%index%.cluster_id
  471. params:
  472. cluster_id: {{ openshift_openstack_stack_name }}
  473. k8s_type: {{ openshift_openstack_etcd_hostname }}
  474. cluster_env: {{ openshift_openstack_public_dns_domain }}
  475. cluster_id: {{ openshift_openstack_stack_name }}
  476. group:
  477. str_replace:
  478. template: k8s_type.cluster_id
  479. params:
  480. k8s_type: etcds
  481. cluster_id: {{ openshift_openstack_stack_name }}
  482. type: etcd
  483. image: {{ openshift_openstack_etcd_image }}
  484. flavor: {{ openshift_openstack_etcd_flavor }}
  485. key_name: {{ openshift_openstack_keypair_name }}
  486. {% if openshift_openstack_provider_network_name %}
  487. net: {{ openshift_openstack_provider_network_name }}
  488. net_name: {{ openshift_openstack_provider_network_name }}
  489. {% else %}
  490. net: { get_resource: net }
  491. subnet: { get_resource: subnet }
  492. net_name:
  493. str_replace:
  494. template: openshift-ansible-cluster_id-net
  495. params:
  496. cluster_id: {{ openshift_openstack_stack_name }}
  497. {% endif %}
  498. secgrp:
  499. - { get_resource: {% if openshift_openstack_flat_secgrp|default(False)|bool %}flat-secgrp{% else %}etcd-secgrp{% endif %} }
  500. - { get_resource: common-secgrp }
  501. floating_network:
  502. if:
  503. - no_floating
  504. - null
  505. - {{ openshift_openstack_external_network_name }}
  506. {% if openshift_openstack_provider_network_name %}
  507. attach_float_net: false
  508. {% endif %}
  509. volume_size: {{ openshift_openstack_etcd_volume_size }}
  510. {% if not openshift_openstack_provider_network_name %}
  511. depends_on:
  512. - interface
  513. {% endif %}
  514. {% if openshift_openstack_master_server_group_policies|length > 0 %}
  515. master_server_group:
  516. type: OS::Nova::ServerGroup
  517. properties:
  518. name: master_server_group
  519. policies: {{ openshift_openstack_master_server_group_policies }}
  520. {% endif %}
  521. {% if openshift_openstack_infra_server_group_policies|length > 0 %}
  522. infra_server_group:
  523. type: OS::Nova::ServerGroup
  524. properties:
  525. name: infra_server_group
  526. policies: {{ openshift_openstack_infra_server_group_policies }}
  527. {% endif %}
  528. {% if openshift_openstack_num_masters|int > 1 %}
  529. loadbalancer:
  530. type: OS::Heat::ResourceGroup
  531. properties:
  532. count: 1
  533. resource_def:
  534. type: server.yaml
  535. properties:
  536. name:
  537. str_replace:
  538. template: k8s_type-%index%.cluster_id
  539. params:
  540. cluster_id: {{ openshift_openstack_stack_name }}
  541. k8s_type: {{ openshift_openstack_lb_hostname }}
  542. cluster_env: {{ openshift_openstack_public_dns_domain }}
  543. cluster_id: {{ openshift_openstack_stack_name }}
  544. group:
  545. str_replace:
  546. template: k8s_type.cluster_id
  547. params:
  548. k8s_type: lb
  549. cluster_id: {{ openshift_openstack_stack_name }}
  550. type: lb
  551. image: {{ openshift_openstack_lb_image }}
  552. flavor: {{ openshift_openstack_lb_flavor }}
  553. key_name: {{ openshift_openstack_keypair_name }}
  554. {% if openshift_openstack_provider_network_name %}
  555. net: {{ openshift_openstack_provider_network_name }}
  556. net_name: {{ openshift_openstack_provider_network_name }}
  557. {% else %}
  558. net: { get_resource: net }
  559. subnet: { get_resource: subnet }
  560. net_name:
  561. str_replace:
  562. template: openshift-ansible-cluster_id-net
  563. params:
  564. cluster_id: {{ openshift_openstack_stack_name }}
  565. {% endif %}
  566. secgrp:
  567. - { get_resource: lb-secgrp }
  568. - { get_resource: common-secgrp }
  569. {% if not openshift_openstack_provider_network_name %}
  570. floating_network: {{ openshift_openstack_external_network_name }}
  571. {% endif %}
  572. volume_size: {{ openshift_openstack_lb_volume_size }}
  573. {% if not openshift_openstack_provider_network_name %}
  574. depends_on:
  575. - interface
  576. {% endif %}
  577. {% endif %}
  578. masters:
  579. type: OS::Heat::ResourceGroup
  580. properties:
  581. count: {{ openshift_openstack_num_masters }}
  582. resource_def:
  583. type: server.yaml
  584. properties:
  585. name:
  586. str_replace:
  587. template: k8s_type-%index%.cluster_id
  588. params:
  589. cluster_id: {{ openshift_openstack_stack_name }}
  590. k8s_type: {{ openshift_openstack_master_hostname }}
  591. cluster_env: {{ openshift_openstack_public_dns_domain }}
  592. cluster_id: {{ openshift_openstack_stack_name }}
  593. group:
  594. str_replace:
  595. template: k8s_type.cluster_id
  596. params:
  597. k8s_type: masters
  598. cluster_id: {{ openshift_openstack_stack_name }}
  599. type: master
  600. image: {{ openshift_openstack_master_image }}
  601. flavor: {{ openshift_openstack_master_flavor }}
  602. key_name: {{ openshift_openstack_keypair_name }}
  603. {% if openshift_openstack_provider_network_name %}
  604. net: {{ openshift_openstack_provider_network_name }}
  605. net_name: {{ openshift_openstack_provider_network_name }}
  606. {% else %}
  607. net: { get_resource: net }
  608. subnet: { get_resource: subnet }
  609. net_name:
  610. str_replace:
  611. template: openshift-ansible-cluster_id-net
  612. params:
  613. cluster_id: {{ openshift_openstack_stack_name }}
  614. {% if openshift_use_flannel|default(False)|bool %}
  615. attach_data_net: true
  616. data_net: { get_resource: data_net }
  617. data_subnet: { get_resource: data_subnet }
  618. {% endif %}
  619. {% endif %}
  620. secgrp:
  621. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  622. - { get_resource: flat-secgrp }
  623. {% else %}
  624. - { get_resource: master-secgrp }
  625. - { get_resource: node-secgrp }
  626. {% if openshift_openstack_num_etcd|int == 0 %}
  627. - { get_resource: etcd-secgrp }
  628. {% endif %}
  629. {% endif %}
  630. - { get_resource: common-secgrp }
  631. floating_network:
  632. if:
  633. - no_floating
  634. - null
  635. - {{ openshift_openstack_external_network_name }}
  636. {% if openshift_openstack_provider_network_name %}
  637. attach_float_net: false
  638. {% endif %}
  639. volume_size: {{ openshift_openstack_master_volume_size }}
  640. {% if openshift_openstack_master_server_group_policies|length > 0 %}
  641. scheduler_hints:
  642. group: { get_resource: master_server_group }
  643. {% endif %}
  644. {% if not openshift_openstack_provider_network_name %}
  645. depends_on:
  646. - interface
  647. {% endif %}
  648. compute_nodes:
  649. type: OS::Heat::ResourceGroup
  650. properties:
  651. count: {{ openshift_openstack_num_nodes }}
  652. removal_policies:
  653. - resource_list: {{ openshift_openstack_nodes_to_remove }}
  654. resource_def:
  655. type: server.yaml
  656. properties:
  657. name:
  658. str_replace:
  659. template: sub_type_k8s_type-%index%.cluster_id
  660. params:
  661. cluster_id: {{ openshift_openstack_stack_name }}
  662. sub_type_k8s_type: {{ openshift_openstack_node_hostname }}
  663. cluster_env: {{ openshift_openstack_public_dns_domain }}
  664. cluster_id: {{ openshift_openstack_stack_name }}
  665. group:
  666. str_replace:
  667. template: k8s_type.cluster_id
  668. params:
  669. k8s_type: nodes
  670. cluster_id: {{ openshift_openstack_stack_name }}
  671. type: node
  672. subtype: app
  673. node_labels:
  674. {% for k, v in openshift_openstack_cluster_node_labels.app.items() %}
  675. {{ k|e }}: {{ v|e }}
  676. {% endfor %}
  677. image: {{ openshift_openstack_node_image }}
  678. flavor: {{ openshift_openstack_node_flavor }}
  679. key_name: {{ openshift_openstack_keypair_name }}
  680. {% if openshift_openstack_provider_network_name %}
  681. net: {{ openshift_openstack_provider_network_name }}
  682. net_name: {{ openshift_openstack_provider_network_name }}
  683. {% else %}
  684. net: { get_resource: net }
  685. subnet: { get_resource: subnet }
  686. net_name:
  687. str_replace:
  688. template: openshift-ansible-cluster_id-net
  689. params:
  690. cluster_id: {{ openshift_openstack_stack_name }}
  691. {% if openshift_use_flannel|default(False)|bool %}
  692. attach_data_net: true
  693. data_net: { get_resource: data_net }
  694. data_subnet: { get_resource: data_subnet }
  695. {% endif %}
  696. {% endif %}
  697. secgrp:
  698. - { get_resource: {% if openshift_openstack_flat_secgrp|default(False)|bool %}flat-secgrp{% else %}node-secgrp{% endif %} }
  699. - { get_resource: common-secgrp }
  700. floating_network:
  701. if:
  702. - no_floating
  703. - null
  704. - {{ openshift_openstack_external_network_name }}
  705. {% if openshift_openstack_provider_network_name %}
  706. attach_float_net: false
  707. {% endif %}
  708. volume_size: {{ openshift_openstack_node_volume_size }}
  709. {% if not openshift_openstack_provider_network_name %}
  710. depends_on:
  711. - interface
  712. {% endif %}
  713. infra_nodes:
  714. type: OS::Heat::ResourceGroup
  715. properties:
  716. count: {{ openshift_openstack_num_infra }}
  717. resource_def:
  718. type: server.yaml
  719. properties:
  720. name:
  721. str_replace:
  722. template: sub_type_k8s_type-%index%.cluster_id
  723. params:
  724. cluster_id: {{ openshift_openstack_stack_name }}
  725. sub_type_k8s_type: {{ openshift_openstack_infra_hostname }}
  726. cluster_env: {{ openshift_openstack_public_dns_domain }}
  727. cluster_id: {{ openshift_openstack_stack_name }}
  728. group:
  729. str_replace:
  730. template: k8s_type.cluster_id
  731. params:
  732. k8s_type: infra
  733. cluster_id: {{ openshift_openstack_stack_name }}
  734. type: node
  735. subtype: infra
  736. node_labels:
  737. {% for k, v in openshift_openstack_cluster_node_labels.infra.items() %}
  738. {{ k|e }}: {{ v|e }}
  739. {% endfor %}
  740. image: {{ openshift_openstack_infra_image }}
  741. flavor: {{ openshift_openstack_infra_flavor }}
  742. key_name: {{ openshift_openstack_keypair_name }}
  743. {% if openshift_openstack_provider_network_name %}
  744. net: {{ openshift_openstack_provider_network_name }}
  745. net_name: {{ openshift_openstack_provider_network_name }}
  746. {% else %}
  747. net: { get_resource: net }
  748. subnet: { get_resource: subnet }
  749. net_name:
  750. str_replace:
  751. template: openshift-ansible-cluster_id-net
  752. params:
  753. cluster_id: {{ openshift_openstack_stack_name }}
  754. {% if openshift_use_flannel|default(False)|bool %}
  755. attach_data_net: true
  756. data_net: { get_resource: data_net }
  757. data_subnet: { get_resource: data_subnet }
  758. {% endif %}
  759. {% endif %}
  760. secgrp:
  761. # TODO(bogdando) filter only required node rules into infra-secgrp
  762. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  763. - { get_resource: flat-secgrp }
  764. {% else %}
  765. - { get_resource: node-secgrp }
  766. {% endif %}
  767. - { get_resource: infra-secgrp }
  768. - { get_resource: common-secgrp }
  769. {% if not openshift_openstack_provider_network_name %}
  770. floating_network: {{ openshift_openstack_external_network_name }}
  771. {% endif %}
  772. volume_size: {{ openshift_openstack_infra_volume_size }}
  773. {% if openshift_openstack_infra_server_group_policies|length > 0 %}
  774. scheduler_hints:
  775. group: { get_resource: infra_server_group }
  776. {% endif %}
  777. {% if not openshift_openstack_provider_network_name %}
  778. depends_on:
  779. - interface
  780. {% endif %}
  781. {% if openshift_openstack_num_dns|int > 0 %}
  782. dns:
  783. type: OS::Heat::ResourceGroup
  784. properties:
  785. count: {{ openshift_openstack_num_dns }}
  786. resource_def:
  787. type: server.yaml
  788. properties:
  789. name:
  790. str_replace:
  791. template: k8s_type-%index%.cluster_id
  792. params:
  793. cluster_id: {{ openshift_openstack_stack_name }}
  794. k8s_type: {{ openshift_openstack_dns_hostname }}
  795. cluster_env: {{ openshift_openstack_public_dns_domain }}
  796. cluster_id: {{ openshift_openstack_stack_name }}
  797. group:
  798. str_replace:
  799. template: k8s_type.cluster_id
  800. params:
  801. k8s_type: dns
  802. cluster_id: {{ openshift_openstack_stack_name }}
  803. type: dns
  804. image: {{ openshift_openstack_dns_image }}
  805. flavor: {{ openshift_openstack_dns_flavor }}
  806. key_name: {{ openshift_openstack_keypair_name }}
  807. {% if openshift_openstack_provider_network_name %}
  808. net: {{ openshift_openstack_provider_network_name }}
  809. net_name: {{ openshift_openstack_provider_network_name }}
  810. {% else %}
  811. net: { get_resource: net }
  812. subnet: { get_resource: subnet }
  813. net_name:
  814. str_replace:
  815. template: openshift-ansible-cluster_id-net
  816. params:
  817. cluster_id: {{ openshift_openstack_stack_name }}
  818. {% endif %}
  819. secgrp:
  820. - { get_resource: dns-secgrp }
  821. - { get_resource: common-secgrp }
  822. {% if not openshift_openstack_provider_network_name %}
  823. floating_network: {{ openshift_openstack_external_network_name }}
  824. {% endif %}
  825. volume_size: {{ openshift_openstack_dns_volume_size }}
  826. {% if not openshift_openstack_provider_network_name %}
  827. depends_on:
  828. - interface
  829. {% endif %}
  830. {% endif %}