Skip to content

Commit

Permalink
Merge pull request #43 from sustainable-computing-io/kepler-check
Browse files Browse the repository at this point in the history
kepler check cleanup
  • Loading branch information
mamy-CS authored Feb 22, 2024
2 parents 644806c + c4b4d36 commit 63cfdd1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions deployment/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ else # continue
fi

export SUSQL_NAMESPACE="openshift-kepler-operator"
export KEPLER_PROMETHEUS_NAMESPACE="openshift-monitoring"

if [[ -z ${PROMETHEUS_PROTOCOL} ]]; then
PROMETHEUS_PROTOCOL="http"
Expand Down Expand Up @@ -93,23 +94,33 @@ for action in $(echo ${actions} | tr ',' '\n')
do
if [[ ${action} = "kepler-check" ]]; then
# Check if Kepler is serving metrics through prometheus
echo "Checking if Kepler is deployed..."
echo "->Checking if Kepler is deployed..."

sed "s|KEPLER_PROMETHEUS_URL|${KEPLER_PROMETHEUS_URL}|g" kepler-check.yaml | kubectl apply --namespace ${SUSQL_NAMESPACE} -f -
sed "s|KEPLER_PROMETHEUS_URL|${KEPLER_PROMETHEUS_URL}|g" kepler-check.yaml | kubectl apply --namespace ${KEPLER_PROMETHEUS_NAMESPACE} -f -

echo "->Checking kepler-check status";
while true
do
phase=$(kubectl get pod kepler-check -o jsonpath='{.status.phase}' --namespace ${SUSQL_NAMESPACE})
echo -n "." && sleep 1;
phase=$(kubectl get pod kepler-check -o jsonpath='{.status.phase}' --namespace ${KEPLER_PROMETHEUS_NAMESPACE})

if [[ ${phase} != "Pending" ]] && [[ ${phase} != "Running" ]]; then
break
fi
done

logs=$(kubectl logs -f kepler-check --namespace ${SUSQL_NAMESPACE})
kubectl delete -f kepler-check.yaml --namespace ${SUSQL_NAMESPACE}
echo ""
echo "Kepler check '${phase}'"

logs=$(kubectl logs -f kepler-check --namespace ${KEPLER_PROMETHEUS_NAMESPACE})
echo "->Deleting kepler-check pod..."
kubectl delete -f kepler-check.yaml --namespace ${KEPLER_PROMETHEUS_NAMESPACE}

echo "->Kepler service"
if [[ ${phase} == "Failed" ]]; then
echo "-----------------"
echo "Kepler check logs"
echo "-----------------"
echo ${logs}
echo "Kepler service at '${KEPLER_PROMETHEUS_URL}' was not found. Check values and try again."
exit 1
Expand Down

0 comments on commit 63cfdd1

Please sign in to comment.