Skip to content

Commit

Permalink
Add CronJob for Wave Autoscale health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Ari-suhyeon committed Dec 2, 2024
1 parent 6be45be commit edc6163
Showing 1 changed file with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: wave-autoscale-healthcheck
namespace: wave-autoscale
spec:
schedule: "*/10 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: wave-autoscale-healthcheck
image: alpine/k8s:1.26.9
command:
- /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
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
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
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
fi
restartPolicy: Never
backoffLimit: 1

0 comments on commit edc6163

Please sign in to comment.