Last active
April 14, 2021 20:26
-
-
Save cdoan1/b08fc5c513218764171e9919fb88c27d to your computer and use it in GitHub Desktop.
post-deployment-reporting
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
#!/bin/bash | |
# collect a record of all the running pods | |
for NS in `oc get namespace | grep open-cluster | awk '{print $1}'` | |
do | |
oc get pods -n $NS >> temp.txt | |
done | |
# report the total number of pods in ACM | |
number_pods=$( cat temp.txt | grep -v NAME | wc -l | awk '{print $1}' ) | |
driver=$( oc get pods -n open-cluster-management -o yaml | grep "image:" | grep DOWN | cut -d':' -f4 | sort -u ) | |
# generate report | |
echo "Date: $(date)" > post-report.txt | |
echo "ACM driver: $driver" >> post-report.txt | |
echo "number of pods with this driver: $number_pods" >> post-report.txt | |
echo "" >> post-report.txt | |
echo "" >> post-report.txt | |
column -t temp.txt >> post-report.txt | |
rm temp.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment