diff --git a/ansible/roles/solum/defaults/main.yml b/ansible/roles/solum/defaults/main.yml index ff72ced638..b17fed2346 100644 --- a/ansible/roles/solum/defaults/main.yml +++ b/ansible/roles/solum/defaults/main.yml @@ -9,6 +9,7 @@ solum_services: image: "{{ solum_api_image_full }}" volumes: "{{ solum_api_default_volumes + solum_api_extra_volumes }}" dimensions: "{{ solum_api_dimensions }}" + healthcheck: "{{ solum_api_healthcheck }}" solum-worker: container_name: solum_worker group: solum-worker @@ -16,6 +17,7 @@ solum_services: image: "{{ solum_worker_image_full }}" volumes: "{{ solum_worker_default_volumes + solum_worker_extra_volumes }}" dimensions: "{{ solum_worker_dimensions }}" + healthcheck: "{{ solum_worker_healthcheck }}" solum-deployer: container_name: solum_deployer group: solum-deployer @@ -23,6 +25,7 @@ solum_services: image: "{{ solum_deployer_image_full }}" volumes: "{{ solum_deployer_default_volumes + solum_deployer_extra_volumes }}" dimensions: "{{ solum_deployer_dimensions }}" + healthcheck: "{{ solum_deployer_healthcheck }}" haproxy: solum_application_deployment: enabled: "{{ enable_solum }}" @@ -55,6 +58,7 @@ solum_services: image: "{{ solum_conductor_image_full }}" volumes: "{{ solum_conductor_default_volumes + solum_conductor_extra_volumes }}" dimensions: "{{ solum_conductor_dimensions }}" + healthcheck: "{{ solum_conductor_healthcheck }}" #################### # Database @@ -91,6 +95,58 @@ solum_worker_dimensions: "{{ default_container_dimensions }}" solum_deployer_dimensions: "{{ default_container_dimensions }}" solum_conductor_dimensions: "{{ default_container_dimensions }}" +solum_api_enable_healthchecks: "{{ enable_container_healthchecks }}" +solum_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +solum_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +solum_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +solum_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ solum_application_deployment_port }}"] +solum_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +solum_api_healthcheck: + interval: "{{ solum_api_healthcheck_interval }}" + retries: "{{ solum_api_healthcheck_retries }}" + start_period: "{{ solum_api_healthcheck_start_period }}" + test: "{% if solum_api_enable_healthchecks | bool %}{{ solum_api_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ solum_api_healthcheck_timeout }}" + +solum_worker_enable_healthchecks: "{{ enable_container_healthchecks }}" +solum_worker_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +solum_worker_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +solum_worker_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +solum_worker_healthcheck_test: ["CMD-SHELL", "healthcheck_port solum-worker {{ om_rpc_port }}"] +solum_worker_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +solum_worker_healthcheck: + interval: "{{ solum_worker_healthcheck_interval }}" + retries: "{{ solum_worker_healthcheck_retries }}" + start_period: "{{ solum_worker_healthcheck_start_period }}" + test: "{% if solum_worker_enable_healthchecks | bool %}{{ solum_worker_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ solum_worker_healthcheck_timeout }}" + +solum_deployer_enable_healthchecks: "{{ enable_container_healthchecks }}" +solum_deployer_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +solum_deployer_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +solum_deployer_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +solum_deployer_healthcheck_test: ["CMD-SHELL", "healthcheck_port solum-deployer {{ om_rpc_port }}"] +solum_deployer_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +solum_deployer_healthcheck: + interval: "{{ solum_deployer_healthcheck_interval }}" + retries: "{{ solum_deployer_healthcheck_retries }}" + start_period: "{{ solum_deployer_healthcheck_start_period }}" + test: "{% if solum_deployer_enable_healthchecks | bool %}{{ solum_deployer_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ solum_deployer_healthcheck_timeout }}" + +solum_conductor_enable_healthchecks: "{{ enable_container_healthchecks }}" +solum_conductor_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +solum_conductor_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +solum_conductor_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +solum_conductor_healthcheck_test: ["CMD-SHELL", "healthcheck_port solum-conductor {{ om_rpc_port }}"] +solum_conductor_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +solum_conductor_healthcheck: + interval: "{{ solum_conductor_healthcheck_interval }}" + retries: "{{ solum_conductor_healthcheck_retries }}" + start_period: "{{ solum_conductor_healthcheck_start_period }}" + test: "{% if solum_conductor_enable_healthchecks | bool %}{{ solum_conductor_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ solum_conductor_healthcheck_timeout }}" + solum_api_default_volumes: - "{{ node_config_directory }}/solum-api/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/solum/handlers/main.yml b/ansible/roles/solum/handlers/main.yml index 13b01b8f90..1f109640c9 100644 --- a/ansible/roles/solum/handlers/main.yml +++ b/ansible/roles/solum/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" @@ -26,6 +27,7 @@ image: "{{ service.image }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" @@ -41,6 +43,7 @@ image: "{{ service.image }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" @@ -56,5 +59,6 @@ image: "{{ service.image }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" when: - kolla_action != "config" diff --git a/ansible/roles/solum/tasks/check-containers.yml b/ansible/roles/solum/tasks/check-containers.yml index 6747ac0bc8..b9179e037d 100644 --- a/ansible/roles/solum/tasks/check-containers.yml +++ b/ansible/roles/solum/tasks/check-containers.yml @@ -8,6 +8,7 @@ image: "{{ item.value.image }}" 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-solum-cea175134943ee4a.yaml b/releasenotes/notes/implement-docker-healthchecks-for-solum-cea175134943ee4a.yaml new file mode 100644 index 0000000000..66af08319a --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-solum-cea175134943ee4a.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for solum services. + See `blueprint + `__