Skip to content
4 changes: 2 additions & 2 deletions tasks/containerd.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
PROJ_ROOT,
print_dotted_line,
)
from tasks.util.proxy import check_proxy, configure_containerd_proxy
from tasks.util.proxy import is_proxy_set, configure_containerd_proxy
from tasks.util.toml import update_toml
from tasks.util.versions import CONTAINERD_VERSION, GO_VERSION
from time import sleep
Expand Down Expand Up @@ -161,7 +161,7 @@ def install(debug=False, clean=False):
config_cmd = "sudo bash -c '{}'".format(config_cmd)
run(config_cmd, shell=True, check=True)
# Install proxy for containerd
if check_proxy():
if is_proxy_set():
configure_containerd_proxy()

# Restart containerd service
Expand Down
4 changes: 2 additions & 2 deletions tasks/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from subprocess import run
from tasks.util.env import BIN_DIR, CONF_FILES_DIR, print_dotted_line
from tasks.util.network import download_binary, symlink_global_bin
from tasks.util.proxy import check_proxy, configure_kubelet_proxy
from tasks.util.proxy import is_proxy_set, configure_kubelet_proxy
from tasks.util.versions import K8S_VERSION, CNI_VERSION, CRICTL_VERSION


Expand Down Expand Up @@ -166,7 +166,7 @@ def install(debug=False, clean=False):
print("Success!")

# If proxy environment variables present configure kubelet proxies
if check_proxy():
if is_proxy_set():
configure_kubelet_proxy()

# Start kubelet service
Expand Down
4 changes: 2 additions & 2 deletions tasks/sc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
)
from tasks.util.kernel import get_host_kernel_expected_prefix, get_host_kernel_version
from tasks.util.kubeadm import run_kubectl_command
from tasks.util.proxy import check_proxy, configure_docker_proxy
from tasks.util.proxy import is_proxy_set, configure_docker_proxy
from tasks.util.registry import (
HOST_CERT_DIR,
start as start_local_registry,
Expand Down Expand Up @@ -217,7 +217,7 @@ def deploy(ctx, debug=False, clean=False):
Deploy an SC2-enabled bare-metal Kubernetes cluster
"""
# If proxy environment variables present, apply to docker
if check_proxy():
if is_proxy_set():
configure_docker_proxy()

# Fail-fast if deployment exists
Expand Down
5 changes: 3 additions & 2 deletions tasks/util/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from subprocess import run

def check_proxy():
def is_proxy_set():
"""
Check if proxy environment variables are set in the system.
Returns True if any proxy variables are set, False otherwise.
Expand Down Expand Up @@ -176,4 +176,5 @@ def configure_docker_proxy(debug=False):
input=json.dumps(user_config, indent=2).encode(), check=True)

run("sudo systemctl daemon-reload", shell=True, check=True)
run("sudo systemctl restart docker", shell=True, check=True)
run("sudo systemctl restart docker", shell=True, check=True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoshiisato check this diff file. I am pretty sure you need to change the configuration of your text editor.