Enable a configurable whitelist of namespaces for V22

If a namespace is present in the whitelist, all calls are sent to the OCI model instead of the Pre OCI model

Note that this does increase overhead for registry calls (since we need to lookup the namespace for every single call), but it should only be temporary until we've migrated all users over to the OCI data model
This commit is contained in:
Joseph Schorr 2018-12-03 14:19:53 -05:00
parent 50dc57acdf
commit d59bea3569
7 changed files with 115 additions and 12 deletions

5
app.py
View file

@ -30,6 +30,7 @@ from data.queue import WorkQueue, BuildMetricQueueReporter
from data.userevent import UserEventsBuilderModule
from data.userfiles import Userfiles
from data.users import UserAuthentication
from data.registry_model import registry_model
from path_converters import RegexConverter, RepositoryPathConverter, APIRepositoryPathConverter
from oauth.services.github import GithubOAuthService
from oauth.services.gitlab import GitLabOAuthService
@ -88,6 +89,10 @@ config_provider.update_app_config(app.config)
environ_config = json.loads(os.environ.get(OVERRIDE_CONFIG_KEY, '{}'))
app.config.update(environ_config)
# Split the registry model based on config.
# TODO(jschorr): Remove once we are fully on the OCI data model.
registry_model.setup_split(app.config.get('V22_NAMESPACE_WHITELIST') or set())
# Allow user to define a custom storage preference for the local instance.
_distributed_storage_preference = os.environ.get('QUAY_DISTRIBUTED_STORAGE_PREFERENCE', '').split()
if _distributed_storage_preference: