Skip to content

Commit

Permalink
Update Wave Autoscale health check schedule to run every 10 minutes a…
Browse files Browse the repository at this point in the history
…nd enhance health check script for improved error handling
  • Loading branch information
Ari-suhyeon committed Dec 2, 2024
1 parent 0297c20 commit b146f06
Showing 1 changed file with 43 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: wave-autoscale-healthcheck
namespace: wave-autoscale
spec:
schedule: "*/1 * * * *"
schedule: "*/10 * * * *"
jobTemplate:
spec:
template:
Expand All @@ -16,49 +16,51 @@ spec:
- /bin/sh
args:
- -c
- >-
echo Start a health check for Wave Autoscale;
response=$(curl -sL http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3024/);
code=$(echo ${response} | jq .code);
if [ "$code" -eq 200 ]; then
echo "Wave Autoscale Core working Successful."
exit 0
else
echo "Failed to fetch Wave Autoscale Core. Response was $response"
exit 1
- |
echo "Start a health check for Wave Autoscale";
# Core health check
response=$(curl -s -w "\n200" http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3024/)
status_code=$(echo "$response" | tail -n1);
if [ "$status_code" -ne 200 ]; then
echo "Failed to fetch Wave Autoscale Core. Response was $response";
exit 1;
fi
response=$(curl -sL http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3024/api/info);
code=$(echo ${response} | jq .code);
if [ "$code" -eq 200 ]; then
license=$(echo "$response" | jq -r '.license')
if [ "$license" == "{}" ]; then
echo "Wave Autoscale License is invalid: empty map detected."
exit 1
else
echo "Wave Autoscale License is valid."
exit 0
fi
else
echo "Wave Autoscale License is is invalid."
exit 1
echo "Wave Autoscale Core working Successful.";
# License check
response=$(curl -s -w "\n200" http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3024/api/info);
status_code=$(echo "$response" | tail -n1);
body=$(echo "$response" | head -n-1);
if [ "$status_code" -ne 200 ]; then
echo "Wave Autoscale License is invalid. Response was $response";
exit 1;
fi
response=$(curl -sL http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3025/);
code=$(echo ${response} | jq .code);
if [ "$code" -eq 200 ]; then
echo "Wave Autoscale Web Console working Successful."
exit 0
else
echo "Failed to fetch Wave Autoscale Web Console. Response was $response"
exit 1
license=$(echo "$body" | jq -r '.license');
if [ "$license" = "{}" ]; then
echo "Wave Autoscale License is invalid: empty map detected.";
exit 1;
fi
response=$(curl -sL http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3026/);
code=$(echo ${response} | jq .code);
if [ "$code" -eq 200 ]; then
echo "Wave Autoscale Autopilot working Successful."
exit 0
else
echo "Failed to fetch Wave Autoscale Autopilot. Response was $response"
exit 1
echo "Wave Autoscale License is valid.";
# Web Console health check
response=$(curl -s -w "\n200" http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3025/);
status_code=$(echo "$response" | tail -n1);
if [ "$status_code" -ne 200 ]; then
echo "Failed to fetch Wave Autoscale Web Console. Response was $response";
exit 1;
fi
echo "Wave Autoscale Web Console working Successful.";
# Autopilot health check
response=$(curl -s -w "\n200" http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3026/);
status_code=$(echo "$response" | tail -n1);
if [ "$status_code" -ne 200 ]; then
echo "Failed to fetch Wave Autoscale Autopilot. Response was $response";
exit 1;
fi
echo "Wave Autoscale Autopilot working Successful.";
exit 0;
restartPolicy: Never
backoffLimit: 1

0 comments on commit b146f06

Please sign in to comment.