Skip to content

Commit

Permalink
Add service account and enhance health check for Wave Autoscale cronjob
Browse files Browse the repository at this point in the history
  • Loading branch information
Ari-suhyeon committed Dec 10, 2024
1 parent a507c7d commit 48e5016
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
spec:
template:
spec:
serviceAccountName: wave-autoscale-sa
containers:
- name: wave-autoscale-healthcheck
image: alpine/k8s:1.26.9
Expand All @@ -17,6 +18,9 @@ spec:
args:
- -c
- |
#
# Health check for Wave Autoscale
#
echo "Start a health check for Wave Autoscale";
# Core health check
Expand Down Expand Up @@ -69,6 +73,31 @@ spec:
exit 1;
fi
#
# Autopilot behavior check
#
echo "Start checking Autopilot behavior";
# 1. Agent Running Check
AGENT_POD_LIST=$(kubectl get pods -n wave-autoscale -l app.kubernetes.io/name=wave-autoscale-agent -o jsonpath='{.items[*].metadata.name}')
AGENT_ALL_RUNNING=true
for POD in $AGENT_POD_LIST; do
STATUS=$(kubectl get pod "$POD" -n wave-autoscale -o jsonpath='{.status.phase}')
if [ "$STATUS" != "Running" ]; then
echo "Agent Pod $POD is not running (current status: $STATUS)"
AGENT_ALL_RUNNING=false
else
echo "Agent Pod $POD is running.."
fi
done
if [ "$AGENT_ALL_RUNNING" = true ]; then
echo "All Agent Pods in DaemonSet '$DAEMONSET_NAME' are running."
else
echo "Some Agent Pods in DaemonSet '$DAEMONSET_NAME' are not running."
exit 1
fi
exit 0;
restartPolicy: Never
backoffLimit: 1

0 comments on commit 48e5016

Please sign in to comment.