aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/kubernetes.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/sos/plugins/kubernetes.py b/sos/plugins/kubernetes.py
index 1010354c..252cdd74 100644
--- a/sos/plugins/kubernetes.py
+++ b/sos/plugins/kubernetes.py
@@ -90,9 +90,10 @@ class kubernetes(Plugin, RedHatPlugin):
"{} get -o json pv".format(kube_cmd),
"{} get --raw /metrics".format(kube_cmd)
])
- if self.get_option('all'):
- for n in knsps:
- knsp = '--namespace=%s' % n
+
+ for n in knsps:
+ knsp = '--namespace=%s' % n
+ if self.get_option('all'):
k_cmd = '%s %s %s' % (kube_cmd, kube_get_cmd, knsp)
self.add_cmd_output('%s events' % k_cmd)
@@ -115,7 +116,7 @@ class kubernetes(Plugin, RedHatPlugin):
'%s describe %s %s' % (k_cmd, res, k))
if self.get_option('podlogs'):
- k_cmd = '%s get %s' % (kube_cmd, knsp)
+ k_cmd = '%s %s' % (kube_cmd, knsp)
r = self.get_command_output('%s get pods' % k_cmd)
if r['status'] == 0:
pods = [p.split()[0] for p in
@@ -123,9 +124,10 @@ class kubernetes(Plugin, RedHatPlugin):
for pod in pods:
self.add_cmd_output('%s logs %s' % (k_cmd, pod))
- k_cmd = '%s get --all-namespaces=true' % kube_cmd
- for res in resources:
- self.add_cmd_output('%s %s' % (k_cmd, res))
+ if not self.get_option('all'):
+ k_cmd = '%s get --all-namespaces=true' % kube_cmd
+ for res in resources:
+ self.add_cmd_output('%s %s' % (k_cmd, res))
def postproc(self):
# First, clear sensitive data from the json output collected.