Merge "Refactor pipeline definition"

This commit is contained in:
Zuul 2023-06-28 05:15:39 +00:00 committed by Gerrit Code Review
commit e9c0c61fea
2 changed files with 26 additions and 23 deletions

View File

@ -4,53 +4,44 @@ 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
/: api
/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
/: api
/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
/: api
/healthcheck: healthcheck
[pipeline:api-keystone]
pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context 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
/: api
/healthcheck: healthcheck
[pipeline:api-keystone+caching]
pipeline = cors 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
/: api
/healthchetck: healthcheck
[pipeline:api-keystone+cachemanagement]
pipeline = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage rootapp
[composite:api]
paste.composite_factory = glance.api:pipeline_factory
default = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context rootapp
caching = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache rootapp
cachemanagement = cors http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache cachemanage rootapp
keystone = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context rootapp
keystone+caching = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache rootapp
keystone+cachemanagement = cors http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage rootapp
[composite:rootapp]
paste.composite_factory = glance.api:root_app_factory

View File

@ -21,3 +21,15 @@ CONF = cfg.CONF
def root_app_factory(loader, global_conf, **local_conf):
return paste.urlmap.urlmap_factory(loader, global_conf, **local_conf)
def pipeline_factory(loader, global_conf, **local_conf):
"""A paste pipeline replica that keys off of deployment flavor."""
pipeline = local_conf[CONF.paste_deploy.flavor or 'default']
pipeline = pipeline.split()
filters = [loader.get_filter(n) for n in pipeline[:-1]]
app = loader.get_app(pipeline[-1])
filters.reverse()
for filter in filters:
app = filter(app)
return app