Created
March 17, 2021 11:56
-
-
Save psturc/f1e35bbeba3eba25da04cc2d7551cae2 to your computer and use it in GitHub Desktop.
read keycloak statefulsets and save the data in json with timestamp
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
{ | |
"rhsso": [], | |
"usersso": [] | |
} |
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
#!/usr/bin/env bash | |
STATUS_FILENAME="sso-status-during-upgrade.json" | |
TMP_FILE="status.tmp" | |
PAUSE_TIME_VALUE=2 | |
while true | |
do | |
# RHSSO | |
echo "Getting RHSSO stateful set..." | |
jq ".rhsso[.rhsso | length] |= . + $(oc get statefulset keycloak -n redhat-rhoam-rhsso -o json | jq -r ".timestamp = \"$(date '+%T')\"")" < $STATUS_FILENAME > $TMP_FILE | |
mv $TMP_FILE $STATUS_FILENAME | |
# User SSO | |
echo "Getting User-SSO stateful set..." | |
jq ".usersso[.usersso | length] |= . + $(oc get statefulset keycloak -n redhat-rhoam-user-sso -o json | jq -r ".timestamp = \"$(date '+%T')\"")" < $STATUS_FILENAME > $TMP_FILE | |
mv $TMP_FILE $STATUS_FILENAME | |
echo "Sleeping for $PAUSE_TIME_VALUE seconds..." | |
sleep $PAUSE_TIME_VALUE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment