OpenShift Get commands

oc get command is from openshift used to list the usage info - e.g. pods info, dc info, services info, etc. This shared parser is used to parse oc get XX --all-namespaces -o yaml command information. Parameters “--all-namespaces” means collecting information from all projects and “-o yaml” means the output is in YAML format.

Parsers included in this module are:

OcGetBc - command oc get bc -o yaml --all-namespaces

OcGetBuild - command oc get build -o yaml --all-namespaces

OcGetDc - command oc get dc -o yaml --all-namespaces

OcGetEgressNetworkPolicy - command oc get egressnetworkpolicy -o yaml --all-namespaces

OcGetEndPoints - command oc get endpoints -o yaml --all-namespaces

OcGetEvent - command oc get event -o yaml --all-namespaces

OcGetNode - command oc get nodes -o yaml

OcGetPod - command oc get pod -o yaml --all-namespaces

OcGetProject - command oc get project -o yaml --all-namespaces

OcGetPv - command oc get pv -o yaml --all-namespaces

OcGetPvc - command oc get pvc -o yaml --all-namespaces

OcGetRc - command oc get rc -o yaml --all-namespaces

OcGetRole - command oc get role -o yaml --all-namespaces

OcGetRolebinding - command oc get rolebinding -o yaml --all-namespaces

OcGetRoute - command oc get route -o yaml --all-namespaces

OcGetService - command oc get service -o yaml --all-namespaces

OcGetConfigmap - command oc get configmap -o yaml --all-namespaces

Examples

>>> type(setting_dic)
<class 'insights.parsers.openshift_get.OcGetService'>
>>> setting_dic.data['items'][0]['kind']
'Service'
>>> setting_dic.data['items'][0]['spec']['clusterIP']
'172.30.0.1'
>>> setting_dic.data['items'][0]['metadata']['name']
'kubernetes'
>>> setting_dic.data['items'][1]['metadata']['name']
'router-1'
>>> "zjj" in setting_dic.data['items'][1]['metadata']['namespace']
True
class insights.parsers.openshift_get.OcGetBc(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get bc -o yaml --all-namespaces

build_configs

Returns a dictionary of openshift build configs information.

Type:dict
class insights.parsers.openshift_get.OcGetBuild(context)[source]

Bases: insights.core.YAMLParser

Class to parse oc get build -o yaml --all-namespaces

started_builds

Returns a dictionary of openshift started build information.

Type:dict
class insights.parsers.openshift_get.OcGetConfigmap(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get configmap -o yaml --all-namespaces

configmaps

Returns a dictionary of openshift configmaps information.

Type:dict
class insights.parsers.openshift_get.OcGetDc(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get dc -o yaml --all-namespaces

deployment_configs

Returns a dictionary of openshift deploymentconfigs information.

Type:dict
class insights.parsers.openshift_get.OcGetEgressNetworkPolicy(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get egressnetworkpolicy -o yaml --all-namespaces

egress_network_policies

Returns a dictionary of openshift egress network policy information.

Type:dict
class insights.parsers.openshift_get.OcGetEndPoints(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get endpoints -o yaml --all-namespaces

endpoints

Returns a dictionary of openshift endpoints information.

Type:dict
class insights.parsers.openshift_get.OcGetEvent(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get event -o yaml --all-namespaces

events

Returns a dictionary of openshift events information.

Type:dict
class insights.parsers.openshift_get.OcGetNode(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get nodes -o yaml

nodes

Returns a dictionary of openshift nodes information.

Type:dict
class insights.parsers.openshift_get.OcGetPod(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get pod -o yaml --all-namespaces

pods

Returns a dictionary of openshift pods information.

Type:dict
class insights.parsers.openshift_get.OcGetProject(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get project -o yaml --all-namespaces

projects

Returns a dictionary of openshift project information.

Type:dict
class insights.parsers.openshift_get.OcGetPv(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get pv -o yaml --all-namespaces

persistent_volumes

Returns a dictionary of openshift persistent volume information.

Type:dict
class insights.parsers.openshift_get.OcGetPvc(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get pvc -o yaml --all-namespaces

persistent_volume_claims

Returns a dictionary of openshift persistent volume claim information.

Type:dict
class insights.parsers.openshift_get.OcGetRc(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get rc -o yaml --all-namespaces

replication_controllers

Returns a dictionary of openshift replication controllers information.

Type:dict
class insights.parsers.openshift_get.OcGetRole(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get role -o yaml --all-namespaces

roles

Returns a dictionary of openshift role information.

Type:dict
class insights.parsers.openshift_get.OcGetRolebinding(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get rolebinding -o yaml --all-namespaces

rolebindings

Returns a dictionary of openshift rolebind information.

Type:dict
class insights.parsers.openshift_get.OcGetRoute(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get route -o yaml --all-namespaces

routes

Returns a dictionary of openshift route information.

Type:dict
class insights.parsers.openshift_get.OcGetService(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.YAMLParser

Class to parse oc get service -o yaml --all-namespaces

services

Returns a dictionary of openshift services information.

Type:dict