diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2019-10-09 13:09:35 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-10-14 13:58:38 +0100 |
commit | 16a4244baf50300f2d3d40bc9d33d07860361502 (patch) | |
tree | bae61e3b5969da930a4d72650395904ac9b10388 | |
parent | aa785860f3ea3aafb473b96d2f8b0e8fbaf13019 (diff) | |
download | sos-16a4244baf50300f2d3d40bc9d33d07860361502.tar.gz |
[kubernetes] Only use kubeconfig file if file is present
Updates the plugin for Red Hat systems to only use the OCP kubeconfig
file, /etc/origin/master/admin.kubeconfig, if it is actually present.
Resolves: #1826
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/plugins/kubernetes.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sos/plugins/kubernetes.py b/sos/plugins/kubernetes.py index 4c291f75..0e9a82af 100644 --- a/sos/plugins/kubernetes.py +++ b/sos/plugins/kubernetes.py @@ -176,7 +176,9 @@ class RedHatKubernetes(Kubernetes, RedHatPlugin): '/etc/origin/node/pods/master-config.yaml', ) - kube_cmd = "kubectl --kubeconfig=/etc/origin/master/admin.kubeconfig" + kube_cmd = "kubectl" + if path.exists('/etc/origin/master/admin.kubeconfig'): + kube_cmd += ' --kubeconfig=/etc/origin/master/admin.kubeconfig' class UbuntuKubernetes(Kubernetes, UbuntuPlugin): |