PageRenderTime 76ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/magnum/drivers/swarm_fedora_atomic_v1/templates/swarmnode.yaml

https://gitlab.com/unofficial-mirrors/openstack-magnum
YAML | 459 lines | 374 code | 73 blank | 12 comment | 0 complexity | f0ffd183ea44886f46118331d3e6c958 MD5 | raw file
  1. heat_template_version: 2014-10-16
  2. description: >
  3. This is a nested stack that defines a single swarm node,
  4. based on a vanilla Fedora 20 cloud image. This stack is included by
  5. a ResourceGroup resource in the parent template (swarmcluster.yaml).
  6. parameters:
  7. name:
  8. type: string
  9. description: server name
  10. server_image:
  11. type: string
  12. description: glance image used to boot the server
  13. server_flavor:
  14. type: string
  15. description: flavor to use when booting the server
  16. ssh_key_name:
  17. type: string
  18. description: name of ssh key to be provisioned on our server
  19. docker_volume_size:
  20. type: number
  21. description: >
  22. size of a cinder volume to allocate to docker for container/image
  23. storage
  24. docker_volume_type:
  25. type: string
  26. description: >
  27. type of a cinder volume to allocate to docker for container/image
  28. storage
  29. docker_storage_driver:
  30. type: string
  31. description: docker storage driver name
  32. external_network:
  33. type: string
  34. description: uuid/name of a network to use for floating ip addresses
  35. fixed_network_id:
  36. type: string
  37. description: Network from which to allocate fixed addresses.
  38. fixed_subnet_id:
  39. type: string
  40. description: Subnet from which to allocate fixed addresses.
  41. network_driver:
  42. type: string
  43. description: network driver to use for instantiating container networks
  44. flannel_network_cidr:
  45. type: string
  46. description: network range for flannel overlay network
  47. http_proxy:
  48. type: string
  49. description: http proxy address for docker
  50. https_proxy:
  51. type: string
  52. description: https proxy address for docker
  53. no_proxy:
  54. type: string
  55. description: no proxies for docker
  56. swarm_api_ip:
  57. type: string
  58. description: swarm master's api server ip address
  59. api_ip_address:
  60. type: string
  61. description: swarm master's api server public ip address
  62. cluster_uuid:
  63. type: string
  64. description: identifier for the cluster this template is generating
  65. magnum_url:
  66. type: string
  67. description: endpoint to retrieve TLS certs from
  68. tls_disabled:
  69. type: boolean
  70. description: whether or not to disable TLS
  71. verify_ca:
  72. type: boolean
  73. description: whether or not to validate certificate authority
  74. swarm_version:
  75. type: string
  76. description: version of swarm used for swarm cluster
  77. secgroup_swarm_node_id:
  78. type: string
  79. description: ID of the security group for swarm node.
  80. etcd_server_ip:
  81. type: string
  82. description: ip address of the load balancer pool of etcd server.
  83. trustee_domain_id:
  84. type: string
  85. description: domain id of the trustee
  86. trustee_user_id:
  87. type: string
  88. description: user id of the trustee
  89. trustee_username:
  90. type: string
  91. description: username of the trustee
  92. trustee_password:
  93. type: string
  94. description: password of the trustee
  95. hidden: true
  96. trust_id:
  97. type: string
  98. description: id of the trust which is used by the trustee
  99. hidden: true
  100. auth_url:
  101. type: string
  102. description: url for keystone
  103. registry_enabled:
  104. type: boolean
  105. description: >
  106. Indicates whether the docker registry is enabled.
  107. registry_port:
  108. type: number
  109. description: port of registry service
  110. swift_region:
  111. type: string
  112. description: region of swift service
  113. registry_container:
  114. type: string
  115. description: >
  116. name of swift container which docker registry stores images in
  117. registry_insecure:
  118. type: boolean
  119. description: >
  120. indicates whether to skip TLS verification between registry and backend storage
  121. registry_chunksize:
  122. type: number
  123. description: >
  124. size fo the data segments for the swift dynamic large objects
  125. volume_driver:
  126. type: string
  127. description: volume driver to use for container storage
  128. default: ""
  129. rexray_preempt:
  130. type: string
  131. description: >
  132. enables any host to take control of a volume irrespective of whether
  133. other hosts are using the volume
  134. default: "false"
  135. openstack_ca:
  136. type: string
  137. description: The OpenStack CA certificate to install on the node.
  138. nodes_server_group_id:
  139. type: string
  140. description: ID of the server group for kubernetes cluster nodes.
  141. resources:
  142. node_wait_handle:
  143. type: "OS::Heat::WaitConditionHandle"
  144. node_wait_condition:
  145. type: "OS::Heat::WaitCondition"
  146. depends_on: swarm-node
  147. properties:
  148. handle: {get_resource: node_wait_handle}
  149. timeout: 6000
  150. ######################################################################
  151. #
  152. # software configs. these are components that are combined into
  153. # a multipart MIME user-data archive.
  154. no_proxy_extended:
  155. type: OS::Heat::Value
  156. properties:
  157. type: string
  158. value:
  159. list_join:
  160. - ','
  161. - - {get_param: swarm_api_ip}
  162. - {get_attr: [swarm_node_eth0, fixed_ips, 0, ip_address]}
  163. - {get_param: etcd_server_ip}
  164. - {get_param: api_ip_address}
  165. - {get_param: no_proxy}
  166. write_heat_params:
  167. type: "OS::Heat::SoftwareConfig"
  168. properties:
  169. group: ungrouped
  170. config:
  171. str_replace:
  172. template: {get_file: ../../common/templates/swarm/fragments/write-heat-params-node.yaml}
  173. params:
  174. "$WAIT_CURL": {get_attr: [node_wait_handle, curl_cli]}
  175. "$DOCKER_VOLUME": {get_resource: docker_volume}
  176. "$DOCKER_VOLUME_SIZE": {get_param: docker_volume_size}
  177. "$DOCKER_STORAGE_DRIVER": {get_param: docker_storage_driver}
  178. "$HTTP_PROXY": {get_param: http_proxy}
  179. "$HTTPS_PROXY": {get_param: https_proxy}
  180. "$NO_PROXY": {get_attr: [no_proxy_extended, value]}
  181. "$SWARM_API_IP": {get_param: swarm_api_ip}
  182. "$SWARM_NODE_IP": {get_attr: [swarm_node_eth0, fixed_ips, 0, ip_address]}
  183. "$CLUSTER_UUID": {get_param: cluster_uuid}
  184. "$MAGNUM_URL": {get_param: magnum_url}
  185. "$TLS_DISABLED": {get_param: tls_disabled}
  186. "$VERIFY_CA": {get_param: verify_ca}
  187. "$NETWORK_DRIVER": {get_param: network_driver}
  188. "$ETCD_SERVER_IP": {get_param: etcd_server_ip}
  189. "$API_IP_ADDRESS": {get_param: api_ip_address}
  190. "$SWARM_VERSION": {get_param: swarm_version}
  191. "$TRUSTEE_DOMAIN_ID": {get_param: trustee_domain_id}
  192. "$TRUSTEE_USER_ID": {get_param: trustee_user_id}
  193. "$TRUSTEE_USERNAME": {get_param: trustee_username}
  194. "$TRUSTEE_PASSWORD": {get_param: trustee_password}
  195. "$TRUST_ID": {get_param: trust_id}
  196. "$AUTH_URL": {get_param: auth_url}
  197. "$REGISTRY_ENABLED": {get_param: registry_enabled}
  198. "$REGISTRY_PORT": {get_param: registry_port}
  199. "$SWIFT_REGION": {get_param: swift_region}
  200. "$REGISTRY_CONTAINER": {get_param: registry_container}
  201. "$REGISTRY_INSECURE": {get_param: registry_insecure}
  202. "$REGISTRY_CHUNKSIZE": {get_param: registry_chunksize}
  203. "$VOLUME_DRIVER": {get_param: volume_driver}
  204. "$REXRAY_PREEMPT": {get_param: rexray_preempt}
  205. install_openstack_ca:
  206. type: OS::Heat::SoftwareConfig
  207. properties:
  208. group: ungrouped
  209. config:
  210. str_replace:
  211. params:
  212. $OPENSTACK_CA: {get_param: openstack_ca}
  213. template: {get_file: ../../common/templates/fragments/atomic-install-openstack-ca.sh}
  214. remove_docker_key:
  215. type: "OS::Heat::SoftwareConfig"
  216. properties:
  217. group: ungrouped
  218. config: {get_file: ../../common/templates/swarm/fragments/remove-docker-key.sh}
  219. make_cert:
  220. type: "OS::Heat::SoftwareConfig"
  221. properties:
  222. group: ungrouped
  223. config: {get_file: ../../common/templates/swarm/fragments/make-cert.py}
  224. configure_docker_storage:
  225. type: OS::Heat::SoftwareConfig
  226. properties:
  227. group: ungrouped
  228. config:
  229. str_replace:
  230. params:
  231. $configure_docker_storage_driver: {get_file: ../../common/templates/fragments/configure_docker_storage_driver_atomic.sh}
  232. template: {get_file: ../../common/templates/fragments/configure-docker-storage.sh}
  233. configure_docker_registry:
  234. type: OS::Heat::SoftwareConfig
  235. properties:
  236. group: ungrouped
  237. config: {get_file: ../../common/templates/fragments/configure-docker-registry.sh}
  238. add_docker_daemon_options:
  239. type: "OS::Heat::SoftwareConfig"
  240. properties:
  241. group: ungrouped
  242. config: {get_file: ../../common/templates/swarm/fragments/add-docker-daemon-options.sh}
  243. write_docker_socket:
  244. type: "OS::Heat::SoftwareConfig"
  245. properties:
  246. group: ungrouped
  247. config: {get_file: ../../common/templates/swarm/fragments/write-docker-socket.yaml}
  248. network_service:
  249. type: "OS::Heat::SoftwareConfig"
  250. properties:
  251. group: ungrouped
  252. config: {get_file: ../../common/templates/swarm/fragments/network-service.sh}
  253. write_swarm_agent_failure_service:
  254. type: "OS::Heat::SoftwareConfig"
  255. properties:
  256. group: ungrouped
  257. config:
  258. str_replace:
  259. template: {get_file: ../../common/templates/swarm/fragments/write-cluster-failure-service.yaml}
  260. params:
  261. "$SERVICE": swarm-agent
  262. "$WAIT_CURL": {get_attr: [node_wait_handle, curl_cli]}
  263. "$VERIFY_CA": {get_param: verify_ca}
  264. write_swarm_agent_service:
  265. type: "OS::Heat::SoftwareConfig"
  266. properties:
  267. group: ungrouped
  268. config: {get_file: ../../common/templates/swarm/fragments/write-swarm-agent-service.sh}
  269. enable_docker_registry:
  270. type: OS::Heat::SoftwareConfig
  271. properties:
  272. group: ungrouped
  273. config: {get_file: ../../common/templates/fragments/enable-docker-registry.sh}
  274. enable_services:
  275. type: "OS::Heat::SoftwareConfig"
  276. properties:
  277. group: ungrouped
  278. config:
  279. str_replace:
  280. template: {get_file: ../../common/templates/swarm/fragments/enable-services.sh}
  281. params:
  282. "$NODE_SERVICES": "docker.socket docker swarm-agent"
  283. cfn_signal:
  284. type: "OS::Heat::SoftwareConfig"
  285. properties:
  286. group: ungrouped
  287. config: {get_file: ../../common/templates/swarm/fragments/cfn-signal.sh}
  288. configure_selinux:
  289. type: "OS::Heat::SoftwareConfig"
  290. properties:
  291. group: ungrouped
  292. config: {get_file: ../../common/templates/swarm/fragments/configure-selinux.sh}
  293. add_proxy:
  294. type: "OS::Heat::SoftwareConfig"
  295. properties:
  296. group: ungrouped
  297. config: {get_file: ../../common/templates/swarm/fragments/add-proxy.sh}
  298. volume_service:
  299. type: "OS::Heat::SoftwareConfig"
  300. properties:
  301. group: ungrouped
  302. config: {get_file: ../../common/templates/swarm/fragments/volume-service.sh}
  303. swarm_node_init:
  304. type: "OS::Heat::MultipartMime"
  305. properties:
  306. parts:
  307. - config: {get_resource: install_openstack_ca}
  308. - config: {get_resource: configure_selinux}
  309. - config: {get_resource: remove_docker_key}
  310. - config: {get_resource: write_heat_params}
  311. - config: {get_resource: make_cert}
  312. - config: {get_resource: network_service}
  313. - config: {get_resource: configure_docker_storage}
  314. - config: {get_resource: configure_docker_registry}
  315. - config: {get_resource: write_swarm_agent_failure_service}
  316. - config: {get_resource: write_swarm_agent_service}
  317. - config: {get_resource: add_docker_daemon_options}
  318. - config: {get_resource: write_docker_socket}
  319. - config: {get_resource: add_proxy}
  320. - config: {get_resource: enable_docker_registry}
  321. - config: {get_resource: enable_services}
  322. - config: {get_resource: cfn_signal}
  323. - config: {get_resource: volume_service}
  324. # do NOT use "_" (underscore) in the Nova server name
  325. # it creates a mismatch between the generated Nova name and its hostname
  326. # which can lead to weird problems
  327. swarm-node:
  328. type: "OS::Nova::Server"
  329. properties:
  330. name: {get_param: name}
  331. image:
  332. get_param: server_image
  333. flavor:
  334. get_param: server_flavor
  335. key_name:
  336. get_param: ssh_key_name
  337. user_data_format: RAW
  338. user_data: {get_resource: swarm_node_init}
  339. networks:
  340. - port:
  341. get_resource: swarm_node_eth0
  342. scheduler_hints: { group: { get_param: nodes_server_group_id }}
  343. swarm_node_eth0:
  344. type: "OS::Neutron::Port"
  345. properties:
  346. network_id:
  347. get_param: fixed_network_id
  348. security_groups:
  349. - {get_param: secgroup_swarm_node_id}
  350. fixed_ips:
  351. - subnet_id:
  352. get_param: fixed_subnet_id
  353. allowed_address_pairs:
  354. - ip_address: {get_param: flannel_network_cidr}
  355. swarm_node_floating:
  356. type: "OS::Neutron::FloatingIP"
  357. properties:
  358. floating_network:
  359. get_param: external_network
  360. port_id:
  361. get_resource: swarm_node_eth0
  362. ######################################################################
  363. #
  364. # docker storage. This allocates a cinder volume and attaches it
  365. # to the node.
  366. #
  367. docker_volume:
  368. type: Magnum::Optional::Cinder::Volume
  369. properties:
  370. size: {get_param: docker_volume_size}
  371. volume_type: {get_param: docker_volume_type}
  372. docker_volume_attach:
  373. type: Magnum::Optional::Cinder::VolumeAttachment
  374. properties:
  375. instance_uuid: {get_resource: swarm-node}
  376. volume_id: {get_resource: docker_volume}
  377. mountpoint: /dev/vdb
  378. outputs:
  379. swarm_node_ip:
  380. value: {get_attr: [swarm_node_eth0, fixed_ips, 0, ip_address]}
  381. description: >
  382. This is the "private" address of the Swarm node.
  383. swarm_node_external_ip:
  384. value: {get_attr: [swarm_node_floating, floating_ip_address]}
  385. description: >
  386. This is the "public" address of the Swarm node.