Skip to content

Commit

Permalink
podmand: workaround for podman pod support
Browse files Browse the repository at this point in the history
rootless containers in podman can comunicate in two ways, the prefered
(but currently have bug and not working) is with a shared pod.

The alternative is using a host ip.
Until the bug in podman is solved and in a release, this patch uses an
arbitrary ip address of the host (the host can have multiple interfaces
anyone would do).
  • Loading branch information
amnonh committed Aug 3, 2020
1 parent 1a4d31f commit 45ebfdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions start-alertmanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if [ "$1" = "-e" ]; then
else
. versions.sh
fi
is_podman="$(docker --help | grep -o podman)"
VERSIONS=$DEFAULT_VERSION
RULE_FILE=$PWD/prometheus/rule_config.yml
ALERT_MANAGER_VERSION="v0.20.0"
Expand Down Expand Up @@ -85,4 +86,8 @@ then
fi

AM_ADDRESS="$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $ALERTMANAGER_NAME):9093"
if [ ! -z "$is_podman" ] && [ "$AM_ADDRESS" = ":9093" ]; then
HOST_IP=`hostname -I | awk '{print $1}'`
AM_ADDRESS="$HOST_IP:9093"
fi
echo $AM_ADDRESS
4 changes: 4 additions & 0 deletions start-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ fi
# Can't use localhost here, because the monitoring may be running remotely.
# Also note that the port to which we need to connect is 9090, regardless of which port we bind to at localhost.
DB_ADDRESS="$(docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $PROMETHEUS_NAME):9090"
if [ ! -z "$is_podman" ] && [ "$DB_ADDRESS" = ":9090" ]; then
HOST_IP=`hostname -I | awk '{print $1}'`
DB_ADDRESS="$HOST_IP:9090"
fi

for val in "${GRAFANA_ENV_ARRAY[@]}"; do
GRAFANA_ENV_COMMAND="$GRAFANA_ENV_COMMAND -c $val"
Expand Down

0 comments on commit 45ebfdc

Please sign in to comment.