tests/k8s: add set_node() to lib.sh

Use this new function to set the node where the pod should be scheduled
to.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
Wainer dos Santos Moschetta 2023-10-26 17:54:24 -03:00
parent c6075c8627
commit 1eae657b91

View File

@ -150,6 +150,20 @@ set_metadata_annotation() {
yq w -i --style=double "${yaml}" "${annotation_key}" "${value}"
}
# Set the node name on configuration spec.
#
# Parameters:
# $1 - the yaml file
# $2 - the node name
#
set_node() {
local yaml="$1"
local node="$2"
[ -n "$node" ] || return 1
yq w -i "${yaml}" "spec.nodeName" "$node"
}
# Get the systemd's journal from a worker node
#
# Parameters: