diff --git a/eks-anywhere-common/Testers/STCLab/WaveAutoscale/wave-autoscale-cronjob.yaml b/eks-anywhere-common/Testers/STCLab/WaveAutoscale/wave-autoscale-cronjob.yaml index c41213aa..d0e683e8 100644 --- a/eks-anywhere-common/Testers/STCLab/WaveAutoscale/wave-autoscale-cronjob.yaml +++ b/eks-anywhere-common/Testers/STCLab/WaveAutoscale/wave-autoscale-cronjob.yaml @@ -4,7 +4,7 @@ metadata: name: wave-autoscale-healthcheck namespace: wave-autoscale spec: - schedule: "*/10 * * * *" + schedule: "*/5 * * * *" jobTemplate: spec: template: @@ -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