From 215bc46f800b281e6bd350df6eb9973cce5c9156 Mon Sep 17 00:00:00 2001 From: Georgina Date: Tue, 21 May 2019 17:39:16 +0000 Subject: [PATCH] Improve repo server haproxy healthcheck to verify repo synchronisation This patch updates the healthcheck to test for the presence of the file /var/www/repo/repo_sync_complete. This addresses an issue where haproxy would direct traffic to redeployed repo servers which were correctly serving the web root but had no meaningful content. The repo_sync_complete file is created by related changes to the repo_server ansible role. Partial-Bug: 1829930 Depends-On: https://review.opendev.org/660788/ Change-Id: Ib7b64b09413fbdd8c630311d437539c9f876fac0 --- etc/openstack_deploy/openstack_user_config.yml.aio.j2 | 1 + inventory/group_vars/haproxy/haproxy.yml | 4 +++- playbooks/healthcheck-infrastructure.yml | 4 ++-- releasenotes/notes/repo_check-31eb53ae77ddeb41.yaml | 6 ++++++ 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/repo_check-31eb53ae77ddeb41.yaml diff --git a/etc/openstack_deploy/openstack_user_config.yml.aio.j2 b/etc/openstack_deploy/openstack_user_config.yml.aio.j2 index c9c8e7f4c6..ef2e521564 100644 --- a/etc/openstack_deploy/openstack_user_config.yml.aio.j2 +++ b/etc/openstack_deploy/openstack_user_config.yml.aio.j2 @@ -140,6 +140,7 @@ shared-infra_hosts: galera_container: 3 memcached_container: 3 rabbit_mq_container: 3 + repo_container: 3 {% endif %} repo-infra_hosts: diff --git a/inventory/group_vars/haproxy/haproxy.yml b/inventory/group_vars/haproxy/haproxy.yml index d9e2b4a97a..1e735f1cf1 100644 --- a/inventory/group_vars/haproxy/haproxy.yml +++ b/inventory/group_vars/haproxy/haproxy.yml @@ -68,7 +68,9 @@ haproxy_default_services: haproxy_port: 8181 haproxy_balance_type: http haproxy_backend_options: - - "httpchk HEAD / HTTP/1.0\\r\\nUser-agent:\\ osa-haproxy-healthcheck" + - "httpchk GET /repo_sync_complete HTTP/1.0\\r\\nUser-agent:\\ osa-haproxy-healthcheck" + haproxy_backend_httpcheck_options: + - "expect status 200" haproxy_service_enabled: "{{ groups['repo_all'] is defined and groups['repo_all'] | length > 0 }}" - service: haproxy_service_name: glance_api diff --git a/playbooks/healthcheck-infrastructure.yml b/playbooks/healthcheck-infrastructure.yml index 82f4b3f97b..326a307b6d 100644 --- a/playbooks/healthcheck-infrastructure.yml +++ b/playbooks/healthcheck-infrastructure.yml @@ -24,9 +24,9 @@ hosts: all_containers[0]:physical_hosts[0] gather_facts: yes vars: - repo_requirements_file: "os-releases/{{ openstack_release }}/{{ os_distro_version }}/" + repo_requirements_file: "repo_sync_complete" tasks: - - name: Check the upper constraint on each repo server + - name: Check the repo sync file on each repo server uri: url: "http://{{ hostvars[item]['container_address'] }}:{{ repo_server_port }}/{{ repo_requirements_file }}" with_inventory_hostnames: "{{ groups['repo_all'] }}" diff --git a/releasenotes/notes/repo_check-31eb53ae77ddeb41.yaml b/releasenotes/notes/repo_check-31eb53ae77ddeb41.yaml new file mode 100644 index 0000000000..8df046b25a --- /dev/null +++ b/releasenotes/notes/repo_check-31eb53ae77ddeb41.yaml @@ -0,0 +1,6 @@ +--- +other: + - | + HAProxy now verifies if repo server is healthy by ``repo_sync_complete`` + file that is created with repo_server role. This should prevent + non-synced repo containers from participating in load balancing.