-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update(chart): Node preStop and startupProbe in autoscaling Deployment (
#2139) update(chart): script for Node preStop and startupProbe in autoscaling Deployment Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
- Loading branch information
Showing
14 changed files
with
201 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
function on_exit() { | ||
rm -rf /tmp/nodeProbe${ID} | ||
rm -rf /tmp/gridProbe${ID} | ||
} | ||
trap on_exit EXIT | ||
|
||
ID=$(echo $RANDOM) | ||
|
||
function replace_localhost_by_service_name() { | ||
internal="${SE_HUB_HOST:-$SE_ROUTER_HOST}:${SE_HUB_PORT:-$SE_ROUTER_PORT}" | ||
if [[ "${SE_NODE_GRID_URL}" == *"/localhost"* ]]; then | ||
SE_GRID_URL=${SE_NODE_GRID_URL//localhost/${internal}} | ||
elif [[ "${SE_NODE_GRID_URL}" == *"/127.0.0.1"* ]]; then | ||
SE_GRID_URL=${SE_NODE_GRID_URL//127.0.0.1/${internal}} | ||
elif [[ "${SE_NODE_GRID_URL}" == *"/0.0.0.0"* ]]; then | ||
SE_GRID_URL=${SE_NODE_GRID_URL//0.0.0.0/${internal}} | ||
fi | ||
echo "SE_GRID_URL: ${SE_GRID_URL}" | ||
} | ||
replace_localhost_by_service_name | ||
|
||
if curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status -o /tmp/nodeProbe${ID}; then | ||
NODE_ID=$(jq -r '.value.node.nodeId' /tmp/nodeProbe${ID}) | ||
NODE_STATUS=$(jq -r '.value.node.availability' /tmp/nodeProbe${ID}) | ||
|
||
curl -sfk "${SE_GRID_URL}/status" -o /tmp/gridProbe${ID} | ||
GRID_NODE_ID=$(jq -e ".value.nodes[].id|select(. == \"${NODE_ID}\")" /tmp/gridProbe${ID} | tr -d '"' || true) | ||
|
||
if [ "${NODE_STATUS}" = "UP" ] && [ -n "${NODE_ID}" ] && [ -n "${GRID_NODE_ID}" ] && [ "${NODE_ID}" = "${GRID_NODE_ID}" ]; then | ||
echo "Node ID: ${NODE_ID} with status: ${NODE_STATUS}" | ||
echo "Found in the Grid a matched Node ID: ${GRID_NODE_ID}" | ||
exit 0 | ||
else | ||
echo "Node ID: ${NODE_ID} is not found in the Grid. The registration could be in progress." | ||
exit 1 | ||
fi | ||
else | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.