fix(300-deploy-loki): modify Helm test script to support proxy
Before, invoking the Loki Helm test was skipped if the environment had a proxy configured. Now, the configmap for the test is modified with the proxy vars. The Loki stach Helm chart does not provide any configuration around this, so we can modify the configmap. As of right now, the certificates are not needed for `apk add` and only proxy vars are required. Change-Id: If58d99555ed299b99bd9bda441856aac326d8379
This commit is contained in:
parent
8377c131d9
commit
b689929e2d
@ -14,10 +14,37 @@ helm upgrade \
|
||||
|
||||
./tools/deployment/common/wait-for-pods.sh loki
|
||||
|
||||
# TODO(dustinspecker): remove this if condition and run loki test behind proxy
|
||||
# loki pod's container downloads jq and curl, which won't work
|
||||
# since the proxies are not configured for the pod, so skip test loki test for now
|
||||
# when proxy is defined
|
||||
if [ -z "$http_proxy" ]; then
|
||||
helm -n loki test loki --logs
|
||||
fi
|
||||
# todo(dustinspecker): create a pull request for Loki Helm chart
|
||||
# to provide proxy configuration to prevent having to modify the
|
||||
# configmap. Then provide proxy configuration as overrides to the
|
||||
# `helm upgrade` command above.
|
||||
proxy_export="\
|
||||
export HTTP_PROXY=\"$HTTP_PROXY\"\n\
|
||||
export HTTPS_PROXY=\"$HTTPS_PROXY\"\n\
|
||||
export NO_PROXY=\"$NO_PROXY,\$LOKI_SERVICE\"\n\
|
||||
export http_proxy=\"$http_proxy\"\n\
|
||||
export https_proxy=\"$https_proxy\"\n\
|
||||
export no_proxy=\"$no_proxy,\$LOKI_SERVICE\"\
|
||||
"
|
||||
|
||||
configmap_yaml="$(mktemp)"
|
||||
|
||||
kubectl get configmap loki-loki-stack-test \
|
||||
--namespace loki \
|
||||
--output yaml \
|
||||
> "$configmap_yaml"
|
||||
|
||||
# install gawk because older versions of awk and alternatives such as mawk
|
||||
# don't support inplace
|
||||
sudo -E apt-get install gawk --yes
|
||||
|
||||
# prepend proxy_export only for the first match of LOKI_URI=
|
||||
# This enables the script to be idempotent and prevent modifying the
|
||||
# last-applied-configuration annotation and breaking the YAML format.
|
||||
gawk --assign proxy_export="$proxy_export" \
|
||||
--include inplace \
|
||||
'/LOKI_URI=/ && !matched { print proxy_export ; matched=1 } 1' "$configmap_yaml"
|
||||
|
||||
kubectl apply --filename "$configmap_yaml"
|
||||
|
||||
helm -n loki test loki --logs
|
||||
|
Loading…
x
Reference in New Issue
Block a user