Add redirect disable item

if set storage redirect disable ture, will render it in registry config file

Signed-off-by: Qian Deng <dengq@vmware.com>
This commit is contained in:
Qian Deng 2019-04-30 17:05:27 +08:00
parent 71104011b3
commit a70202f063
6 changed files with 13 additions and 4 deletions

View File

@ -45,6 +45,9 @@ data_volume: /data
# # for more info about this configuration please refer https://docs.docker.com/registry/configuration/
# filesystem:
# maxthreads: 100
# # set disable to true when you want to disable registry redirect
# redirect:
# disabled: false
# Clair configuration
clair:

View File

@ -349,7 +349,7 @@ services:
{% endif %}
logging:
driver: "syslog"
options:
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "clair"
env_file:

View File

@ -12,6 +12,10 @@ storage:
enabled: false
delete:
enabled: true
{% if storage_redirect_disabled %}
redirect:
disabled: true
{% endif %}
redis:
addr: {{redis_host}}:{{redis_port}}
password: {{redis_password}}

View File

@ -124,6 +124,9 @@ def parse_yaml_config(config_file_path):
config_dict['storage_provider_name'] = 'filesystem'
config_dict['storage_provider_config'] = {}
if storage_config.get('redirect'):
config_dict['storage_redirect_disabled'] = storage_config['redirect']['disabled']
# Clair configs
clair_configs = configs.get("clair") or {}
config_dict['clair_db'] = 'postgres'

View File

@ -36,11 +36,10 @@ def prepare_docker_compose(configs, with_clair, with_notary, with_chartmuseum):
storage_config = configs.get('storage_provider_config') or {}
if storage_config.get('keyfile'):
rendering_variables['gcs_keyfile'] = storage_config['keyfile']
if configs.get('https_port'):
rendering_variables['https_port'] = configs['https_port']
if configs['protocol'] == 'https':
rendering_variables['cert_key_path'] = configs['cert_key_path']
rendering_variables['cert_path'] = configs['cert_path']
rendering_variables['https_port'] = configs['https_port']
render_jinja(docker_compose_template_path, docker_compose_yml_path, **rendering_variables)

View File

@ -29,7 +29,7 @@ def prepare_registry(config_dict):
def get_storage_provider_info(provider_name, provider_config):
provider_config_copy = copy.deepcopy(provider_config)
if provider_name == "filesystem":
if not (provider_config_copy and provider_config_copy.has_key('rootdirectory')):
if not (provider_config_copy and ('rootdirectory' in provider_config_copy)):
provider_config_copy['rootdirectory'] = '/storage'
if provider_name == 'gcs' and provider_config_copy.get('keyfile'):
provider_config_copy['keyfile'] = '/etc/registry/gcs.key'