summaryrefslogtreecommitdiffstats
path: root/kud/tests/topology-manager.sh
diff options
context:
space:
mode:
authorTodd Malsbary <todd.malsbary@intel.com>2021-06-17 17:10:38 -0700
committerTodd Malsbary <todd.malsbary@intel.com>2021-06-21 12:14:48 -0700
commit2cfc1f2d67103726140b32b5a5c555f7a66636be (patch)
tree268feaaf39d4d2cda0750790ec45d32e139f3ad0 /kud/tests/topology-manager.sh
parentdc925231a978d1ae4dce969cb4c386d4a1b0bb87 (diff)
Move topology-manager configuration to kubespray
The steps performed by the existing ansible playbook can be performed directly by kubespray. In addtion, fix and enable the topology-manager.sh test. Issue-ID: MULTICLOUD-1324 Signed-off-by: Todd Malsbary <todd.malsbary@intel.com> Change-Id: Iee2197c1fc3e35288796399cccff0d3ae0925a6c
Diffstat (limited to 'kud/tests/topology-manager.sh')
-rwxr-xr-xkud/tests/topology-manager.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/kud/tests/topology-manager.sh b/kud/tests/topology-manager.sh
index 5c9f900d..b1126aac 100755
--- a/kud/tests/topology-manager.sh
+++ b/kud/tests/topology-manager.sh
@@ -76,15 +76,15 @@ while [[ $status_phase != "Running" ]]; do
fi
done
-container_id=$(kubectl describe pod $pod_name | grep "Container ID" | awk '{print $3}' )
-container_id=${container_id#docker://}
-container_id=${container_id:0:12}
+uid=$(kubectl get pod pod-topology-manager -o jsonpath='{.metadata.uid}')
+node_name=$(kubectl get pod $pod_name -o jsonpath='{.spec.nodeName}')
+node_ip=$(kubectl get node $node_name -o jsonpath='{.status.addresses[].address}')
apt-get install -y jq
-cpu_core=$(cat /var/lib/kubelet/cpu_manager_state | jq -r .| grep ${container_id} | awk -F ':' '{print $2}'| awk -F '"' '{print $2}')
-numa_node_number=$(lscpu | grep "NUMA node(s)" | awk -F ':' '{print $2}')
+cpu_core=$(ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $node_ip -- cat /var/lib/kubelet/cpu_manager_state | jq -r --arg UID "${uid}" --arg POD_NAME "${pod_name}" '.entries[$UID][$POD_NAME]')
+numa_node_number=$(ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $node_ip -- lscpu | grep "NUMA node(s)" | awk -F ':' '{print $2}')
for (( node=0; node<$numa_node_number; node++ )); do
- ranges=$(lscpu | grep "NUMA node"$node | awk -F ':' '{print $2}')
+ ranges=$(ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $node_ip -- lscpu | grep "NUMA node"$node | awk -F ':' '{print $2}')
ranges=(${ranges//,/ })
for range in ${ranges[@]}; do
min=$(echo $range | awk -F '-' '{print $1}')
@@ -95,8 +95,8 @@ for (( node=0; node<$numa_node_number; node++ )); do
done
done
-vf_pci=$(kubectl exec -it $pod_name env | grep PCIDEVICE_INTEL_COM_INTEL_SRIOV_700 | awk -F '=' '{print $2}' | sed 's/\r//g')
-vf_numa_node=$(cat /sys/bus/pci/devices/$vf_pci/numa_node)
+vf_pci=$(kubectl exec -it $pod_name -- env | grep PCIDEVICE_INTEL_COM_INTEL_SRIOV_700 | awk -F '=' '{print $2}' | sed 's/\r//g')
+vf_numa_node=$(ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $node_ip -- cat /sys/bus/pci/devices/$vf_pci/numa_node)
echo "The allocated cpu core is:" $cpu_core
echo "The numa node of the allocated cpu core is:" $cpu_numa_node