Skip to content

Commit 643b4a5

Browse files
committed
Fix get cri-o stats script
The script was not providing stats properly, because the oc binary is located in different place. Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
1 parent 242c946 commit 643b4a5

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

scripts/get-stats.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,24 @@ set -x
2121

2222
DURATION_TIME=${DURATION_TIME:-10}
2323

24-
NODE_NAMES=$(/usr/local/bin/oc get node -o name -l node-role.kubernetes.io/worker)
24+
if ! command -v oc; then
25+
PATH=$PATH:/home/zuul/bin
26+
fi
27+
28+
if ! [ -f "$HOME/.kube/config" ]; then
29+
if [ -f "/home/zuul/.crc/machines/crc/kubeconfig" ]; then
30+
export KUBECONFIG=/home/zuul/.crc/machines/crc/kubeconfig
31+
elif [ -f "/home/zuul/.kube/config" ]; then
32+
export KUBECONFIG=/home/zuul/.kube/config
33+
fi
34+
fi
35+
36+
NODE_NAMES=$(oc get node -o name -l node-role.kubernetes.io/worker)
2537
if [ -z "$NODE_NAMES" ]; then
2638
echo "Unable to determine node name with 'oc' command."
2739
exit 1
2840
fi
2941

3042
for node in $NODE_NAMES; do
31-
/usr/local/bin/oc debug $node -T -- chroot /host /usr/bin/bash -c "crictl stats -a -s $DURATION_TIME | (sed -u 1q; sort -k 2 -h -r)"
43+
oc debug "$node" -T -- chroot /host /usr/bin/bash -c "crictl stats -a -s $DURATION_TIME | (sed -u 1q; sort -k 2 -h -r)"
3244
done

0 commit comments

Comments
 (0)