Skip to content

Commit

Permalink
Update Wave Autoscale health check schedule to run every 5 minutes an…
Browse files Browse the repository at this point in the history
…d enhance health check logic
  • Loading branch information
Ari-suhyeon committed Dec 4, 2024
1 parent 9f22fd7 commit 7fd8487
Showing 1 changed file with 20 additions and 22 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: "*/10 * * * *"
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
Expand All @@ -20,46 +20,44 @@ spec:
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
response=$(curl -s http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3024/)
name=$(echo "$response" | jq -r '.name')
if [ "$name" = "wa-api-server" ]; then
echo "Wave Autoscale Core working Successful.";
else
echo "Failed to fetch Wave Autoscale Core. Response was $response";
exit 1;
fi
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
license=$(echo "$body" | jq -r '.license');
response=$(curl -s http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3024/api/info)
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.";
fi
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
response=$(curl -s http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3025/);
redirect_path=$(echo "$response")
if [ "$redirect_path" = "/app/k8s" ]; then
echo "Wave Autoscale Web Console working Successful.";
else
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
response=$(curl -s http://wave-autoscale-svc.wave-autoscale.svc.cluster.local:3026/)
name=$(echo "$response" | jq -r '.name')
if [ "$name" = "wa-autopilot" ]; then
echo "Wave Autoscale Autopilot working Successful.";
else
echo "Failed to fetch Wave Autoscale Autopilot. Response was $response";
exit 1;
fi
echo "Wave Autoscale Autopilot working Successful.";
exit 0;
restartPolicy: Never
Expand Down

0 comments on commit 7fd8487

Please sign in to comment.