Heat templates for deploying OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
6.4KB

  1. heat_template_version: rocky
  2. description: >
  3. OpenStack Octavia service configured with Puppet
  4. parameters:
  5. DockerOctaviaHousekeepingImage:
  6. description: image
  7. type: string
  8. DockerOctaviaConfigImage:
  9. description: The container image to use for the octavia config_volume
  10. type: string
  11. OctaviaHousekeepingLoggingSource:
  12. type: json
  13. default:
  14. tag: openstack.octavia.housekeeping
  15. path: /var/log/containers/octavia/housekeeping.log
  16. EndpointMap:
  17. default: {}
  18. description: Mapping of service endpoint -> protocol. Typically set
  19. via parameter_defaults in the resource registry.
  20. type: json
  21. ServiceData:
  22. default: {}
  23. description: Dictionary packing service data
  24. type: json
  25. ServiceNetMap:
  26. default: {}
  27. description: Mapping of service_name -> network name. Typically set
  28. via parameter_defaults in the resource registry. This
  29. mapping overrides those in ServiceNetMapDefaults.
  30. type: json
  31. DefaultPasswords:
  32. default: {}
  33. type: json
  34. RoleName:
  35. default: ''
  36. description: Role name on which the service is applied
  37. type: string
  38. RoleParameters:
  39. default: {}
  40. description: Parameters specific to the role
  41. type: json
  42. OctaviaAmphoraExpiryAge:
  43. default: 0
  44. description: The interval in seconds after which an unused Amphora will
  45. be considered expired and cleaned up. If left to 0, the
  46. configuration will not be set and the system will use
  47. the service defaults.
  48. type: number
  49. MonitoringSubscriptionOctaviaHousekeeping:
  50. default: 'overcloud-octavia-housekeeping'
  51. type: string
  52. conditions:
  53. amphora_expiry_is_zero: {equals: [{get_param: OctaviaAmphoraExpiryAge}, 0]}
  54. resources:
  55. ContainersCommon:
  56. type: ../containers-common.yaml
  57. MySQLClient:
  58. type: ../database/mysql-client.yaml
  59. OctaviaBase:
  60. type: ./octavia-base.yaml
  61. properties:
  62. EndpointMap: {get_param: EndpointMap}
  63. ServiceData: {get_param: ServiceData}
  64. ServiceNetMap: {get_param: ServiceNetMap}
  65. DefaultPasswords: {get_param: DefaultPasswords}
  66. RoleName: {get_param: RoleName}
  67. RoleParameters: {get_param: RoleParameters}
  68. outputs:
  69. role_data:
  70. description: Role data for the Octavia housekeeping role.
  71. value:
  72. service_name: octavia_housekeeping
  73. monitoring_subscription: {get_param: MonitoringSubscriptionOctaviaHousekeeping}
  74. config_settings:
  75. map_merge:
  76. - get_attr: [OctaviaBase, role_data, config_settings]
  77. -
  78. if:
  79. - amphora_expiry_is_zero
  80. - {}
  81. - octavia::housekeeping::amphora_expiry_age: {get_param: OctaviaAmphoraExpiryAge}
  82. service_config_settings:
  83. fluentd:
  84. tripleo_fluentd_groups_octavia_housekeeping:
  85. - octavia
  86. tripleo_fluentd_sources_octavia_housekeeping:
  87. - {get_param: OctaviaHousekeepingLoggingSource}
  88. # BEGIN DOCKER SETTINGS #
  89. puppet_config:
  90. config_volume: octavia
  91. puppet_tags: octavia_config
  92. step_config:
  93. list_join:
  94. - "\n"
  95. - - "include tripleo::profile::base::octavia::housekeeping"
  96. - {get_attr: [MySQLClient, role_data, step_config]}
  97. config_image: {get_param: DockerOctaviaConfigImage}
  98. kolla_config:
  99. /var/lib/kolla/config_files/octavia_housekeeping.json:
  100. command: /usr/bin/octavia-housekeeping --config-file /usr/share/octavia/octavia-dist.conf --config-file /etc/octavia/octavia.conf --log-file /var/log/octavia/housekeeping.log --config-file /etc/octavia/post-deploy.conf --config-dir /etc/octavia/conf.d/octavia-housekeeping
  101. config_files:
  102. - source: "/var/lib/kolla/config_files/src/*"
  103. dest: "/"
  104. merge: true
  105. preserve_properties: true
  106. permissions:
  107. - path: /var/log/octavia
  108. owner: octavia:octavia
  109. recurse: true
  110. docker_config:
  111. step_2:
  112. octavia_housekeeping_init_dirs:
  113. start_order: 0
  114. image: &octavia_housekeeping_image {get_param: DockerOctaviaHousekeepingImage}
  115. user: root
  116. net: none
  117. volumes:
  118. # NOTE(mandre) we need extra dir for the service in /etc/octavia/conf.d
  119. # It is normally created as part of the RPM install, but it is
  120. # missing here because we use the same config_volume for all
  121. # octavia services, hence the same container image to generate
  122. # configuration.
  123. - /var/lib/config-data/puppet-generated/octavia/etc/octavia:/etc/octavia/:z
  124. command: ['/bin/bash', '-c', 'mkdir -p /etc/octavia/conf.d/octavia-housekeeping; chown -R octavia:octavia /etc/octavia/conf.d/octavia-housekeeping']
  125. step_4:
  126. octavia_housekeeping:
  127. start_order: 2
  128. image: *octavia_housekeeping_image
  129. net: host
  130. privileged: false
  131. restart: always
  132. healthcheck:
  133. test: /openstack/healthcheck
  134. volumes:
  135. list_concat:
  136. - {get_attr: [ContainersCommon, volumes]}
  137. -
  138. - /var/lib/kolla/config_files/octavia_housekeeping.json:/var/lib/kolla/config_files/config.json:ro
  139. - /var/lib/config-data/puppet-generated/octavia/:/var/lib/kolla/config_files/src:ro
  140. - /var/log/containers/octavia:/var/log/octavia:z
  141. environment:
  142. - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
  143. host_prep_tasks:
  144. - name: create persistent directories
  145. file:
  146. path: "{{ item.path }}"
  147. state: directory
  148. setype: "{{ item.setype }}"
  149. with_items:
  150. - { 'path': /var/log/containers/octavia, 'setype': svirt_sandbox_file_t }
  151. - { 'path': /var/log/octavia, 'setype': svirt_sandbox_file_t }
  152. - name: octavia logs readme
  153. copy:
  154. dest: /var/log/octavia/readme.txt
  155. content: |
  156. Log files from octavia containers can be found under
  157. /var/log/containers/octavia and /var/log/containers/httpd/octavia-api.
  158. ignore_errors: true
  159. upgrade_tasks: []
  160. post_upgrade_tasks:
  161. - when: step|int == 1
  162. import_role:
  163. name: tripleo-docker-rm
  164. vars:
  165. containers_to_rm:
  166. - octavia_housekeeping