-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rthooks: move rt detection in a helpers file
Create an helpers file for scripts and add a function for detecting the runtime system there. This is meant to be used by a script added in a subsequent patch. Signed-off-by: Kornilios Kourtis <[email protected]>
- Loading branch information
Showing
2 changed files
with
43 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# vim:set noet ci pi ts=4 sw=4 ft=bash | ||
|
||
detect_runtime() { | ||
crictlcmd=$(minikube ssh -- 'sudo crictl version | sed -ne "s/RuntimeName:[[:space:]]\+\(.*\)/\1/p"') | ||
if [[ "$crictlcmd" =~ "containerd" ]]; then | ||
echo "containerd" | ||
return 0 | ||
fi | ||
if [[ "$crictlcmd" =~ "cri-o" ]]; then | ||
echo "crio" | ||
return 0 | ||
fi | ||
|
||
kubeletcmd=$(minikube ssh -- 'sudo tr \\0 " " < /proc/"$(pgrep kubelet)"/cmdline') | ||
if [[ "$kubeletcmd" =~ "containerd.sock" ]]; then | ||
echo "containerd" | ||
return 0 | ||
fi | ||
|
||
if [[ "$kubeletcmd" =~ "crio.sock" ]]; then | ||
echo "crio" | ||
return 0 | ||
fi | ||
|
||
echo 1>&2 "Unknown runtime, bailing out" | ||
echo 1>&2 "crictlcmd output: $crictlcmd" | ||
echo 1>&2 "kubeletcmd output: $kubeletcmd" | ||
exit 1 | ||
} |
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