Commit a0ba1f35 authored by Philippe Caseiro's avatar Philippe Caseiro
Browse files

feat(service): adding install support for promtail

If you setup an API url in the service configuration,
the postdeploy script will install promtail and configure it to
use the provided URL.

Fixes #15
parent ee9c6304
Pipeline #10732 passed with stage
in 7 seconds
......@@ -239,6 +239,25 @@ installCertManager() {
}
installPromtail() {
loki_server_url=$(onegate vm show --json | jq -rc ".VM.USER_TEMPLATE.LOKI_SERVER_URL")
if [ "${loki_server_url}" = "disabled" ]; then
echo "[INFO] Loki service support is disabled"
return 0
elif [ "${loki_server_url}" = "local" ]; then
echo "[INFO] Installing loki stack in place"
#FIXME
echo "[WARN] loki-stack local install not implemented yet (it's a bad idea)"
return 0
fi
echo "[INFO] Installing promtail with URL '${loki_server_url}'"
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
helm upgrade --install promtail grafana/promtail --set "config.lokiAddress='${loki_server_url}'"
return $?
}
setupHelmRepos() {
echo "[INFO] Setup Helm repositories"
......@@ -328,7 +347,15 @@ if [ "$?" -ne 0 ]; then
fi
installCertManager
if [ "${?}" -ne 0 ]; then
echo "[ERROR} Certmanager installation failed !"
_end_log
exit 8
fi
installPromtail
res="${?}"
_end_log
exit "${res}"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment