diff --git a/utils/dump_logs/dump_irodscsidriver_logs.py b/utils/dump_logs/dump_irodscsidriver_logs.py index 7a77bb2..ebf6a2c 100644 --- a/utils/dump_logs/dump_irodscsidriver_logs.py +++ b/utils/dump_logs/dump_irodscsidriver_logs.py @@ -19,37 +19,23 @@ def get_kube_controller_pods(kubeconf=""): kubepods = [] - kubecommand = "kubectl get pods -n irods-csi-driver --no-headers --ignore-not-found -l app.kubernetes.io/instance=irods-csi-driver-controller" + kubeconf + kubecommand = "kubectl get pods -n irods-csi-driver --no-headers --ignore-not-found -l app.kubernetes.io/instance=irods-csi-driver-controller --field-selector status.phase=Running -o name" + kubeconf pipe = os.popen(kubecommand) for line in pipe: - fields = line.strip().split() - if len(fields) < 5: - continue - - podname = fields[0].strip() - status = fields[2].strip() - - if status == "Running": - kubepods.append(podname) + podname = line.strip() + kubepods.append(podname) return kubepods def get_kube_node_pods(kubeconf=""): kubepods = [] - kubecommand = "kubectl get pods -n irods-csi-driver --no-headers --ignore-not-found -l app.kubernetes.io/instance=irods-csi-driver-node" + kubeconf + kubecommand = "kubectl get pods -n irods-csi-driver --no-headers --ignore-not-found -l app.kubernetes.io/instance=irods-csi-driver-node --field-selector status.phase=Running -o name" + kubeconf pipe = os.popen(kubecommand) for line in pipe: - fields = line.strip().split() - if len(fields) < 5: - continue - - podname = fields[0].strip() - status = fields[2].strip() - - if status == "Running": - kubepods.append(podname) + podname = line.strip() + kubepods.append(podname) return kubepods