Skip to content

Commit

Permalink
add ipFamily config in values.yaml
Browse files Browse the repository at this point in the history
Signed-off-by: yminer <yminer@vmware.com>

update name

update prepare and migration

update comments

Signed-off-by: yminer <yminer@vmware.com>

remove print msg

update migrate template
  • Loading branch information
MinerYang committed Feb 2, 2024
1 parent 522f96b commit b835973
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 1 deletion.
10 changes: 10 additions & 0 deletions make/harbor.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ https:
certificate: /your/certificate/path
private_key: /your/private/key/path

# # Harbor will set ipv4 enabled only by defualt if this block is not configured
# # Otherwise, please uncomment this block to configure your own ip_family stacks
# ip_family:
# # ipv6Enabled set to true if ipv6 is enabled in docker network, currently it affected the nginx related component
# ipv6:
# enabled: true
# # ipv4Enabled set to true by default, currently it affected the nginx related component
# ipv4:
# enabled: false

# # Uncomment following will enable tls communication between all harbor components
# internal_tls:
# # set enabled to true means internal tls is enabled
Expand Down
18 changes: 18 additions & 0 deletions make/photon/prepare/migrations/version_2_10_0/harbor.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ https:
# private_key: /your/private/key/path
{% endif %}

{% if ip_family is defined %}
ip_family:
# ipv6Enabled set to true if ipv6 is enabled in docker network, currently it affected the nginx related component
ipv6:
enabled: {{ ip_family.ipv6.enabled | lower }}
# ipv4Enabled set to true by default, currently it affected the nginx related component
ipv4:
enabled: {{ ip_family.ipv4.enabled | lower }}
{% else %}
ip_family:
# ipv6Enabled set to true if ipv6 is enabled in docker network, currently it affected the nginx related component
ipv6:
enabled: false
# ipv4Enabled set to true by default, currently it affected the nginx related component
ipv4:
enabled: true
{% endif %}

{% if internal_tls is defined %}
# Uncomment following will enable tls communication between all harbor components
internal_tls:
Expand Down
4 changes: 4 additions & 0 deletions make/photon/prepare/templates/nginx/nginx.https.conf.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ http {
include /etc/nginx/conf.d/*.server.conf;

server {
{% if ip_family.ipv4.enabled %}
listen 8443 ssl;
{% endif %}
{% if ip_family.ipv6.enabled %}
listen [::]:8443 ssl;
{% endif %}
# server_name harbordomain.com;
server_tokens off;
# SSL
Expand Down
5 changes: 5 additions & 0 deletions make/photon/prepare/templates/portal/nginx.conf.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ http {

server {
{% if internal_tls.enabled %}
#ip_family
{% if ip_family.ipv4.enabled %}
listen 8443 ssl;
{% endif %}
{% if ip_family.ipv6.enabled %}
listen [::]:8443 ssl;
{% endif %}
# SSL
ssl_certificate /etc/harbor/tls/portal.crt;
ssl_certificate_key /etc/harbor/tls/portal.key;
Expand Down
3 changes: 3 additions & 0 deletions make/photon/prepare/utils/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ def parse_yaml_config(config_file_path, with_trivy):
external_database=config_dict['external_database'])
else:
config_dict['internal_tls'] = InternalTLS()

# ip_family config
config_dict['ip_family'] = configs.get('ip_family') or {'ipv4': {'enabled': True}, 'ipv6': {'enabled': False}}

# metric configs
metric_config = configs.get('metric')
Expand Down
3 changes: 2 additions & 1 deletion make/photon/prepare/utils/nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def render_nginx_template(config_dict):
ssl_cert=SSL_CERT_PATH,
ssl_cert_key=SSL_CERT_KEY_PATH,
internal_tls=config_dict['internal_tls'],
metric=config_dict['metric'])
metric=config_dict['metric'],
ip_family=config_dict['ip_family'])
location_file_pattern = CUSTOM_NGINX_LOCATION_FILE_PATTERN_HTTPS

else:
Expand Down
1 change: 1 addition & 0 deletions make/photon/prepare/utils/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ def prepare_portal(config_dict):
str(portal_conf_template_path),
portal_conf,
internal_tls=config_dict['internal_tls'],
ip_family=config_dict['ip_family'],
uid=DEFAULT_UID,
gid=DEFAULT_GID)

0 comments on commit b835973

Please sign in to comment.