-
Notifications
You must be signed in to change notification settings - Fork 44
/
node-versions
executable file
·20 lines (18 loc) · 1.05 KB
/
node-versions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
# description: Show node components versions such as kubelet, crio, kernel, etc.
[ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils")
if oc auth can-i get nodes -A >/dev/null 2>&1; then
KUBELETVERSIONS=$(oc get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.nodeInfo.kubeletVersion}{"\n"}{end}' | column -t -N "NODE,KUBELET")
CRIOVERSIONS=$(oc get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.nodeInfo.containerRuntimeVersion}{"\n"}{end}' | column -t -N "NODE,CRIO")
KERNELVERSIONS=$(oc get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.nodeInfo.kernelVersion}{"\n"}{end}' | column -t -N "NODE,KERNEL")
OSIMAGEVERSIONS=$(oc get nodes -o jsonpath='{range .items[*]}{.metadata.name}{":"}{.status.nodeInfo.osImage}{"\n"}{end}' | column -t -s ":" -N "NODE,OSIMAGE")
msg "${KUBELETVERSIONS}"
msg "${CRIOVERSIONS}"
msg "${KERNELVERSIONS}"
msg "${OSIMAGEVERSIONS}"
exit ${OCINFO}
else
msg "Couldn't get nodes, check permissions"
exit ${OCSKIP}
fi
exit ${OCUNKNOWN}