-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from tomp21/feat/selfheal
Feat/selfheal
- Loading branch information
Showing
8 changed files
with
212 additions
and
8 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
internal/controller/reconcilers/configmaps/health/ping_liveness_local.sh
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,20 @@ | ||
#!/bin/bash | ||
|
||
[[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")" | ||
[[ -n "$REDIS_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_PASSWORD" | ||
response=$( | ||
timeout -s 15 $1 \ | ||
redis-cli \ | ||
-h localhost \ | ||
-p $REDIS_PORT \ | ||
ping | ||
) | ||
if [ "$?" -eq "124" ]; then | ||
echo "Timed out" | ||
exit 1 | ||
fi | ||
responseFirstWord=$(echo $response | head -n1 | awk '{print $1;}') | ||
if [ "$response" != "PONG" ] && [ "$responseFirstWord" != "LOADING" ] && [ "$responseFirstWord" != "MASTERDOWN" ]; then | ||
echo "$response" | ||
exit 1 | ||
fi |
5 changes: 5 additions & 0 deletions
5
internal/controller/reconcilers/configmaps/health/ping_liveness_local_and_master.sh
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,5 @@ | ||
script_dir="$(dirname "$0")" | ||
exit_status=0 | ||
"$script_dir/ping_liveness_local.sh" $1 || exit_status=$? | ||
"$script_dir/ping_liveness_master.sh" $1 || exit_status=$? | ||
exit $exit_status |
20 changes: 20 additions & 0 deletions
20
internal/controller/reconcilers/configmaps/health/ping_liveness_master.sh
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,20 @@ | ||
#!/bin/bash | ||
|
||
[[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")" | ||
[[ -n "$REDIS_MASTER_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD" | ||
response=$( | ||
timeout -s 15 $1 \ | ||
redis-cli \ | ||
-h $REDIS_MASTER_HOST \ | ||
-p $REDIS_PORT \ | ||
ping | ||
) | ||
if [ "$?" -eq "124" ]; then | ||
echo "Timed out" | ||
exit 1 | ||
fi | ||
responseFirstWord=$(echo $response | head -n1 | awk '{print $1;}') | ||
if [ "$response" != "PONG" ] && [ "$responseFirstWord" != "LOADING" ]; then | ||
echo "$response" | ||
exit 1 | ||
fi |
19 changes: 19 additions & 0 deletions
19
internal/controller/reconcilers/configmaps/health/ping_readiness_local.sh
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,19 @@ | ||
#!/bin/bash | ||
|
||
[[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")" | ||
[[ -n "$REDIS_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_PASSWORD" | ||
response=$( | ||
timeout -s 15 $1 \ | ||
redis-cli \ | ||
-h localhost \ | ||
-p $REDIS_PORT \ | ||
ping | ||
) | ||
if [ "$?" -eq "124" ]; then | ||
echo "Timed out" | ||
exit 1 | ||
fi | ||
if [ "$response" != "PONG" ]; then | ||
echo "$response" | ||
exit 1 | ||
fi |
5 changes: 5 additions & 0 deletions
5
internal/controller/reconcilers/configmaps/health/ping_readiness_local_and_master.sh
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,5 @@ | ||
script_dir="$(dirname "$0")" | ||
exit_status=0 | ||
"$script_dir/ping_readiness_local.sh" $1 || exit_status=$? | ||
"$script_dir/ping_readiness_master.sh" $1 || exit_status=$? | ||
exit $exit_status |
19 changes: 19 additions & 0 deletions
19
internal/controller/reconcilers/configmaps/health/ping_readiness_master.sh
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,19 @@ | ||
#!/bin/bash | ||
|
||
[[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")" | ||
[[ -n "$REDIS_MASTER_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD" | ||
response=$( | ||
timeout -s 15 $1 \ | ||
redis-cli \ | ||
-h $REDIS_MASTER_HOST \ | ||
-p $REDIS_PORT \ | ||
ping | ||
) | ||
if [ "$?" -eq "124" ]; then | ||
echo "Timed out" | ||
exit 1 | ||
fi | ||
if [ "$response" != "PONG" ]; then | ||
echo "$response" | ||
exit 1 | ||
fi |
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