Accessing the pod through the app name to avoid pod overlap
Change-Id: I3fa832db49e42fc8495e5e654b0e84fa5fea35ae
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 6dbf6b1..1b865a4 100644
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -55,7 +55,7 @@
[Arguments] ${namespace} ${name} ${command}
[Documentation] Uses kubectl to execute a command in the pod and return the output
${rc} ${exec_pod_name}= Run and Return Rc and Output
- ... kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}'
+ ... kubectl -n ${namespace} get pods -l app=${name} -o name
Log ${exec_pod_name}
Should Not Be Empty ${exec_pod_name} Unable to parse pod name
${rc} ${output}= Run and Return Rc and Output
@@ -67,7 +67,7 @@
[Arguments] ${namespace} ${name} ${command}
[Documentation] Uses kubectl to execute a command in the pod and return the stderr and stdout
${rc} ${exec_pod_name}= Run and Return Rc and Output
- ... kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}'
+ ... kubectl -n ${namespace} get pods -l app=${name} -o name
Log ${exec_pod_name}
Should Not Be Empty ${exec_pod_name} Unable to parse pod name
@{args}= Split String ${command}