diff --git a/ansible/roles/manila/defaults/main.yml b/ansible/roles/manila/defaults/main.yml index aa8c3f7fad..fd5ac4c98b 100644 --- a/ansible/roles/manila/defaults/main.yml +++ b/ansible/roles/manila/defaults/main.yml @@ -9,6 +9,7 @@ manila_services: enabled: True volumes: "{{ manila_api_default_volumes + manila_api_extra_volumes }}" dimensions: "{{ manila_api_dimensions }}" + healthcheck: "{{ manila_api_healthcheck }}" haproxy: manila_api: enabled: "{{ enable_manila }}" @@ -27,6 +28,7 @@ manila_services: enabled: True volumes: "{{ manila_scheduler_default_volumes + manila_scheduler_extra_volumes }}" dimensions: "{{ manila_scheduler_dimensions }}" + healthcheck: "{{ manila_scheduler_healthcheck }}" manila-share: container_name: "manila_share" group: "manila-share" @@ -35,6 +37,7 @@ manila_services: privileged: True volumes: "{{ manila_share_default_volumes + manila_share_extra_volumes }}" dimensions: "{{ manila_share_dimensions }}" + healthcheck: "{{ manila_share_healthcheck }}" manila-data: container_name: "manila_data" group: "manila-data" @@ -43,6 +46,7 @@ manila_services: privileged: True volumes: "{{ manila_data_default_volumes + manila_data_extra_volumes }}" dimensions: "{{ manila_data_dimensions }}" + healthcheck: "{{ manila_data_healthcheck }}" ##################### @@ -80,6 +84,58 @@ manila_scheduler_dimensions: "{{ default_container_dimensions }}" manila_api_dimensions: "{{ default_container_dimensions }}" manila_data_dimensions: "{{ default_container_dimensions }}" +manila_api_enable_healthchecks: "{{ enable_container_healthchecks }}" +manila_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +manila_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +manila_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +manila_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ manila_api_port }}"] +manila_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +manila_api_healthcheck: + interval: "{{ manila_api_healthcheck_interval }}" + retries: "{{ manila_api_healthcheck_retries }}" + start_period: "{{ manila_api_healthcheck_start_period }}" + test: "{% if manila_api_enable_healthchecks | bool %}{{ manila_api_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ manila_api_healthcheck_timeout }}" + +manila_scheduler_enable_healthchecks: "{{ enable_container_healthchecks }}" +manila_scheduler_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +manila_scheduler_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +manila_scheduler_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +manila_scheduler_healthcheck_test: ["CMD-SHELL", "healthcheck_port manila-scheduler {{ om_rpc_port }}"] +manila_scheduler_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +manila_scheduler_healthcheck: + interval: "{{ manila_scheduler_healthcheck_interval }}" + retries: "{{ manila_scheduler_healthcheck_retries }}" + start_period: "{{ manila_scheduler_healthcheck_start_period }}" + test: "{% if manila_scheduler_enable_healthchecks | bool %}{{ manila_scheduler_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ manila_scheduler_healthcheck_timeout }}" + +manila_share_enable_healthchecks: "{{ enable_container_healthchecks }}" +manila_share_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +manila_share_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +manila_share_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +manila_share_healthcheck_test: ["CMD-SHELL", "healthcheck_port manila-share {{ om_rpc_port }}"] +manila_share_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +manila_share_healthcheck: + interval: "{{ manila_share_healthcheck_interval }}" + retries: "{{ manila_share_healthcheck_retries }}" + start_period: "{{ manila_share_healthcheck_start_period }}" + test: "{% if manila_share_enable_healthchecks | bool %}{{ manila_share_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ manila_share_healthcheck_timeout }}" + +manila_data_enable_healthchecks: "{{ enable_container_healthchecks }}" +manila_data_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +manila_data_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +manila_data_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +manila_data_healthcheck_test: ["CMD-SHELL", "healthcheck_port manila-data {{ om_rpc_port }}"] +manila_data_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +manila_data_healthcheck: + interval: "{{ manila_data_healthcheck_interval }}" + retries: "{{ manila_data_healthcheck_retries }}" + start_period: "{{ manila_data_healthcheck_start_period }}" + test: "{% if manila_data_enable_healthchecks | bool %}{{ manila_data_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ manila_data_healthcheck_timeout }}" + manila_share_default_volumes: - "{{ node_config_directory }}/manila-share/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/manila/handlers/main.yml b/ansible/roles/manila/handlers/main.yml index da4ec8615f..baea2998c6 100644 --- a/ansible/roles/manila/handlers/main.yml +++ b/ansible/roles/manila/handlers/main.yml @@ -11,6 +11,7 @@ image: "{{ service.image }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" @@ -27,6 +28,7 @@ privileged: "{{ service.privileged | default(False) }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" @@ -42,6 +44,7 @@ image: "{{ service.image }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" @@ -59,5 +62,6 @@ ipc_mode: "host" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" diff --git a/ansible/roles/manila/tasks/check-containers.yml b/ansible/roles/manila/tasks/check-containers.yml index 36bc73a8d8..4699e0afa7 100644 --- a/ansible/roles/manila/tasks/check-containers.yml +++ b/ansible/roles/manila/tasks/check-containers.yml @@ -9,6 +9,7 @@ privileged: "{{ item.value.privileged|default(False) }}" volumes: "{{ item.value.volumes|reject('equalto', '')|list }}" dimensions: "{{ item.value.dimensions }}" + healthcheck: "{{ item.value.healthcheck | default(omit) }}" when: - inventory_hostname in groups[item.value.group] - item.value.enabled | bool diff --git a/releasenotes/notes/implement-docker-healthchecks-for-manila-a0cd7d075a816ba5.yaml b/releasenotes/notes/implement-docker-healthchecks-for-manila-a0cd7d075a816ba5.yaml new file mode 100644 index 0000000000..48f12e3ea1 --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-manila-a0cd7d075a816ba5.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for manila services. + See `blueprint + `__