From c6656c21c2fd90a8ab6b9f5b34da485546388955 Mon Sep 17 00:00:00 2001 From: Taha Farahani Date: Tue, 23 Apr 2024 12:30:15 +0330 Subject: [PATCH 1/2] Support registry http.relativeurls in harbor.yml Signed-off-by: Taha Farahani --- make/harbor.yml.tmpl | 4 ++++ make/photon/prepare/templates/registry/config.yml.jinja | 3 +++ make/photon/prepare/utils/configs.py | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/make/harbor.yml.tmpl b/make/harbor.yml.tmpl index e81abfc43..0ff9c8bfc 100644 --- a/make/harbor.yml.tmpl +++ b/make/harbor.yml.tmpl @@ -41,6 +41,10 @@ https: # And when it enabled the hostname will no longer used # external_url: https://reg.mydomain.com:8433 +# Uncomment relativeurls if you want to return relative URLs in Location headers +# And when it enabled the client is responsible for resolving the correct URL +# relativeurls: true + # The initial password of Harbor admin # It only works in first time to install harbor # Remember Change the admin password from UI after launching Harbor. diff --git a/make/photon/prepare/templates/registry/config.yml.jinja b/make/photon/prepare/templates/registry/config.yml.jinja index 19e195d9d..631f377dd 100644 --- a/make/photon/prepare/templates/registry/config.yml.jinja +++ b/make/photon/prepare/templates/registry/config.yml.jinja @@ -45,6 +45,9 @@ redis: maxactive: 500 idletimeout: 60s http: +{% if relativeurls %} + relativeurls: true +{% else %} {% if internal_tls.enabled %} addr: :5443 tls: diff --git a/make/photon/prepare/utils/configs.py b/make/photon/prepare/utils/configs.py index aff786729..611665173 100644 --- a/make/photon/prepare/utils/configs.py +++ b/make/photon/prepare/utils/configs.py @@ -144,6 +144,12 @@ def parse_yaml_config(config_file_path, with_trivy): else: config_dict['public_url'] = '{protocol}://{hostname}:{http_port}'.format(**config_dict) + # relativeurls config + if configs.get('relativeurls'): + config_dict['relativeurls'] = configs.get('relativeurls') + else: + config_dict['relativeurls'] = False + # DB configs db_configs = configs.get('database') if db_configs: From a9a6d5ce5a3a4ba1ae7852e06cddaba1120e0f70 Mon Sep 17 00:00:00 2001 From: Taha Farahani Date: Tue, 23 Apr 2024 20:12:08 +0330 Subject: [PATCH 2/2] Fix / Change else to endif Signed-off-by: Taha Farahani --- make/photon/prepare/templates/registry/config.yml.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/photon/prepare/templates/registry/config.yml.jinja b/make/photon/prepare/templates/registry/config.yml.jinja index 631f377dd..8f55f40d4 100644 --- a/make/photon/prepare/templates/registry/config.yml.jinja +++ b/make/photon/prepare/templates/registry/config.yml.jinja @@ -47,7 +47,7 @@ redis: http: {% if relativeurls %} relativeurls: true -{% else %} +{% endif %} {% if internal_tls.enabled %} addr: :5443 tls: