diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2019-04-01 15:31:20 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-05-21 16:25:50 +0100 |
commit | fc41da43106ba3d779a19cc910a2f430faf4a030 (patch) | |
tree | e49365ab3d96ee32decb5ca9763b70a794ed4911 | |
parent | b14f181e4c644cd859671cd49ac8c4c3cfb57a1f (diff) | |
download | sos-fc41da43106ba3d779a19cc910a2f430faf4a030.tar.gz |
[kubernetes] Write resource outputs to subdirs
Updates the plugin to write 'kubectl get' and 'kubectl describe' output
to a subdir named for each resource we iterate over. Additionally, logs
output (when using the podlogs option) will be written to the 'pods'
subdir.
Resolves: #1628
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/kubernetes.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sos/plugins/kubernetes.py b/sos/plugins/kubernetes.py index dc7ee278..e4e7c582 100644 --- a/sos/plugins/kubernetes.py +++ b/sos/plugins/kubernetes.py @@ -117,7 +117,7 @@ class kubernetes(Plugin, RedHatPlugin): self.add_cmd_output('%s events' % k_cmd) for res in resources: - self.add_cmd_output('%s %s' % (k_cmd, res)) + self.add_cmd_output('%s %s' % (k_cmd, res), subdir=res) if self.get_option('describe'): # need to drop json formatting for this @@ -131,7 +131,9 @@ class kubernetes(Plugin, RedHatPlugin): for k in k_list: k_cmd = '%s %s' % (kube_cmd, knsp) self.add_cmd_output( - '%s describe %s %s' % (k_cmd, res, k)) + '%s describe %s %s' % (k_cmd, res, k), + subdir=res + ) if self.get_option('podlogs'): k_cmd = '%s %s' % (kube_cmd, knsp) @@ -145,12 +147,13 @@ class kubernetes(Plugin, RedHatPlugin): for pod in pods: if reg and not re.match(reg, pod): continue - self.add_cmd_output('%s logs %s' % (k_cmd, pod)) + self.add_cmd_output('%s logs %s' % (k_cmd, pod), + subdir='pods') 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)) + self.add_cmd_output('%s %s' % (k_cmd, res), subdir=res) def postproc(self): # First, clear sensitive data from the json output collected. |