-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CronJob for Wave Autoscale health checks
- Loading branch information
1 parent
6be45be
commit edc6163
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
eks-anywhere-common/Testers/STCLab/WaveAutoscale/wave-autoscale-cronjob.yaml
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,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 |