From 1eae657b911287cc21be0ca4ab9aa6ea64c374b1 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Thu, 26 Oct 2023 17:54:24 -0300 Subject: [PATCH] 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 --- tests/integration/kubernetes/lib.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/integration/kubernetes/lib.sh b/tests/integration/kubernetes/lib.sh index c0da859681..9b101a904a 100644 --- a/tests/integration/kubernetes/lib.sh +++ b/tests/integration/kubernetes/lib.sh @@ -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: