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:
parent
50dc57acdf
commit
d59bea3569
7 changed files with 115 additions and 12 deletions
|
|
@ -3,6 +3,7 @@ import logging
|
|||
|
||||
from data.registry_model.registry_pre_oci_model import pre_oci_model
|
||||
from data.registry_model.registry_oci_model import oci_model
|
||||
from data.registry_model.modelsplitter import SplitModel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -11,6 +12,12 @@ class RegistryModelProxy(object):
|
|||
def __init__(self):
|
||||
self._model = oci_model if os.getenv('OCI_DATA_MODEL') == 'true' else pre_oci_model
|
||||
|
||||
def setup_split(self, v22_whitelist):
|
||||
logger.info('===============================')
|
||||
logger.info('Enabling split registry model with namespace whitelist `%s`', v22_whitelist)
|
||||
logger.info('===============================')
|
||||
self._model = SplitModel(v22_whitelist)
|
||||
|
||||
def set_for_testing(self, use_oci_model):
|
||||
self._model = oci_model if use_oci_model else pre_oci_model
|
||||
logger.debug('Changed registry model to `%s` for testing', self._model)
|
||||
|
|
@ -19,4 +26,6 @@ class RegistryModelProxy(object):
|
|||
return getattr(self._model, attr)
|
||||
|
||||
registry_model = RegistryModelProxy()
|
||||
logger.debug('Using registry model `%s`', registry_model._model)
|
||||
logger.info('===============================')
|
||||
logger.info('Using registry model `%s`', registry_model._model)
|
||||
logger.info('===============================')
|
||||
|
|
|
|||
Reference in a new issue