aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-01-28 16:52:41 -0500
committerJake Hunsaker <jhunsake@redhat.com>2020-01-29 17:19:43 -0500
commit0a9b312d346fcdf07cbacdcca7b540248e7a54f6 (patch)
tree024b22855d46b6a85230cda8a535491c02eb65e2
parent6cb4ee3bf35c5d0af42d50887b126d041bb73a20 (diff)
downloadsos-0a9b312d346fcdf07cbacdcca7b540248e7a54f6.tar.gz
[kubernetes|RedHat] Use `oc` command when running on OCP
If sos is run on a RHEL OpenShift node, use the `oc` command directly instead of pointing `kubectl` at the origin config file. This allows sos to not need to account for any other differences the `oc` binary might implement when wrapping `kubectl`, which in turn could potentially lead to a difference between what an end-user troubleshooting OCP may see and what a support engineer looking through an sosreport may see. Resolves: #1928 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/plugins/kubernetes.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sos/plugins/kubernetes.py b/sos/plugins/kubernetes.py
index 1a97de9d..8fc0eba4 100644
--- a/sos/plugins/kubernetes.py
+++ b/sos/plugins/kubernetes.py
@@ -188,8 +188,11 @@ class RedHatKubernetes(Kubernetes, RedHatPlugin):
)
kube_cmd = "kubectl"
+ # Rather than loading the config file, use the OCP command directly that
+ # wraps kubectl, so we don't have to manually account for any other changes
+ # the `oc` binary may implement
if path.exists('/etc/origin/master/admin.kubeconfig'):
- kube_cmd += ' --kubeconfig=/etc/origin/master/admin.kubeconfig'
+ kube_cmd = 'oc'
class UbuntuKubernetes(Kubernetes, UbuntuPlugin):