id8ddlmZmZmZddlZGddeeZy))Plugin RedHatPlugin PluginOptNceZdZdZdZdZdZdZedddfZefZ dZ e d e e d e d d e d e dd e d gZ dZdZdZdZdZy) Microshifta:This is the plugin for MicroShift 4.X. Even though it shares some of the OpenShift components, its IoT/Edge target makes the product nimble and light, thus requiring different a approach when operating it. When enabled, this plugin will collect cluster information (such as systemd service logs, configuration, versions, etc.)and also inspect API resources in certain namespaces. The namespaces to scan are kube.* and openshift.*. Other namespaces may be collected by making use of the ``only-namespaces`` or ``add-namespaces`` options. microshifti)rzmicroshift-selinuxzmicroshift-networkingzmicroshift-greenbootzgreenboot-healthcheckzgreenboot-task-runnerzredboot-task-runnerz2/var/lib/microshift/resources/kubeadmin/kubeconfig kubeconfigz+Path to a locally available kubeconfig file)defaultval_typedesconly-namespacesz2colon-delimited list of namespaces to collect fromadd-namespaceszHcolon-delimited list of namespaces to add to the default collection listc*|jdr.|jdjdDcgc]}|c}Sddg}|jdr9|jdjdD]}|jd|z|Scc}w)zCombine a set of regexes for collection with any namespaces passed to sos via the -k openshift.add-namespaces option. Note that this does allow for end users to specify namespace regexes of their own. r :z^openshift\-.+$z ^kube\-.+$rz^%s$) get_optionsplitappend)selfncollect_regexesnsps ?/usr/lib/python3/dist-packages/sos/report/plugins/microshift.py_setup_namespace_regexesz#Microshift._setup_namespace_regexes.s ??, -#/@AGGLM!AM M    ??+ ,'78>>sC 6&&w}5 6Ns Bc fd}j_tt|Dcgc] }||s |c}Scc}w)aReduce the namespace listing returned to just the ones we want to collect from. By default, as requested by OCP support personnel, this must include all 'openshift' prefixed namespaces :param nsps list: Namespace names from oc output cXjD]}tj||syy)zMatch a particular namespace for inclusion (or not) in the collection phases :param namespace str: The name of a namespace TF)rrematch) namespaceregexrs r_match_namespacez;Microshift._reduce_namespace_list.._match_namespaceIs0-- 88E9- )rrlistset)rnspsr!rs` r_reduce_namespace_listz!Microshift._reduce_namespace_listAsA  $<<>CD@q, ?@ x=A ..s8}/B/B4/HI I r"cgd}g}|D]R}|jd|jdd|tj}|ddk(sB|j |T|S)z@Get cluster-level (non-namespaced) resources to collect ) apiservicescertificatesigningrequestsclusterrolebindings clusterrolescomponentstatuses csidriverscsinodescustomresourcedefinitions flowschemasingressclasseslogicalvolumesmutatingwebhookconfigurationsnodespersistentvolumespriorityclassesprioritylevelconfigurationsrangeallocationsruntimeclassessecuritycontextconstraintsselfsubjectaccessreviewsselfsubjectrulesreviewsstorageclassessubjectaccessreviews tokenreviewsvalidatingwebhookconfigurationsvolumeattachmentszoc get --kubeconfig r  )timeoutr(r)r+rrplugin_timeoutr)rglobal_resources_filtered_resourcesresourcer,s r_get_cluster_resourcesz!Microshift._get_cluster_resourcescst :!( 5H--OOL18="11 3C8}!#**84  5#"r"cL|jdr|jddg|jddgdj|j }dj|j Dcgc]}d|z c}}|j tjrz|jd }|jd }|jd |d |d|dtj|jd |d |d|dtjyycc}w)aThe setup() phase of this plugin will first gather system information and then iterate through all default namespaces, and/or those specified via the `add-namespaces` and `only-namespaces` plugin options. Both of these options accept shell-style regexes. Output format for this function is based on `oc adm inspect` command, which is used to retrieve all API resources from the cluster. z/var/lib/microshift-backupsz%/var/lib/microshift-backups/*/versionz"/var/lib/microshift-backups/*.jsonzmicroshift versionz#microshift show-config -m effective,rIzns/%sF)maker zoc adm inspect --kubeconfig z --dest-dir zinspect_cluster_resources.log)suggest_filenamerJzinspect_namespaces.logN) path_exists add_copy_specadd_cmd_outputjoinrOr-is_service_runningr plugin_nameget_cmd_output_pathrrK)r_cluster_resources_to_collectr_namespaces_to_collect_subdir _kubeconfigs rsetupzMicroshift.setups-   9 :    G D F G  1  ),  ' ' ))+%!$"&"6"6"8 9QWq[ 9";  " ":#9#9 :..E.:G//,7K   *GI!@"11  3   *@B!9"11  3 ; :s4 D!N)__name__ __module__ __qualname____doc__ short_descrYrKpackagesservicesprofileslocalhost_kubeconfigrstr option_listrr&r-rOr_r"rrrs JKN(H4')>@H~HO ,(rms ?> c3c3r"