Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions kubernetes/pipeline/02configure
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,30 @@ if ! is_hyperconverged; then
fi

# Automatically use proxy if in prodstack only
if $(timeout 1s getent hosts squid.internal &> /dev/null); then
if has_opt --cdk && [ -z "${MOD_PARAMS[__CONTAINERD_PROXY__]}" ]; then
MOD_MSGS[1_proxy.0]='PROXY: Hostname squid.internal resolves, setting containerd proxy to http://squid.internal:3128'
MOD_PARAMS[__CONTAINERD_PROXY__]=http://squid.internal:3128
if [[ -z $http_proxy ]]; then
if $(timeout 1s nc -vz egress.ps7.internal 3128 &> /dev/null); then
proxy=http://egress.ps7.internal:3128 # ps7
elif $(timeout 1s nc -vz squid.internal 3128 &> /dev/null); then
proxy=http://squid.internal:3128 # ps6
fi
else
proxy=$http_proxy
fi

if [[ -z $no_proxy ]]; then
_no_proxy=${MOD_PARAMS[__CONTAINERD_NO_PROXY__]}
else
_no_proxy=$no_proxy
fi

if [[ -n $proxy ]] then
if has_opt --cdk && [[ -z $_no_proxy ]]; then
MOD_MSGS[1_proxy.0]='PROXY: Hostname ${proxy} resolves, setting containerd proxy to $proxy'
MOD_PARAMS[__CONTAINERD_PROXY__]=$proxy
else
MOD_MSGS[1_proxy.0]='PROXY: Hostname squid.internal resolves, setting juju proxy to http://squid.internal:3128'
MOD_MSGS[1_proxy.0]='PROXY: Hostname $proxy resolves, setting juju proxy to $proxy'
# from https://documentation.ubuntu.com/canonical-kubernetes/latest/charm/howto/proxy
juju model-config juju-http-proxy=http://squid.internal:3128 juju-https-proxy=http://squid.internal:3128 juju-no-proxy="${MOD_PARAMS[__CONTAINERD_NO_PROXY__]}"
juju model-config juju-http-proxy=$proxy juju-https-proxy=$proxy juju-no-proxy="$_no_proxy"
fi
fi

Expand Down