Skip to content

Commit

Permalink
vSphere UPI deployment behind proxy (red-hat-storage#8364)
Browse files Browse the repository at this point in the history
- implementing vSphere UPI deployment behind proxy without containerized
  Flexy

Signed-off-by: Daniel Horak <[email protected]>
  • Loading branch information
dahorak committed Sep 6, 2023
1 parent abd94f3 commit cd4c170
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 24 deletions.
2 changes: 0 additions & 2 deletions conf/deployment/vsphere/upi_1az_rhcos_vsan_3m_3w_proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ DEPLOYMENT:
ENV_DATA:
platform: 'vsphere'
deployment_type: 'upi'
flexy_deployment: true
flexy_template: 'upi-on-vsphere/versioned-installer-http_proxy'
worker_replicas: 3
master_replicas: 3
worker_num_cpus: '16'
Expand Down
20 changes: 20 additions & 0 deletions conf/deployment/vsphere/upi_1az_rhcos_vsan_3m_3w_proxy_flexy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# This config will work on _vSphere DC-ECO, DC-CP, DC-PS and vSphere7 DC-CP_
DEPLOYMENT:
allow_lower_instance_requirements: false
proxy: true
ENV_DATA:
platform: 'vsphere'
deployment_type: 'upi'
flexy_deployment: true
flexy_template: 'upi-on-vsphere/versioned-installer-http_proxy'
worker_replicas: 3
master_replicas: 3
worker_num_cpus: '16'
master_num_cpus: '4'
master_memory: '16384'
compute_memory: '65536'
fio_storageutilization_min_mbps: 10.0
REPORTING:
polarion:
deployment_id: 'OCS-2635'
73 changes: 52 additions & 21 deletions ocs_ci/deployment/vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,37 +880,52 @@ def create_config(self):
]
install_config_obj["pullSecret"] = self.get_pull_secret()
install_config_obj["sshKey"] = self.get_ssh_key()
# prepare configuration for disconnected deployment
if config.DEPLOYMENT.get("disconnected"):
# prepare configuration for disconnected deployment (including deployment behind proxy)
if config.DEPLOYMENT.get("disconnected") or config.DEPLOYMENT.get("proxy"):
# set non-existing gateway, to make the cluster disconnected
config.ENV_DATA["gateway"] = config.DEPLOYMENT.get(
"disconnected_false_gateway", "${cidrhost(var.machine_cidr, 1)}"
)
# set DNS server accessible from the disconnected env
# set DNS server accessible from the disconnected/proxy env
config.ENV_DATA["dns"] = config.DEPLOYMENT["disconnected_dns_server"]

install_config_obj.update(
yaml.safe_load(config.RUN["imageContentSources"])
)
cluster_domain = (
f"{config.ENV_DATA.get('cluster_name')}."
f"{config.ENV_DATA.get('base_domain')}"
)
install_config_obj["proxy"] = {
"httpProxy": config.DEPLOYMENT["disconnected_http_proxy"],
"httpsProxy": config.DEPLOYMENT.get(
"disconnected_https_proxy",
config.DEPLOYMENT["disconnected_http_proxy"],
),
"noProxy": ",".join(
[
cluster_domain,
config.DEPLOYMENT.get("disconnected_no_proxy", ""),
],
),
}
with open(get_root_ca_cert(), "r") as fd:
install_config_obj["additionalTrustBundle"] = fd.read()
if config.DEPLOYMENT.get("proxy"):
install_config_obj["proxy"] = {
"httpProxy": config.DEPLOYMENT["proxy_http_proxy"],
"httpsProxy": config.DEPLOYMENT.get(
"proxy_https_proxy",
config.DEPLOYMENT["proxy_http_proxy"],
),
"noProxy": ",".join(
[
cluster_domain,
config.DEPLOYMENT.get("disconnected_no_proxy", ""),
],
),
}
if config.DEPLOYMENT.get("disconnected"):
install_config_obj["proxy"] = {
"httpProxy": config.DEPLOYMENT["disconnected_http_proxy"],
"httpsProxy": config.DEPLOYMENT.get(
"disconnected_https_proxy",
config.DEPLOYMENT["disconnected_http_proxy"],
),
"noProxy": ",".join(
[
cluster_domain,
config.DEPLOYMENT.get("disconnected_no_proxy", ""),
],
),
}
install_config_obj.update(
yaml.safe_load(config.RUN["imageContentSources"])
)
with open(get_root_ca_cert(), "r") as fd:
install_config_obj["additionalTrustBundle"] = fd.read()
install_config_str = yaml.safe_dump(install_config_obj)
install_config = os.path.join(self.cluster_path, "install-config.yaml")
with open(install_config, "w") as f:
Expand Down Expand Up @@ -2102,6 +2117,22 @@ def modify_haproxyservice():

replace_content_in_file(constants.TERRAFORM_HAPROXY_SERVICE, to_change, execstop)

if config.DEPLOYMENT.get("proxy"):
http_proxy = config.DEPLOYMENT["proxy_http_proxy"]
https_proxy = config.DEPLOYMENT.get(
"proxy_https_proxy",
config.DEPLOYMENT["proxy_http_proxy"],
)
replace_content_in_file(
constants.TERRAFORM_HAPROXY_SERVICE,
"[Service]",
(
"[Service]\n"
f'Environment="http_proxy={http_proxy}"\n'
f'Environment="https_proxy={https_proxy}"'
),
)

if config.DEPLOYMENT.get("disconnected") and config.DEPLOYMENT.get(
"haproxy_router_image"
):
Expand Down
2 changes: 1 addition & 1 deletion ocs_ci/utility/load_balancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, host=None, user=None, private_key=None):
)
jump_host = (
config.DEPLOYMENT.get("ssh_jump_host")
if config.DEPLOYMENT.get("disconnected")
if (config.DEPLOYMENT.get("disconnected") or config.DEPLOYMENT.get("proxy"))
else None
)
if jump_host:
Expand Down

0 comments on commit cd4c170

Please sign in to comment.