heat_stack.yaml.j2 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  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 or openshift_openstack_use_bastion|bool %}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. {% if openshift_openstack_use_bastion|bool %}
  155. - direction: ingress
  156. protocol: tcp
  157. port_range_min: 22
  158. port_range_max: 22
  159. remote_ip_prefix: {{ openshift_openstack_bastion_ingress_cidr }}
  160. {% endif %}
  161. - direction: ingress
  162. protocol: icmp
  163. remote_ip_prefix: {{ openshift_openstack_ssh_ingress_cidr }}
  164. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  165. flat-secgrp:
  166. type: OS::Neutron::SecurityGroup
  167. properties:
  168. name:
  169. str_replace:
  170. template: openshift-ansible-cluster_id-flat-secgrp
  171. params:
  172. cluster_id: {{ openshift_openstack_stack_name }}
  173. description:
  174. str_replace:
  175. template: Security group for cluster_id OpenShift cluster
  176. params:
  177. cluster_id: {{ openshift_openstack_stack_name }}
  178. rules:
  179. - direction: ingress
  180. protocol: tcp
  181. port_range_min: 4001
  182. port_range_max: 4001
  183. - direction: ingress
  184. protocol: tcp
  185. port_range_min: {{ openshift_master_api_port|default(8443) }}
  186. port_range_max: {{ openshift_master_api_port|default(8443) }}
  187. - direction: ingress
  188. protocol: tcp
  189. port_range_min: {{ openshift_master_console_port|default(8443) }}
  190. port_range_max: {{ openshift_master_console_port|default(8443) }}
  191. - direction: ingress
  192. protocol: tcp
  193. port_range_min: 8053
  194. port_range_max: 8053
  195. - direction: ingress
  196. protocol: udp
  197. port_range_min: 8053
  198. port_range_max: 8053
  199. - direction: ingress
  200. protocol: tcp
  201. port_range_min: 24224
  202. port_range_max: 24224
  203. - direction: ingress
  204. protocol: udp
  205. port_range_min: 24224
  206. port_range_max: 24224
  207. - direction: ingress
  208. protocol: tcp
  209. port_range_min: 2224
  210. port_range_max: 2224
  211. - direction: ingress
  212. protocol: udp
  213. port_range_min: 5404
  214. port_range_max: 5405
  215. - direction: ingress
  216. protocol: tcp
  217. port_range_min: 9090
  218. port_range_max: 9090
  219. - direction: ingress
  220. protocol: tcp
  221. port_range_min: 2379
  222. port_range_max: 2380
  223. remote_mode: remote_group_id
  224. - direction: ingress
  225. protocol: tcp
  226. port_range_min: 10250
  227. port_range_max: 10250
  228. remote_mode: remote_group_id
  229. - direction: ingress
  230. protocol: udp
  231. port_range_min: 10250
  232. port_range_max: 10250
  233. remote_mode: remote_group_id
  234. - direction: ingress
  235. protocol: tcp
  236. port_range_min: 10255
  237. port_range_max: 10255
  238. remote_mode: remote_group_id
  239. - direction: ingress
  240. protocol: udp
  241. port_range_min: 10255
  242. port_range_max: 10255
  243. remote_mode: remote_group_id
  244. - direction: ingress
  245. protocol: udp
  246. port_range_min: 4789
  247. port_range_max: 4789
  248. remote_mode: remote_group_id
  249. - direction: ingress
  250. protocol: tcp
  251. port_range_min: 30000
  252. port_range_max: 32767
  253. remote_ip_prefix: {{ openshift_openstack_node_ingress_cidr }}
  254. - direction: ingress
  255. protocol: tcp
  256. port_range_min: 30000
  257. port_range_max: 32767
  258. remote_ip_prefix: "{{ openshift_openstack_subnet_prefix }}.0/24"
  259. {% else %}
  260. master-secgrp:
  261. type: OS::Neutron::SecurityGroup
  262. properties:
  263. name:
  264. str_replace:
  265. template: openshift-ansible-cluster_id-master-secgrp
  266. params:
  267. cluster_id: {{ openshift_openstack_stack_name }}
  268. description:
  269. str_replace:
  270. template: Security group for cluster_id OpenShift cluster master
  271. params:
  272. cluster_id: {{ openshift_openstack_stack_name }}
  273. rules:
  274. - direction: ingress
  275. protocol: tcp
  276. port_range_min: 4001
  277. port_range_max: 4001
  278. - direction: ingress
  279. protocol: tcp
  280. port_range_min: {{ openshift_master_api_port|default(8443) }}
  281. port_range_max: {{ openshift_master_api_port|default(8443) }}
  282. - direction: ingress
  283. protocol: tcp
  284. port_range_min: {{ openshift_master_console_port|default(8443) }}
  285. port_range_max: {{ openshift_master_console_port|default(8443) }}
  286. - direction: ingress
  287. protocol: tcp
  288. port_range_min: 8053
  289. port_range_max: 8053
  290. - direction: ingress
  291. protocol: udp
  292. port_range_min: 8053
  293. port_range_max: 8053
  294. - direction: ingress
  295. protocol: tcp
  296. port_range_min: 24224
  297. port_range_max: 24224
  298. - direction: ingress
  299. protocol: udp
  300. port_range_min: 24224
  301. port_range_max: 24224
  302. - direction: ingress
  303. protocol: tcp
  304. port_range_min: 2224
  305. port_range_max: 2224
  306. - direction: ingress
  307. protocol: udp
  308. port_range_min: 5404
  309. port_range_max: 5405
  310. - direction: ingress
  311. protocol: tcp
  312. port_range_min: 9090
  313. port_range_max: 9090
  314. {% if openshift_use_flannel|default(False)|bool %}
  315. - direction: ingress
  316. protocol: tcp
  317. port_range_min: 2379
  318. port_range_max: 2379
  319. {% endif %}
  320. etcd-secgrp:
  321. type: OS::Neutron::SecurityGroup
  322. properties:
  323. name:
  324. str_replace:
  325. template: openshift-ansible-cluster_id-etcd-secgrp
  326. params:
  327. cluster_id: {{ openshift_openstack_stack_name }}
  328. description:
  329. str_replace:
  330. template: Security group for cluster_id etcd cluster
  331. params:
  332. cluster_id: {{ openshift_openstack_stack_name }}
  333. rules:
  334. - direction: ingress
  335. protocol: tcp
  336. port_range_min: 2379
  337. port_range_max: 2379
  338. remote_mode: remote_group_id
  339. remote_group_id: { get_resource: master-secgrp }
  340. - direction: ingress
  341. protocol: tcp
  342. port_range_min: 2380
  343. port_range_max: 2380
  344. remote_mode: remote_group_id
  345. node-secgrp:
  346. type: OS::Neutron::SecurityGroup
  347. properties:
  348. name:
  349. str_replace:
  350. template: openshift-ansible-cluster_id-node-secgrp
  351. params:
  352. cluster_id: {{ openshift_openstack_stack_name }}
  353. description:
  354. str_replace:
  355. template: Security group for cluster_id OpenShift cluster nodes
  356. params:
  357. cluster_id: {{ openshift_openstack_stack_name }}
  358. rules:
  359. - direction: ingress
  360. protocol: tcp
  361. port_range_min: 10250
  362. port_range_max: 10250
  363. remote_mode: remote_group_id
  364. - direction: ingress
  365. protocol: tcp
  366. port_range_min: 10255
  367. port_range_max: 10255
  368. remote_mode: remote_group_id
  369. - direction: ingress
  370. protocol: udp
  371. port_range_min: 10255
  372. port_range_max: 10255
  373. remote_mode: remote_group_id
  374. - direction: ingress
  375. protocol: udp
  376. port_range_min: 4789
  377. port_range_max: 4789
  378. remote_mode: remote_group_id
  379. - direction: ingress
  380. protocol: tcp
  381. port_range_min: 30000
  382. port_range_max: 32767
  383. remote_ip_prefix: {{ openshift_openstack_node_ingress_cidr }}
  384. - direction: ingress
  385. protocol: tcp
  386. port_range_min: 30000
  387. port_range_max: 32767
  388. remote_ip_prefix: "{{ openshift_openstack_subnet_prefix }}.0/24"
  389. {% endif %}
  390. infra-secgrp:
  391. type: OS::Neutron::SecurityGroup
  392. properties:
  393. name:
  394. str_replace:
  395. template: openshift-ansible-cluster_id-infra-secgrp
  396. params:
  397. cluster_id: {{ openshift_openstack_stack_name }}
  398. description:
  399. str_replace:
  400. template: Security group for cluster_id OpenShift infrastructure cluster nodes
  401. params:
  402. cluster_id: {{ openshift_openstack_stack_name }}
  403. rules:
  404. - direction: ingress
  405. protocol: tcp
  406. port_range_min: 80
  407. port_range_max: 80
  408. - direction: ingress
  409. protocol: tcp
  410. port_range_min: 443
  411. port_range_max: 443
  412. {% if openshift_openstack_num_dns|int > 0 %}
  413. dns-secgrp:
  414. type: OS::Neutron::SecurityGroup
  415. properties:
  416. name:
  417. str_replace:
  418. template: openshift-ansible-cluster_id-dns-secgrp
  419. params:
  420. cluster_id: {{ openshift_openstack_stack_name }}
  421. description:
  422. str_replace:
  423. template: Security group for cluster_id cluster DNS
  424. params:
  425. cluster_id: {{ openshift_openstack_stack_name }}
  426. rules:
  427. - direction: ingress
  428. protocol: udp
  429. port_range_min: 53
  430. port_range_max: 53
  431. remote_ip_prefix: {{ openshift_openstack_node_ingress_cidr }}
  432. - direction: ingress
  433. protocol: udp
  434. port_range_min: 53
  435. port_range_max: 53
  436. remote_ip_prefix: "{{ openshift_openstack_subnet_prefix }}.0/24"
  437. - direction: ingress
  438. protocol: tcp
  439. port_range_min: 53
  440. port_range_max: 53
  441. remote_ip_prefix: {{ openshift_openstack_node_ingress_cidr }}
  442. - direction: ingress
  443. protocol: tcp
  444. port_range_min: 53
  445. port_range_max: 53
  446. remote_ip_prefix: "{{ openshift_openstack_subnet_prefix }}.0/24"
  447. {% endif %}
  448. {% if openshift_openstack_num_masters|int > 1 or openshift_openstack_ui_ssh_tunnel|bool %}
  449. lb-secgrp:
  450. type: OS::Neutron::SecurityGroup
  451. properties:
  452. name: openshift-ansible-{{ openshift_openstack_stack_name }}-lb-secgrp
  453. description: Security group for {{ openshift_openstack_stack_name }} cluster Load Balancer
  454. rules:
  455. - direction: ingress
  456. protocol: tcp
  457. port_range_min: {{ openshift_master_api_port | default(8443) }}
  458. port_range_max: {{ openshift_master_api_port | default(8443) }}
  459. remote_ip_prefix: {{ openshift_openstack_lb_ingress_cidr | default(openshift_openstack_bastion_ingress_cidr) }}
  460. {% if openshift_openstack_ui_ssh_tunnel|bool %}
  461. - direction: ingress
  462. protocol: tcp
  463. port_range_min: {{ openshift_master_api_port | default(8443) }}
  464. port_range_max: {{ openshift_master_api_port | default(8443) }}
  465. remote_ip_prefix: {{ openshift_openstack_ssh_ingress_cidr }}
  466. {% endif %}
  467. {% if openshift_master_console_port is defined and openshift_master_console_port != openshift_master_api_port %}
  468. - direction: ingress
  469. protocol: tcp
  470. port_range_min: {{ openshift_master_console_port | default(8443) }}
  471. port_range_max: {{ openshift_master_console_port | default(8443) }}
  472. remote_ip_prefix: {{ openshift_openstack_lb_ingress_cidr | default(openshift_openstack_bastion_ingress_cidr) }}
  473. {% endif %}
  474. {% endif %}
  475. etcd:
  476. type: OS::Heat::ResourceGroup
  477. properties:
  478. count: {{ openshift_openstack_num_etcd }}
  479. resource_def:
  480. type: server.yaml
  481. properties:
  482. name:
  483. str_replace:
  484. template: k8s_type-%index%.cluster_id
  485. params:
  486. cluster_id: {{ openshift_openstack_stack_name }}
  487. k8s_type: {{ openshift_openstack_etcd_hostname }}
  488. cluster_env: {{ openshift_openstack_public_dns_domain }}
  489. cluster_id: {{ openshift_openstack_stack_name }}
  490. group:
  491. str_replace:
  492. template: k8s_type.cluster_id
  493. params:
  494. k8s_type: etcds
  495. cluster_id: {{ openshift_openstack_stack_name }}
  496. type: etcd
  497. image: {{ openshift_openstack_etcd_image }}
  498. flavor: {{ openshift_openstack_etcd_flavor }}
  499. key_name: {{ openshift_openstack_keypair_name }}
  500. {% if openshift_openstack_provider_network_name %}
  501. net: {{ openshift_openstack_provider_network_name }}
  502. net_name: {{ openshift_openstack_provider_network_name }}
  503. {% else %}
  504. net: { get_resource: net }
  505. subnet: { get_resource: subnet }
  506. net_name:
  507. str_replace:
  508. template: openshift-ansible-cluster_id-net
  509. params:
  510. cluster_id: {{ openshift_openstack_stack_name }}
  511. {% endif %}
  512. secgrp:
  513. - { get_resource: {% if openshift_openstack_flat_secgrp|default(False)|bool %}flat-secgrp{% else %}etcd-secgrp{% endif %} }
  514. - { get_resource: common-secgrp }
  515. floating_network:
  516. if:
  517. - no_floating
  518. - null
  519. - {{ openshift_openstack_external_network_name }}
  520. {% if openshift_openstack_use_bastion|bool or openshift_openstack_provider_network_name %}
  521. attach_float_net: false
  522. {% endif %}
  523. volume_size: {{ openshift_openstack_etcd_volume_size }}
  524. {% if not openshift_openstack_provider_network_name %}
  525. depends_on:
  526. - interface
  527. {% endif %}
  528. {% if openshift_openstack_master_server_group_policies|length > 0 %}
  529. master_server_group:
  530. type: OS::Nova::ServerGroup
  531. properties:
  532. name: master_server_group
  533. policies: {{ openshift_openstack_master_server_group_policies }}
  534. {% endif %}
  535. {% if openshift_openstack_infra_server_group_policies|length > 0 %}
  536. infra_server_group:
  537. type: OS::Nova::ServerGroup
  538. properties:
  539. name: infra_server_group
  540. policies: {{ openshift_openstack_infra_server_group_policies }}
  541. {% endif %}
  542. {% if openshift_openstack_num_masters|int > 1 %}
  543. loadbalancer:
  544. type: OS::Heat::ResourceGroup
  545. properties:
  546. count: 1
  547. resource_def:
  548. type: server.yaml
  549. properties:
  550. name:
  551. str_replace:
  552. template: k8s_type-%index%.cluster_id
  553. params:
  554. cluster_id: {{ openshift_openstack_stack_name }}
  555. k8s_type: {{ openshift_openstack_lb_hostname }}
  556. cluster_env: {{ openshift_openstack_public_dns_domain }}
  557. cluster_id: {{ openshift_openstack_stack_name }}
  558. group:
  559. str_replace:
  560. template: k8s_type.cluster_id
  561. params:
  562. k8s_type: lb
  563. cluster_id: {{ openshift_openstack_stack_name }}
  564. type: lb
  565. image: {{ openshift_openstack_lb_image }}
  566. flavor: {{ openshift_openstack_lb_flavor }}
  567. key_name: {{ openshift_openstack_keypair_name }}
  568. {% if openshift_openstack_provider_network_name %}
  569. net: {{ openshift_openstack_provider_network_name }}
  570. net_name: {{ openshift_openstack_provider_network_name }}
  571. {% else %}
  572. net: { get_resource: net }
  573. subnet: { get_resource: subnet }
  574. net_name:
  575. str_replace:
  576. template: openshift-ansible-cluster_id-net
  577. params:
  578. cluster_id: {{ openshift_openstack_stack_name }}
  579. {% endif %}
  580. secgrp:
  581. - { get_resource: lb-secgrp }
  582. - { get_resource: common-secgrp }
  583. {% if not openshift_openstack_provider_network_name %}
  584. floating_network: {{ openshift_openstack_external_network_name }}
  585. {% endif %}
  586. volume_size: {{ openshift_openstack_lb_volume_size }}
  587. {% if not openshift_openstack_provider_network_name %}
  588. depends_on:
  589. - interface
  590. {% endif %}
  591. {% endif %}
  592. masters:
  593. type: OS::Heat::ResourceGroup
  594. properties:
  595. count: {{ openshift_openstack_num_masters }}
  596. resource_def:
  597. type: server.yaml
  598. properties:
  599. name:
  600. str_replace:
  601. template: k8s_type-%index%.cluster_id
  602. params:
  603. cluster_id: {{ openshift_openstack_stack_name }}
  604. k8s_type: {{ openshift_openstack_master_hostname }}
  605. cluster_env: {{ openshift_openstack_public_dns_domain }}
  606. cluster_id: {{ openshift_openstack_stack_name }}
  607. group:
  608. str_replace:
  609. template: k8s_type.cluster_id
  610. params:
  611. k8s_type: masters
  612. cluster_id: {{ openshift_openstack_stack_name }}
  613. type: master
  614. image: {{ openshift_openstack_master_image }}
  615. flavor: {{ openshift_openstack_master_flavor }}
  616. key_name: {{ openshift_openstack_keypair_name }}
  617. {% if openshift_openstack_provider_network_name %}
  618. net: {{ openshift_openstack_provider_network_name }}
  619. net_name: {{ openshift_openstack_provider_network_name }}
  620. {% else %}
  621. net: { get_resource: net }
  622. subnet: { get_resource: subnet }
  623. net_name:
  624. str_replace:
  625. template: openshift-ansible-cluster_id-net
  626. params:
  627. cluster_id: {{ openshift_openstack_stack_name }}
  628. {% if openshift_use_flannel|default(False)|bool %}
  629. attach_data_net: true
  630. data_net: { get_resource: data_net }
  631. data_subnet: { get_resource: data_subnet }
  632. {% endif %}
  633. {% endif %}
  634. secgrp:
  635. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  636. - { get_resource: flat-secgrp }
  637. {% else %}
  638. - { get_resource: master-secgrp }
  639. - { get_resource: node-secgrp }
  640. {% if openshift_openstack_num_etcd|int == 0 %}
  641. - { get_resource: etcd-secgrp }
  642. {% endif %}
  643. {% endif %}
  644. - { get_resource: common-secgrp }
  645. floating_network:
  646. if:
  647. - no_floating
  648. - null
  649. - {{ openshift_openstack_external_network_name }}
  650. {% if openshift_openstack_use_bastion|bool or openshift_openstack_provider_network_name %}
  651. attach_float_net: false
  652. {% endif %}
  653. volume_size: {{ openshift_openstack_master_volume_size }}
  654. {% if openshift_openstack_master_server_group_policies|length > 0 %}
  655. scheduler_hints:
  656. group: { get_resource: master_server_group }
  657. {% endif %}
  658. {% if not openshift_openstack_provider_network_name %}
  659. depends_on:
  660. - interface
  661. {% endif %}
  662. compute_nodes:
  663. type: OS::Heat::ResourceGroup
  664. properties:
  665. count: {{ openshift_openstack_num_nodes }}
  666. removal_policies:
  667. - resource_list: {{ openshift_openstack_nodes_to_remove }}
  668. resource_def:
  669. type: server.yaml
  670. properties:
  671. name:
  672. str_replace:
  673. template: sub_type_k8s_type-%index%.cluster_id
  674. params:
  675. cluster_id: {{ openshift_openstack_stack_name }}
  676. sub_type_k8s_type: {{ openshift_openstack_node_hostname }}
  677. cluster_env: {{ openshift_openstack_public_dns_domain }}
  678. cluster_id: {{ openshift_openstack_stack_name }}
  679. group:
  680. str_replace:
  681. template: k8s_type.cluster_id
  682. params:
  683. k8s_type: nodes
  684. cluster_id: {{ openshift_openstack_stack_name }}
  685. type: node
  686. subtype: app
  687. node_labels:
  688. {% for k, v in openshift_openstack_cluster_node_labels.app.iteritems() %}
  689. {{ k|e }}: {{ v|e }}
  690. {% endfor %}
  691. image: {{ openshift_openstack_node_image }}
  692. flavor: {{ openshift_openstack_node_flavor }}
  693. key_name: {{ openshift_openstack_keypair_name }}
  694. {% if openshift_openstack_provider_network_name %}
  695. net: {{ openshift_openstack_provider_network_name }}
  696. net_name: {{ openshift_openstack_provider_network_name }}
  697. {% else %}
  698. net: { get_resource: net }
  699. subnet: { get_resource: subnet }
  700. net_name:
  701. str_replace:
  702. template: openshift-ansible-cluster_id-net
  703. params:
  704. cluster_id: {{ openshift_openstack_stack_name }}
  705. {% if openshift_use_flannel|default(False)|bool %}
  706. attach_data_net: true
  707. data_net: { get_resource: data_net }
  708. data_subnet: { get_resource: data_subnet }
  709. {% endif %}
  710. {% endif %}
  711. secgrp:
  712. - { get_resource: {% if openshift_openstack_flat_secgrp|default(False)|bool %}flat-secgrp{% else %}node-secgrp{% endif %} }
  713. - { get_resource: common-secgrp }
  714. floating_network:
  715. if:
  716. - no_floating
  717. - null
  718. - {{ openshift_openstack_external_network_name }}
  719. {% if openshift_openstack_use_bastion|bool or openshift_openstack_provider_network_name %}
  720. attach_float_net: false
  721. {% endif %}
  722. volume_size: {{ openshift_openstack_node_volume_size }}
  723. {% if not openshift_openstack_provider_network_name %}
  724. depends_on:
  725. - interface
  726. {% endif %}
  727. infra_nodes:
  728. type: OS::Heat::ResourceGroup
  729. properties:
  730. count: {{ openshift_openstack_num_infra }}
  731. resource_def:
  732. type: server.yaml
  733. properties:
  734. name:
  735. str_replace:
  736. template: sub_type_k8s_type-%index%.cluster_id
  737. params:
  738. cluster_id: {{ openshift_openstack_stack_name }}
  739. sub_type_k8s_type: {{ openshift_openstack_infra_hostname }}
  740. cluster_env: {{ openshift_openstack_public_dns_domain }}
  741. cluster_id: {{ openshift_openstack_stack_name }}
  742. group:
  743. str_replace:
  744. template: k8s_type.cluster_id
  745. params:
  746. k8s_type: infra
  747. cluster_id: {{ openshift_openstack_stack_name }}
  748. type: node
  749. subtype: infra
  750. node_labels:
  751. {% for k, v in openshift_openstack_cluster_node_labels.infra.iteritems() %}
  752. {{ k|e }}: {{ v|e }}
  753. {% endfor %}
  754. image: {{ openshift_openstack_infra_image }}
  755. flavor: {{ openshift_openstack_infra_flavor }}
  756. key_name: {{ openshift_openstack_keypair_name }}
  757. {% if openshift_openstack_provider_network_name %}
  758. net: {{ openshift_openstack_provider_network_name }}
  759. net_name: {{ openshift_openstack_provider_network_name }}
  760. {% else %}
  761. net: { get_resource: net }
  762. subnet: { get_resource: subnet }
  763. net_name:
  764. str_replace:
  765. template: openshift-ansible-cluster_id-net
  766. params:
  767. cluster_id: {{ openshift_openstack_stack_name }}
  768. {% if openshift_use_flannel|default(False)|bool %}
  769. attach_data_net: true
  770. data_net: { get_resource: data_net }
  771. data_subnet: { get_resource: data_subnet }
  772. {% endif %}
  773. {% endif %}
  774. secgrp:
  775. # TODO(bogdando) filter only required node rules into infra-secgrp
  776. {% if openshift_openstack_flat_secgrp|default(False)|bool %}
  777. - { get_resource: flat-secgrp }
  778. {% else %}
  779. - { get_resource: node-secgrp }
  780. {% endif %}
  781. {% if openshift_openstack_ui_ssh_tunnel|bool and openshift_openstack_num_masters|int < 2 %}
  782. - { get_resource: lb-secgrp }
  783. {% endif %}
  784. - { get_resource: infra-secgrp }
  785. - { get_resource: common-secgrp }
  786. {% if not openshift_openstack_provider_network_name %}
  787. floating_network: {{ openshift_openstack_external_network_name }}
  788. {% endif %}
  789. volume_size: {{ openshift_openstack_infra_volume_size }}
  790. {% if openshift_openstack_infra_server_group_policies|length > 0 %}
  791. scheduler_hints:
  792. group: { get_resource: infra_server_group }
  793. {% endif %}
  794. {% if not openshift_openstack_provider_network_name %}
  795. depends_on:
  796. - interface
  797. {% endif %}
  798. {% if openshift_openstack_num_dns|int > 0 %}
  799. dns:
  800. type: OS::Heat::ResourceGroup
  801. properties:
  802. count: {{ openshift_openstack_num_dns }}
  803. resource_def:
  804. type: server.yaml
  805. properties:
  806. name:
  807. str_replace:
  808. template: k8s_type-%index%.cluster_id
  809. params:
  810. cluster_id: {{ openshift_openstack_stack_name }}
  811. k8s_type: {{ openshift_openstack_dns_hostname }}
  812. cluster_env: {{ openshift_openstack_public_dns_domain }}
  813. cluster_id: {{ openshift_openstack_stack_name }}
  814. group:
  815. str_replace:
  816. template: k8s_type.cluster_id
  817. params:
  818. k8s_type: dns
  819. cluster_id: {{ openshift_openstack_stack_name }}
  820. type: dns
  821. image: {{ openshift_openstack_dns_image }}
  822. flavor: {{ openshift_openstack_dns_flavor }}
  823. key_name: {{ openshift_openstack_keypair_name }}
  824. {% if openshift_openstack_provider_network_name %}
  825. net: {{ openshift_openstack_provider_network_name }}
  826. net_name: {{ openshift_openstack_provider_network_name }}
  827. {% else %}
  828. net: { get_resource: net }
  829. subnet: { get_resource: subnet }
  830. net_name:
  831. str_replace:
  832. template: openshift-ansible-cluster_id-net
  833. params:
  834. cluster_id: {{ openshift_openstack_stack_name }}
  835. {% endif %}
  836. secgrp:
  837. - { get_resource: dns-secgrp }
  838. - { get_resource: common-secgrp }
  839. {% if not openshift_openstack_provider_network_name %}
  840. floating_network: {{ openshift_openstack_external_network_name }}
  841. {% endif %}
  842. volume_size: {{ openshift_openstack_dns_volume_size }}
  843. {% if not openshift_openstack_provider_network_name %}
  844. depends_on:
  845. - interface
  846. {% endif %}
  847. {% endif %}