OpenShift Get commands with configuration file

The commands set is similar to the oc get commands. It is used to display openshift resources. It uses the master configuration file rather than the default configuration when communicated with the client API. It makes sure this command will only be executed on the master node of an OpenShift cluster. This command will also not include the commands which display large size outputs.

Parsers included in this module are:

OcGetClusterRoleWithConfig - command oc get clusterrole --config /etc/origin/master/admin.kubeconfig

OcGetClusterRoleBindingWithConfig - command oc get clusterrolebinding --config /etc/origin/master/admin.kubeconfig

class insights.parsers.openshift_get_with_config.OcGetClusterRoleBindingWithConfig(context, extra_bad_lines=None)[source]

Bases: CommandParser

Class to parse oc get clusterrolebinding --config /etc/origin/master/admin.kubeconfig

data

List of dicts, each dict containing one row of the table

Type:

list

rolebinding

It is a dictionary in which the key is rolebinding name and the value is the role.

Type:

dict

A typical sample of the content of this file looks like:

NAME                                                                  ROLE                                                                   USERS                            GROUPS                                         SERVICE ACCOUNTS                                                                   SUBJECTS
admin                                                                 /admin                                                                                                                                                 openshift-infra/template-instance-controller
admin-0                                                               /admin                                                                                                                                                 kube-service-catalog/default
admin-1                                                               /admin                                                                                                                                                 openshift-ansible-service-broker/asb
asb-access                                                            /asb-access                                                                                                                                            openshift-ansible-service-broker/asb-client
asb-auth                                                              /asb-auth                                                                                                                                              openshift-ansible-service-broker/asb
auth-delegator-openshift-template-service-broker                      /system:auth-delegator                                                                                                                                 openshift-template-service-broker/apiserver
basic-users                                                           /basic-user                                                                                             system:authenticated
cluster-admin                                                         /cluster-admin                                                                                          system:masters
cluster-admin-0                                                       /cluster-admin                                                                                                                                         insights-scan/insights-scan

Examples

>>> type(oc_get_clusterrolebinding_with_config)
<class 'insights.parsers.openshift_get_with_config.OcGetClusterRoleBindingWithConfig'>
>>> oc_get_clusterrolebinding_with_config.rolebinding["admin"]
'/admin'
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.openshift_get_with_config.OcGetClusterRoleWithConfig(context, extra_bad_lines=None)[source]

Bases: CommandParser

Class to parse oc get clusterrole --config /etc/origin/master/admin.kubeconfig

A typical sample of the content of this file looks like:

NAME
admin
asb-access
asb-auth
basic-user
cluster-admin
cluster-debugger
cluster-reader
cluster-status
edit
hawkular-metrics-admin
management-infra-admin
namespace-viewer
registry-admin

Examples

>>> type(oc_get_cluster_role_with_config)
<class 'insights.parsers.openshift_get_with_config.OcGetClusterRoleWithConfig'>
>>> oc_get_cluster_role_with_config[0]
'admin'
parse_content(content)[source]

This method must be implemented by classes based on this class.