uec@sddlmZmZmZddlmZddlmZddlZdefdYZ de efdYZ d e efd YZ dS( i(tPlugint RedHatPlugint UbuntuPlugin(t translate(tpathNt KubernetescBsqeZdZdZdZdddefdddefd d defdgZdZdZdZ dZ RS(sKubernetes plugin t kubernetest containertalls-also collect all namespaces output separatelytslowtdescribes*capture descriptions of all kube resourcestfasttpodlogsscapture logs for podsspodlogs-filters/only capture logs for pods matching this stringttkubectlcCs)tg|jD]}tj|^q S(N(tanytfilesRtexists(tselftf((s:/usr/lib/python2.7/site-packages/sos/plugins/kubernetes.pytcheck_is_master%sc Cs|jd|jd|jddddgddd d d g}x|D]}|jd |qOW|jsydSd }x.ddgD] }|jd|j|fqW|jd|j}|djd}g|D].}|rt|j r|j d^q}ddddddddddg } dd d!g} |jg| D]} d"|j| f^qU|jd#|j} | d$dkrxa| djdD]H} | j }|sqn|d}|jd%|j|fd&d'qWn|jd(|j|j d)rE| j d*d+g|jd,nxI|D]A}d-|}|j d.rd/|j||f}|jd0|x.| D]#} |jd|| fd&| qWn|j d1rd|j|f}x| D]} |j d"|| f}|d$dkrg|djdD]}|j d^q0}xD|D]9}d|j|f}|jd2|| |fd&| qSWqqWn|j d3rLd|j|f}|j d4|}|d$dkrg|djdD]}|j d^q}|j d5r4t|j d5nd}xM|D]B}|rftj|| rfqAn|jd6||fd&dqAWqqLqLW|j d.sd7|j}x.| D]#} |jd|| fd&| qWndS(8Ns/etc/kubernetess /run/flannelt KUBECONFIGtKUBERNETES_HTTP_PROXYtKUBERNETES_HTTPS_PROXYtKUBERNETES_NO_PROXYtkubeletskube-apiservers kube-proxyskube-schedulerskube-controller-managertunitss get -o json tversions config views%s %ss%s get namespacestoutputiit deploymentst ingressest limitrangestpodstpoliciestpvctrctresourcequotastroutestservicest namespacestprojectstpvss %s get %ss %s get nodeststatuss%s describe node %stsubdirtnodess%s get --raw /metricsskubevirt-virtctltvmstvmissvirtctl versions--namespace=%sRs%s %s %ss %s eventsR s%s describe %s %sR s %s get podsspodlogs-filters %s logs %ss%s get --all-namespaces=true(t add_copy_spect add_env_vart add_journalRtadd_cmd_outputtkube_cmdtcollect_cmd_outputt splitlinestlentsplitt is_installedtextendt get_optiontexec_cmdRtNonetretmatch(Rtsvcstsvct kube_get_cmdtsubcmdtknt kn_outputtntknspst resourcestglobal_resourcestresR,tlinetwordstnodetknsptk_cmdtrtktk_listtpR tregtpod((s:/usr/lib/python2.7/site-packages/sos/plugins/kubernetes.pytsetup(s      ;  '     $ . .*   cCs*d}|jd|d|jddS(NsX(?P{\s*"name":\s*[^,]*(pass|pwd|key|token|cred|PASS|PWD|KEY)[^,]*,\s*"value":)[^}]*Rs\g "********"(tdo_cmd_output_subtdo_cmd_private_sub(Rt env_regexp((s:/usr/lib/python2.7/site-packages/sos/plugins/kubernetes.pytpostprocs (R(spodlogs-filters/only capture logs for pods matching this stringR R ( t__name__t __module__t__doc__t plugin_nametprofilestFalset option_listR3RRURY(((s:/usr/lib/python2.7/site-packages/sos/plugins/kubernetes.pyRs     ~tRedHatKubernetescBs8eZdZdZd ZdZejdr6dZnRS( sRed Hat Kubernetes plugin Rskubernetes-mastersatomic-openshift-masters#/etc/origin/master/admin.kubeconfigs(/etc/origin/node/pods/master-config.yamlRtoc(s kubernetesskubernetes-mastersatomic-openshift-master(s#/etc/origin/master/admin.kubeconfigs(/etc/origin/node/pods/master-config.yaml(RZR[R\tpackagesRR3RR(((s:/usr/lib/python2.7/site-packages/sos/plugins/kubernetes.pyRastUbuntuKubernetescBs eZdZdZdZdZRS(sUbuntu Kubernetes plugin Rs/root/cdk/kubeproxyconfigs.kubectl --kubeconfig=/root/cdk/kubeproxyconfig(s kubernetes(s/root/cdk/kubeproxyconfig(RZR[R\RcRR3(((s:/usr/lib/python2.7/site-packages/sos/plugins/kubernetes.pyRds( t sos.pluginsRRRtfnmatchRtosRR=RRaRd(((s:/usr/lib/python2.7/site-packages/sos/plugins/kubernetes.pyt s