gmeghnag / omc

OpenShift Must-Gather Client
Apache License 2.0
153 stars 63 forks source link

Add fallback if core/pods.yaml is empty, closes #147 #150

Closed cchen666 closed 6 months ago

cchen666 commented 6 months ago

This PR adds some fallbacks when core/pods.yaml is empty.

Before (after removing core/pods.yaml from openshift-kube-apiserver dir)

$ omc get pods -n openshift-kube-apiserver
No resources pods.core found in openshift-kube-apiserver namespace.

$ omc logs kube-apiserver-master1.XXX.XXX.com -c kube-apiserver -n openshift-kube-apiserver
error: namespace openshift-kube-apiserver not found.

With this PR:

./omc get pods -n openshift-kube-apiserver
NAME                                                   READY   STATUS    RESTARTS   AGE
kube-apiserver-guard-master1.ocp-XXXXXXX.XXXXXXX.com   1/1     Running   0          17h
kube-apiserver-guard-master2.ocp-XXXXXXX.XXXXXXX.com   1/1     Running   0          17h
kube-apiserver-guard-master3.ocp-XXXXXXX.XXXXXXX.com   1/1     Running   0          17h
kube-apiserver-master1.ocp-XXXXXXX.XXXXXXX.com         5/5     Running   0          1d
kube-apiserver-master2.ocp-XXXXXXX.XXXXXXX.com         5/5     Running   0          1d
kube-apiserver-master3.ocp-XXXXXXX.XXXXXXX.com         5/5     Running   0          1d

./omc logs kube-apiserver-master1.ocp-XXXXXXX.XXXXXXX.com -c kube-apiserver -n openshift-kube-apiserver | wc -l
    4787

This could improve the situation when the core/pods.yaml is missing and prevents some confusions to support engineer when something unexpected happened during MG collection which causes core/pods.yaml missing