diff options
author | Vladislav Walek <22072258+vwalek@users.noreply.github.com> | 2021-09-23 11:03:35 -0700 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2021-09-24 13:41:03 -0400 |
commit | e76c69264908aea96df30be134e0f5afa64bd1ea (patch) | |
tree | 30fbadbfbac42c338267b2d5c796f2db47f16e0a | |
parent | 13ce81156970034375e3a6985a7c147e281486f3 (diff) | |
download | sos-e76c69264908aea96df30be134e0f5afa64bd1ea.tar.gz |
[origin] Removing unused configuration
Removed the diagnostics part as it is no longer maintained and doesn't
work on Openshift.
Adding additional projects to collect.
Removed getting all namespaces as it is not needed for troubleshooting
and project names are sensitive for some customers.
Adding condition to collect the logs from systemd openshift services if
not running as static pods.
Signed-off-by: Vladislav Walek <22072258+vwalek@users.noreply.github.com>
-rw-r--r-- | sos/report/plugins/origin.py | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/sos/report/plugins/origin.py b/sos/report/plugins/origin.py index 0b92fa0f..f9cc32c1 100644 --- a/sos/report/plugins/origin.py +++ b/sos/report/plugins/origin.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt +from sos.report.plugins import Plugin, RedHatPlugin import os.path # This plugin collects static configuration and runtime information @@ -40,15 +40,6 @@ class OpenShiftOrigin(Plugin): files = None # file lists assigned after path setup below profiles = ('openshift',) - option_list = [ - PluginOpt('diag', default=True, - desc='Collect oc adm diagnostics output'), - PluginOpt('diag-prevent', default=True, - desc='Use --prevent-modification with oc adm diagnostics'), - PluginOpt('all-namespaces', default=False, - desc='collect dc output for all namespaces') - ] - master_base_dir = "/etc/origin/master" node_base_dir = "/etc/origin/node" master_cfg = os.path.join(master_base_dir, "master-config.yaml") @@ -111,6 +102,9 @@ class OpenShiftOrigin(Plugin): "%s controllers controllers" % static_pod_logs_cmd, ]) + if self.is_static_etcd(): + self.add_cmd_output("%s etcd etcd" % static_pod_logs_cmd) + # TODO: some thoughts about information that might also be useful # to collect. However, these are maybe not needed in general # and/or present some challenges (scale, sensitive, ...) and need @@ -129,9 +123,9 @@ class OpenShiftOrigin(Plugin): # is already collected by the Kubernetes plugin subcmds = [ - "describe projects", "adm top images", - "adm top imagestreams" + "adm top imagestreams", + "adm top nodes" ] self.add_cmd_output([ @@ -148,29 +142,23 @@ class OpenShiftOrigin(Plugin): '%s get -o json %s' % (oc_cmd_admin, jcmd) for jcmd in jcmds ]) - if self.get_option('all-namespaces'): - ocn = self.exec_cmd('%s get namespaces' % oc_cmd_admin) - ns_output = ocn['output'].splitlines()[1:] - nmsps = [n.split()[0] for n in ns_output if n] - else: - nmsps = [ - 'default', - 'openshift-web-console', - 'openshift-ansible-service-broker' - ] + nmsps = [ + 'default', + 'openshift-web-console', + 'openshift-ansible-service-broker', + 'openshift-sdn', + 'openshift-console' + ] self.add_cmd_output([ - '%s get -o json dc -n %s' % (oc_cmd_admin, n) for n in nmsps + '%s get -o json deploymentconfig,deployment,daemonsets -n %s' + % (oc_cmd_admin, n) for n in nmsps ]) - if self.get_option('diag'): - diag_cmd = "%s adm diagnostics -l 0" % oc_cmd_admin - if self.get_option('diag-prevent'): - diag_cmd += " --prevent-modification=true" - self.add_cmd_output(diag_cmd) - self.add_journal(units=["atomic-openshift-master", - "atomic-openshift-master-api", - "atomic-openshift-master-controllers"]) + if not self.is_static_pod_compatible(): + self.add_journal(units=["atomic-openshift-master", + "atomic-openshift-master-api", + "atomic-openshift-master-controllers"]) # get logs from the infrastruture pods running in the default ns pods = self.exec_cmd("%s get pod -o name -n default" @@ -196,9 +184,6 @@ class OpenShiftOrigin(Plugin): self.add_journal(units="atomic-openshift-node") - if self.is_static_etcd(): - self.add_cmd_output("%s etcd etcd" % static_pod_logs_cmd) - def postproc(self): # Clear env values from objects that can contain sensitive data # Sample JSON content: |