From d9693fee504ca632bdde093a08c9deaf23377421 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 12 Jul 2021 13:31:10 +0900 Subject: [PATCH] Enable healthcheck middleware by default Healthcheck middleware provides the /healthcheck endpoint which is useful for loadbalancer or monitoring tools to check health of api services. This change enables the middleware by default. Note that this endpoint has no authentication. The /healthcheck entry should be removed from api-paste.ini to disable the middleware again. Change-Id: I1bc61afff2851bb8efac3ec5101a5198f204f41e --- etc/sahara/api-paste.ini | 6 ++++++ releasenotes/notes/healthcheck-02e429a3ffcd9482.yaml | 7 +++++++ tools/config/config-generator.sahara.conf | 1 + 3 files changed, 14 insertions(+) create mode 100644 releasenotes/notes/healthcheck-02e429a3ffcd9482.yaml diff --git a/etc/sahara/api-paste.ini b/etc/sahara/api-paste.ini index b00a5adc4f..04fcea5a71 100644 --- a/etc/sahara/api-paste.ini +++ b/etc/sahara/api-paste.ini @@ -3,6 +3,7 @@ pipeline = cors http_proxy_to_wsgi request_id versions acl auth_validator sahara [composite:sahara_api] use = egg:Paste#urlmap +/healthcheck: healthcheck /: sahara_apiv2 # this app is given as a reference for v1-only deployments @@ -37,3 +38,8 @@ paste.filter_factory = sahara.api.middleware.version_discovery:VersionResponseMi # this filter is given as a reference for v1-only deployments #[filter:versions] #paste.filter_factory = sahara.api.middleware.version_discovery:VersionResponseMiddlewareV1.factory + +[app:healthcheck] +paste.app_factory = oslo_middleware:Healthcheck.app_factory +backends = disable_by_file +disable_by_file_path = /etc/sahara/healthcheck_disable diff --git a/releasenotes/notes/healthcheck-02e429a3ffcd9482.yaml b/releasenotes/notes/healthcheck-02e429a3ffcd9482.yaml new file mode 100644 index 0000000000..3fd61e1b57 --- /dev/null +++ b/releasenotes/notes/healthcheck-02e429a3ffcd9482.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Now healthcheck middleware is enabled by default. Applications like + loadbalancer or monitoring tools can use ``/healthcheck`` path to monitor + health of each API endpoints. Remove entries for healthcheck from + ``api-paste.ini`` to disable this functionality. diff --git a/tools/config/config-generator.sahara.conf b/tools/config/config-generator.sahara.conf index b0ad3a130c..2e056f9130 100644 --- a/tools/config/config-generator.sahara.conf +++ b/tools/config/config-generator.sahara.conf @@ -7,6 +7,7 @@ namespace = oslo.db namespace = oslo.log namespace = oslo.messaging namespace = oslo.middleware.cors +namespace = oslo.middleware.healthcheck namespace = oslo.middleware.http_proxy_to_wsgi namespace = oslo.policy namespace = oslo.service.periodic_task