Merge "fix(300-deploy-loki): modify Helm test script to support proxy"
This commit is contained in:
commit
1b1bfdc8ca
@ -14,10 +14,37 @@ helm upgrade \
|
|||||||
|
|
||||||
./tools/deployment/common/wait-for-pods.sh loki
|
./tools/deployment/common/wait-for-pods.sh loki
|
||||||
|
|
||||||
# TODO(dustinspecker): remove this if condition and run loki test behind proxy
|
# todo(dustinspecker): create a pull request for Loki Helm chart
|
||||||
# loki pod's container downloads jq and curl, which won't work
|
# to provide proxy configuration to prevent having to modify the
|
||||||
# since the proxies are not configured for the pod, so skip test loki test for now
|
# configmap. Then provide proxy configuration as overrides to the
|
||||||
# when proxy is defined
|
# `helm upgrade` command above.
|
||||||
if [ -z "$http_proxy" ]; then
|
proxy_export="\
|
||||||
helm -n loki test loki --logs
|
export HTTP_PROXY=\"$HTTP_PROXY\"\n\
|
||||||
fi
|
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