Using popen to run K8s commands. The SERVICE_ACCOUNT does not produce any output. I get <none>.
I have escaped the \" and \\
Original command:
oc get pods -n <namespace> -o custom-columns=POD_NAME:.metadata.name,SERVICE_ACCOUNT:.spec.serviceAccount,SCC_PROFILE:".metadata.annotations.openshift\.io/scc"
Code:
output = subprocess.Popen(["oc","get","pods","-n",smf_namespace,"-o","custom-columns=POD_NAME:.metadata.name,SERVICE_ACCOUNT:.spec.serviceAccount,SCC_PROFILE:\".metadata.annotations.openshift\\.io/scc\""],stdout=subprocess.PIPE,encoding='utf8')