From b1bed1d5f80cf7dc3897cf6d6d310cd4e700967f Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Thu, 14 Oct 2021 13:56:25 -0700 Subject: Update kernel version node selector in nfd test Issue-ID: MULTICLOUD-1413 Signed-off-by: Todd Malsbary Change-Id: I4f15f987ffb739544fd4c62f8f57ab38864bbbb3 --- kud/tests/nfd.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'kud/tests') diff --git a/kud/tests/nfd.sh b/kud/tests/nfd.sh index 1fb0f60e..9937cc65 100755 --- a/kud/tests/nfd.sh +++ b/kud/tests/nfd.sh @@ -66,15 +66,19 @@ POD } function create_pod_yaml_with_nodeSelector { + # Get the major kernel version of a worker node in the cluster: + # this will be used below in the node selector of the test pod + local -r node_name=$(kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name} {.spec.taints[?(@.effect=="NoSchedule")].effect}{"\n"}{end}' | awk 'NF==1 {print $0;exit}') + local -r kernel_version=$(kubectl get node ${node_name} -o jsonpath='{.metadata.labels.feature\.node\.kubernetes\.io/kernel-version\.major}') -cat << POD > $HOME/$pod_name-nodeSelector.yaml + cat << POD > $HOME/$pod_name-nodeSelector.yaml apiVersion: v1 kind: Pod metadata: - name: $pod_name + name: ${pod_name} spec: nodeSelector: - feature.node.kubernetes.io/kernel-version.major: '4' + feature.node.kubernetes.io/kernel-version.major: '${kernel_version}' containers: - name: with-node-affinity image: gcr.io/google_containers/pause:2.0 -- cgit 1.2.3-korg