mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
tests: add get_one_kata_node() to tests_common.sh
The introduced get_one_kata_node() returns the first node that has the kata-runtime=true label, i.e., supposedly a node with kata installed. This is useful for tests that should run on a determined worker node on a multi-nodes cluster. Fixes #7619 Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
parent
68f083c4d0
commit
61c9c17bff
@ -38,6 +38,14 @@ get_pod_config_dir() {
|
||||
info "k8s configured to use runtimeclass"
|
||||
}
|
||||
|
||||
# Return the first worker found that is kata-runtime labeled.
|
||||
get_one_kata_node() {
|
||||
local resource_name
|
||||
resource_name="$(kubectl get node -l katacontainers.io/kata-runtime=true -o name | head -1)"
|
||||
# Remove leading "/node"
|
||||
echo "${resource_name/"node/"}"
|
||||
}
|
||||
|
||||
# Runs a command in the host filesystem.
|
||||
exec_host() {
|
||||
node="$(kubectl get node -o name)"
|
||||
|
Loading…
Reference in New Issue
Block a user