aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2019-03-22 17:42:20 -0400
committerBryn M. Reeves <bmr@redhat.com>2019-03-25 15:12:49 +0000
commit295c702c730405c4bf6d6b7223f45d8790f0aca9 (patch)
tree58325ffa3034aae7e0059a57be9cebd2a15388d0
parentb47787fcd9e811175f939a26e4e547c2d9865015 (diff)
downloadsos-295c702c730405c4bf6d6b7223f45d8790f0aca9.tar.gz
[kubernetes] Split out non-namespaced resources
Removes non-namespaced resources from being iterated over by the namespace-sensitive loops such as describe. Resolves: #1618 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/kubernetes.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/sos/plugins/kubernetes.py b/sos/plugins/kubernetes.py
index 8045fe81..4ae51162 100644
--- a/sos/plugins/kubernetes.py
+++ b/sos/plugins/kubernetes.py
@@ -77,11 +77,8 @@ class kubernetes(Plugin, RedHatPlugin):
'deployments',
'ingresses',
'limitranges',
- 'namespaces',
'pods',
'policies',
- 'projects',
- 'pv',
'pvc',
'rc',
'resourcequotas',
@@ -89,13 +86,18 @@ class kubernetes(Plugin, RedHatPlugin):
'services'
]
- # nodes and pvs are not namespaced, must pull separately.
- # Also collect master metrics
+ # these are not namespaced, must pull separately.
+ global_resources = [
+ 'namespaces',
+ 'nodes',
+ 'projects',
+ 'pvs'
+ ]
self.add_cmd_output([
- "{} get -o json nodes".format(kube_cmd),
- "{} get -o json pv".format(kube_cmd),
- "{} get --raw /metrics".format(kube_cmd)
+ "%s get %s" % (kube_cmd, res) for res in global_resources
])
+ # Also collect master metrics
+ self.add_cmd_output("%s get --raw /metrics" % kube_cmd)
# CNV is not part of the base installation, but can be added
if self.is_installed('kubevirt-virtctl'):