summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2023-05-15 08:23:28 +0000
committerGerrit Code Review <review@openstack.org>2023-05-15 08:23:28 +0000
commit428295969836a2a0bad0ae0593ea1a890e155898 (patch)
tree51fa5593f7a44555dddbf1cbd429fed3a42d5285
parente58b3e8d347366902d4070fd877d98f7fc1b71be (diff)
parentfa9450d5b58866e4a6b928995a8bf18b4bb8f0c7 (diff)
downloadglance-master.tar.gz
Merge "Deploy healthcheck middleware as app instead of filter"HEADmaster
-rw-r--r--doc/source/configuration/configuring.rst14
-rw-r--r--etc/glance-api-paste.ini70
-rw-r--r--glance/tests/functional/__init__.py96
-rw-r--r--glance/tests/integration/v2/base.py30
-rw-r--r--glance/tests/unit/common/test_config.py8
5 files changed, 159 insertions, 59 deletions
diff --git a/doc/source/configuration/configuring.rst b/doc/source/configuration/configuring.rst
index 80917d423..0c5381561 100644
--- a/doc/source/configuration/configuring.rst
+++ b/doc/source/configuration/configuring.rst
@@ -1697,19 +1697,21 @@ To enable the health check middleware, it must occur in the beginning of the
application pipeline.
The health check middleware should be placed in your
-``glance-api-paste.ini`` in a section titled ``[filter:healthcheck]``.
+``glance-api-paste.ini`` in a section titled ``[app:healthcheck]``.
It should look like this::
- [filter:healthcheck]
- paste.filter_factory = oslo_middleware:Healthcheck.factory
+ [app:healthcheck]
+ paste.app_factory = oslo_middleware:Healthcheck.app_factory
backends = disable_by_file
disable_by_file_path = /etc/glance/healthcheck_disable
-A ready-made application pipeline including this filter is defined e.g. in
+A ready-made composite including this application is defined e.g. in
the ``glance-api-paste.ini`` file, looking like so::
- [pipeline:glance-api]
- pipeline = healthcheck versionnegotiation osprofiler unauthenticated-context rootapp
+ [composite:glance-api]
+ paste.composite_factory = glance.api:root_app_factory
+ /: apiv2app
+ /healthcheck: healthcheck
For more information see
`oslo.middleware <https://docs.openstack.org/oslo.middleware/latest/reference/api.html#oslo_middleware.Healthcheck>`_.
diff --git a/etc/glance-api-paste.ini b/etc/glance-api-paste.ini
index 37a9943de..5b02f5073 100644
--- a/etc/glance-api-paste.ini
+++ b/etc/glance-api-paste.ini
@@ -1,26 +1,56 @@
-# Use this pipeline for no auth or image caching - DEFAULT
-[pipeline:glance-api]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context rootapp
+# Use this composite for no auth or image caching - DEFAULT
+[composite:glance-api]
+paste.composite_factory = glance.api:root_app_factory
+/: api
+/healthcheck: healthcheck
+
+[pipeline:api]
+pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context rootapp
+
+# Use this composite for image caching and no auth
+[composite:glance-api-caching]
+paste.composite_factory = glance.api:root_app_factory
+/: api-caching
+/healthcheck: healthcheck
+
+[pipeline:api-caching]
+pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache rootapp
+
+# Use this composite for caching w/ management interface but no auth
+[composite:glance-api-cachemanagement]
+paste.composite_factory = glance.api:root_app_factory
+/: api-cachemanagement
+/healthcheck: healthcheck
+
+[pipeline:api-cachemanagement]
+pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache cachemanage rootapp
+
+# Use this composite for keystone auth
+[composite:glance-api-keystone]
+paste.composite_factory = glance.api:root_app_factory
+/: api-keystone
+/healthcheck: healthcheck
-# Use this pipeline for image caching and no auth
-[pipeline:glance-api-caching]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache rootapp
+[pipeline:api-keystone]
+pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context rootapp
-# Use this pipeline for caching w/ management interface but no auth
-[pipeline:glance-api-cachemanagement]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache cachemanage rootapp
+# Use this composite for keystone auth with image caching
+[composite:glance-api-keystone+caching]
+paste.composite_factory = glance.api:root_app_factory
+/: api-keystone+caching
+/healthcheck: healthcheck
-# Use this pipeline for keystone auth
-[pipeline:glance-api-keystone]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context rootapp
+[pipeline:api-keystone+caching]
+pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache rootapp
-# Use this pipeline for keystone auth with image caching
-[pipeline:glance-api-keystone+caching]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache rootapp
+# Use this composite for keystone auth with caching and cache management
+[composite:glance-api-keystone+cachemanagement]
+paste.composite_factory = glance.api:root_app_factory
+/: api-keystone+cachemanagement
+/healthcheck: healthcheck
-# Use this pipeline for keystone auth with caching and cache management
-[pipeline:glance-api-keystone+cachemanagement]
-pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage rootapp
+[pipeline:api-keystone+cachemanagement]
+pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage rootapp
[composite:rootapp]
paste.composite_factory = glance.api:root_app_factory
@@ -33,8 +63,8 @@ paste.app_factory = glance.api.versions:create_resource
[app:apiv2app]
paste.app_factory = glance.api.v2.router:API.factory
-[filter:healthcheck]
-paste.filter_factory = oslo_middleware:Healthcheck.factory
+[app:healthcheck]
+paste.app_factory = oslo_middleware:Healthcheck.app_factory
backends = disable_by_file
disable_by_file_path = /etc/glance/healthcheck_disable
diff --git a/glance/tests/functional/__init__.py b/glance/tests/functional/__init__.py
index a18090b3f..5244f22ca 100644
--- a/glance/tests/functional/__init__.py
+++ b/glance/tests/functional/__init__.py
@@ -468,23 +468,35 @@ default_store = %(default_store)s
[import_filtering_opts]
allowed_ports = []
"""
- self.paste_conf_base = """[pipeline:glance-api]
+ self.paste_conf_base = """[composite:glance-api]
+paste.composite_factory = glance.api:root_app_factory
+/: api
+/healthcheck: healthcheck
+
+[pipeline:api]
pipeline =
cors
- healthcheck
versionnegotiation
gzip
unauthenticated-context
rootapp
-[pipeline:glance-api-caching]
-pipeline = cors healthcheck versionnegotiation gzip context
- cache rootapp
+[composite:glance-api-caching]
+paste.composite_factory = glance.api:root_app_factory
+/: api-caching
+/healthcheck: healthcheck
+
+[pipeline:api-caching]
+pipeline = cors versionnegotiation gzip context cache rootapp
+
+[composite:glance-api-cachemanagement]
+paste.composite_factory = glance.api:root_app_factory
+/: api-cachemanagement
+/healthcheck: healthcheck
-[pipeline:glance-api-cachemanagement]
+[pipeline:api-cachemanagement]
pipeline =
cors
- healthcheck
versionnegotiation
gzip
unauthenticated-context
@@ -492,11 +504,21 @@ pipeline =
cache_manage
rootapp
-[pipeline:glance-api-fakeauth]
-pipeline = cors healthcheck versionnegotiation gzip fakeauth context rootapp
+[composite:glance-api-fakeauth]
+paste.composite_factory = glance.api:root_app_factory
+/: api-fakeauth
+/healthcheck: healthcheck
+
+[pipeline:api-fakeauth]
+pipeline = cors versionnegotiation gzip fakeauth context rootapp
+
+[composite:glance-api-noauth]
+paste.composite_factory = glance.api:root_app_factory
+/: api-noauth
+/healthcheck: healthcheck
-[pipeline:glance-api-noauth]
-pipeline = cors healthcheck versionnegotiation gzip context rootapp
+[pipeline:api-noauth]
+pipeline = cors versionnegotiation gzip context rootapp
[composite:rootapp]
paste.composite_factory = glance.api:root_app_factory
@@ -509,8 +531,8 @@ paste.app_factory = glance.api.versions:create_resource
[app:apiv2app]
paste.app_factory = glance.api.v2.router:API.factory
-[filter:healthcheck]
-paste.filter_factory = oslo_middleware:Healthcheck.factory
+[app:healthcheck]
+paste.app_factory = oslo_middleware:Healthcheck.app_factory
backends = disable_by_file
disable_by_file_path = %(disable_path)s
@@ -643,23 +665,35 @@ allowed_ports = []
[os_glance_staging_store]
filesystem_store_datadir=%(staging_dir)s
"""
- self.paste_conf_base = """[pipeline:glance-api]
+ self.paste_conf_base = """[composite:glance-api]
+paste.composite_factory = glance.api:root_app_factory
+/: api
+/healthcheck: healthcheck
+
+[pipeline:api]
pipeline =
cors
- healthcheck
versionnegotiation
gzip
unauthenticated-context
rootapp
-[pipeline:glance-api-caching]
-pipeline = cors healthcheck versionnegotiation gzip unauthenticated-context
- cache rootapp
+[composite:glance-api-caching]
+paste.composite_factory = glance.api:root_app_factory
+/: api-caching
+/healthcheck: healthcheck
+
+[pipeline:api-caching]
+pipeline = cors versionnegotiation gzip unauthenticated-context cache rootapp
+
+[composite:glance-api-cachemanagement]
+paste.composite_factory = glance.api:root_app_factory
+/: api-cachemanagement
+/healthcheck: healthcheck
-[pipeline:glance-api-cachemanagement]
+[pipeline:api-cachemanagement]
pipeline =
cors
- healthcheck
versionnegotiation
gzip
unauthenticated-context
@@ -667,11 +701,21 @@ pipeline =
cache_manage
rootapp
-[pipeline:glance-api-fakeauth]
-pipeline = cors healthcheck versionnegotiation gzip fakeauth context rootapp
+[composite:glance-api-fakeauth]
+paste.composite_factory = glance.api:root_app_factory
+/: api-fakeauth
+/healthcheck: healthcheck
+
+[pipeline:api-fakeauth]
+pipeline = cors versionnegotiation gzip fakeauth context rootapp
+
+[composite:glance-api-noauth]
+paste.composite_factory = glance.api:root_app_factory
+/: api-noauth
+/healthcheck: healthcheck
-[pipeline:glance-api-noauth]
-pipeline = cors healthcheck versionnegotiation gzip context rootapp
+[pipeline:api-noauth]
+pipeline = cors versionnegotiation gzip context rootapp
[composite:rootapp]
paste.composite_factory = glance.api:root_app_factory
@@ -684,8 +728,8 @@ paste.app_factory = glance.api.versions:create_resource
[app:apiv2app]
paste.app_factory = glance.api.v2.router:API.factory
-[filter:healthcheck]
-paste.filter_factory = oslo_middleware:Healthcheck.factory
+[app:healthcheck]
+paste.app_factory = oslo_middleware:Healthcheck.app_factory
backends = disable_by_file
disable_by_file_path = %(disable_path)s
diff --git a/glance/tests/integration/v2/base.py b/glance/tests/integration/v2/base.py
index b9580c05a..ff0349fb1 100644
--- a/glance/tests/integration/v2/base.py
+++ b/glance/tests/integration/v2/base.py
@@ -31,13 +31,25 @@ from glance.tests import utils as test_utils
TESTING_API_PASTE_CONF = """
-[pipeline:glance-api]
+[composite:glance-api]
+paste.composite_factory = glance.api:root_app_factory
+/: api
+
+[pipeline: api]
pipeline = versionnegotiation gzip unauthenticated-context rootapp
-[pipeline:glance-api-caching]
+[composite:glance-api-caching]
+paste.composite_factory = glance.api:root_app_factory
+/: api-caching
+
+[pipeline: api-caching]
pipeline = versionnegotiation gzip unauthenticated-context cache rootapp
-[pipeline:glance-api-cachemanagement]
+[composite:glance-api-cachemanagement]
+paste.composite_factory = glance.api:root_app_factory
+/: api-cachemanagement
+
+[pipeline: api-cachemanagement]
pipeline =
versionnegotiation
gzip
@@ -46,10 +58,18 @@ pipeline =
cache_manage
rootapp
-[pipeline:glance-api-fakeauth]
+[composite:glance-api-fakeauth]
+paste.composite_factory = glance.api:root_app_factory
+/: api-fakeauth
+
+[pipeline: api-fakeauth]
pipeline = versionnegotiation gzip fakeauth context rootapp
-[pipeline:glance-api-noauth]
+[composite:glance-api-noauth]
+paste.composite_factory = glance.api:root_app_factory
+/: api-noauth
+
+[pipeline: api-noauth]
pipeline = versionnegotiation gzip context rootapp
[composite:rootapp]
diff --git a/glance/tests/unit/common/test_config.py b/glance/tests/unit/common/test_config.py
index 84138f7eb..f52b21e26 100644
--- a/glance/tests/unit/common/test_config.py
+++ b/glance/tests/unit/common/test_config.py
@@ -66,7 +66,7 @@ class TestPasteApp(test_utils.BaseTestCase):
app = config.load_paste_app('glance-api')
- self.assertIsInstance(app, expected_app_type)
+ self.assertIsInstance(app['/'], expected_app_type)
def test_load_paste_app(self):
expected_middleware = oslo_middleware.CORS
@@ -78,7 +78,11 @@ class TestPasteApp(test_utils.BaseTestCase):
expected_middleware, make_paste_file=False)
def test_load_paste_app_with_paste_flavor(self):
- pipeline = ('[pipeline:glance-api-incomplete]\n'
+ pipeline = ('[composite:glance-api-incomplete]\n'
+ 'paste.composite_factory = glance.api:root_app_factory\n'
+ '/: api-incomplete\n'
+ '/healthcheck: healthcheck\n'
+ '[pipeline:api-incomplete]\n'
'pipeline = context rootapp')
expected_middleware = context.ContextMiddleware
self._do_test_load_paste_app(expected_middleware,