Add kernel release check to environment_check.sh

longhorn-6854

Signed-off-by: Phan Le <phan.le@suse.com>
This commit is contained in:
Phan Le 2023-10-06 16:59:18 -07:00 committed by PhanLe1010
parent 8c6a3f5142
commit d30a970ea8

View File

@ -273,6 +273,28 @@ check_nodes() {
fi
}
verlte() {
printf '%s\n' "$1" "$2" | sort -C -V
}
verlt() {
! verlte "$2" "$1"
}
check_kernel_release() {
local pod=$1
recommended_kernel_release="5.8"
local kernel=$(detect_node_kernel_release ${pod})
if verlt "$kernel" "$recommended_kernel_release" ; then
local node=$(kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName)
warn "Node $node has outdated kernel release: $kernel. Recommending kernel release >= $recommended_kernel_release"
return 1
fi
}
check_iscsid() {
local pod=$1
@ -493,7 +515,7 @@ done
######################################################
# Main logics
######################################################
DEPENDENCIES=("kubectl" "jq" "mktemp")
DEPENDENCIES=("kubectl" "jq" "mktemp" "sort" "printf")
check_local_dependencies "${DEPENDENCIES[@]}"
# Check the each host has a unique hostname (for RWX volume)
@ -507,6 +529,7 @@ create_ds
wait_ds_ready
check_mount_propagation
check_nodes "kernel release" check_kernel_release
check_nodes "iscsid" check_iscsid
check_nodes "multipathd" check_multipathd
check_nodes "packages" check_packages