
Modifications have been made in the containers of the snmp-armada-app, and deployment and values files of helm chart package. The following changes are made: 1. Bootstrap.sh scripts of snmp trap-subagent and sub-agent were modified to waits until the master agent container is up, to intialize them. 2. Add an environment variable to set the maxium numer or tries until raise a communication error and restart the pod. 3. Add other environment variables for testing purpose that can be modified with a helm override, like the master agent address and port. 4. Add an init_container in the snmp pod thats applies a delay when de pod starts, to solve ColdStart traps missing. Closes-Bug: 1943612 Signed-off-by: Jorge Saffe <jorge.saffe@windriver.com> Change-Id: I2cd4a6309e99ba73257253077dc13b3b725043dd
49 lines
1.1 KiB
Bash
Executable File
49 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -u
|
|
|
|
# Option handling in sh
|
|
if [ "$OPTIONDEBUG" != "" ]; then
|
|
case "$OPTIONDEBUG" in
|
|
-DALL) echo "-DALL - debug option enable"
|
|
;;
|
|
-*) echo "Unrecognized option $OPTIONDEBUG"
|
|
OPTIONDEBUG=""
|
|
;;
|
|
*) echo "Bad argument $OPTIONDEBUG"
|
|
OPTIONDEBUG=""
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# Waiting master agent initialization
|
|
if [ "$MASTER_AGENT_HOST" == "" ]; then
|
|
MASTER_AGENT_HOST="localhost";
|
|
fi
|
|
|
|
if [ "$MASTER_AGENT_PORT" == "" ]; then
|
|
MASTER_AGENT_PORT=705;
|
|
fi
|
|
|
|
if [ "$MASTER_AGENT_CONNECTION_RETRIES" == "" ]; then
|
|
MASTER_AGENT_CONNECTION_RETRIES=20;
|
|
fi
|
|
|
|
HOST=$MASTER_AGENT_HOST
|
|
PORT=$MASTER_AGENT_PORT
|
|
RETRIES=$MASTER_AGENT_CONNECTION_RETRIES
|
|
|
|
echo "Waiting master agent initialization ($HOST:$PORT) [MaxRetries:$RETRIES]"
|
|
counter=0
|
|
until </dev/tcp/$HOST/$PORT; do
|
|
sleep 1;
|
|
[[ counter -eq $RETRIES ]] && exit 1;
|
|
echo "Trying again, try #$counter";
|
|
$((counter++));
|
|
done
|
|
|
|
# Internal params
|
|
RUN_CMD="./snmpSubAgent ${OPTIONDEBUG} -f -x tcp:${HOST}:$PORT"
|
|
|
|
# Launch
|
|
$RUN_CMD
|