diff options
author | Eric Desrochers <eric.desrochers@canonical.com> | 2019-04-18 15:15:17 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-09-24 15:16:58 +0100 |
commit | 71aaa6acbf5f40e617180273cc0fee94151d2efc (patch) | |
tree | a21d052fc2f5ce4f206bfc08c7976b1b1386b07f | |
parent | fc6e0db6423bdb66b143d4febdf3cfe789932670 (diff) | |
download | sos-71aaa6acbf5f40e617180273cc0fee94151d2efc.tar.gz |
[kubernetes] Enable Ubuntu kubectl cmd from any k8s nodes
Enable Ubuntu kubectl command, delivered as a SNAP,
on any k8s nodes using CDK installation.
CDK stands for Charmed Distribution of Kubernetes.
Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
-rw-r--r-- | sos/plugins/kubernetes.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sos/plugins/kubernetes.py b/sos/plugins/kubernetes.py index 6848c20e..a84a685b 100644 --- a/sos/plugins/kubernetes.py +++ b/sos/plugins/kubernetes.py @@ -9,14 +9,13 @@ # # See the LICENSE file in the source distribution for further information. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin from fnmatch import translate from os import path - import re -class kubernetes(Plugin, RedHatPlugin): +class kubernetes(Plugin, RedHatPlugin, UbuntuPlugin): """Kubernetes plugin """ @@ -29,7 +28,8 @@ class kubernetes(Plugin, RedHatPlugin): files = ( "/var/run/kubernetes/apiserver.key", "/etc/origin/master/", - "/etc/origin/node/pods/master-config.yaml" + "/etc/origin/node/pods/master-config.yaml", + "/root/cdk/kubeproxyconfig" ) option_list = [ @@ -71,10 +71,16 @@ class kubernetes(Plugin, RedHatPlugin): if not self.check_is_master(): return + # Red Hat kube_cmd = "kubectl " if path.exists('/etc/origin/master/admin.kubeconfig'): kube_cmd += "--kubeconfig=/etc/origin/master/admin.kubeconfig" + # Ubuntu Charmed Distribution of Kubernetes + if path.exists('/root/cdk/kubeproxyconfig'): + kube_cmd = "/snap/bin/kubectl " + kube_cmd += "--kubeconfig=/root/cdk/kubeproxyconfig" + kube_get_cmd = "get -o json " for subcmd in ['version', 'config view']: self.add_cmd_output('%s %s' % (kube_cmd, subcmd)) |