1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/log6x-oc-explain.adoc
libander f7f26dc60a xref fix
2024-09-24 21:20:30 +00:00

76 lines
2.6 KiB
Plaintext

// Module included in the following assemblies:
//
:_mod-docs-content-type: CONCEPT
[id="log6x-oc-explain_{context}"]
= Using the `oc explain` command
The `oc explain` command is an essential tool in the OpenShift CLI `oc` that provides detailed descriptions of the fields within Custom Resources (CRs). This command is invaluable for administrators and developers who are configuring or troubleshooting resources in an OpenShift cluster.
== Resource Descriptions
`oc explain` offers in-depth explanations of all fields associated with a specific object. This includes standard resources like pods and services, as well as more complex entities like statefulsets and custom resources defined by Operators.
To view the documentation for the `outputs` field of the `ClusterLogForwarder` custom resource, you can use:
[source,terminal]
----
$ oc explain clusterlogforwarders.observability.openshift.io.spec.outputs
----
[NOTE]
====
In place of `clusterlogforwarder` the short form `obsclf` can be used.
====
This will display detailed information about these fields, including their types, default values, and any associated sub-fields.
== Hierarchical Structure
The command displays the structure of resource fields in a hierarchical format, clarifying the relationships between different configuration options.
For instance, here's how you can drill down into the `storage` configuration for a `LokiStack` custom resource:
[source,terminal]
----
$ oc explain lokistacks.loki.grafana.com
$ oc explain lokistacks.loki.grafana.com.spec
$ oc explain lokistacks.loki.grafana.com.spec.storage
$ oc explain lokistacks.loki.grafana.com.spec.storage.schemas
----
Each command reveals a deeper level of the resource specification, making the structure clear.
== Type Information
`oc explain` also indicates the type of each field (such as string, integer, or boolean), allowing you to verify that resource definitions use the correct data types.
For example:
[source,terminal]
----
$ oc explain lokistacks.loki.grafana.com.spec.size
----
This will show that `size` should be defined using an integer value.
== Default Values
When applicable, the command shows the default values for fields, providing insights into what values will be used if none are explicitly specified.
Again using `lokistacks.loki.grafana.com` as an example:
[source,terminal]
----
$ oc explain lokistacks.spec.template.distributor.replicas
----
.Example output
[source,terminal]
----
GROUP: loki.grafana.com
KIND: LokiStack
VERSION: v1
FIELD: replicas <integer>
DESCRIPTION:
Replicas defines the number of replica pods of the component.
----