Skip to content

Commit b10040e

Browse files
committed
Guidelines for adding declarative YAML examples to procedures
1 parent e493961 commit b10040e

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

contributing_to_docs/doc_guidelines.adoc

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,7 @@ Note the following:
10291029
* To match the table cell's font size, start the ordered list with a `[.small]`
10301030
style and wrap it in a `--` block.
10311031

1032+
[id="collapsible-content"]
10321033
=== Collapsible content
10331034
You can collapse sections of content by using the `collapsible` option, which converts the Asciidoctor markup to HTML `details` and `summary` sections. The `collapsible` option is used at the writer's discretion and is appropriate for considerably long code blocks, lists, or other such content that significantly increases the length of a module or assembly.
10341035

@@ -1229,6 +1230,74 @@ style guidelines. For example:
12291230
- Node Tuning Operator
12301231
- Cluster Version Operator
12311232

1233+
== Declarative config examples
1234+
1235+
Many of our procedures provide imperative `oc` commands (which cannot be stored in a Git repo). Due to efforts around improving the experience for GitOps users, we sometimes also want to provide a declarative YAML example that achieves the same configuration. This allows users to store these YAML configurations in a Git repo and follow GitOps practices to configure OpenShift.
1236+
1237+
[IMPORTANT]
1238+
====
1239+
When adding declarative examples to procedures, do not completely replace the imperative command with the declarative YAML example. Some users might still prefer the imperative option.
1240+
====
1241+
1242+
To add a declarative YAML example to a procedure step with an existing imperative command, add it in a "TIP" admonition by following the template in the example below. This example uses an imperative command (`oc create configmap`) to create a config map, and then provides the declarative YAML example of the `ConfigMap` object afterward.
1243+
1244+
....
1245+
* Define a `ConfigMap` object containing the certificate authority by using the following command:
1246+
+
1247+
[source,terminal]
1248+
----
1249+
$ oc create configmap ca-config-map --from-file=ca.crt=/path/to/ca -n openshift-config
1250+
----
1251+
+
1252+
[TIP]
1253+
====
1254+
You can alternatively apply the following YAML to create the config map:
1255+
1256+
[source,yaml]
1257+
----
1258+
apiVersion: v1
1259+
kind: ConfigMap
1260+
metadata:
1261+
name: ca-config-map
1262+
namespace: openshift-config
1263+
type: Opaque
1264+
data:
1265+
ca.crt: <base64_encoded_CA_certificate_PEM>
1266+
----
1267+
====
1268+
....
1269+
1270+
This renders as:
1271+
1272+
> * Define a `ConfigMap` object containing the certificate authority by using the following command:
1273+
> +
1274+
> [source,terminal]
1275+
> ----
1276+
> $ oc create configmap ca-config-map --from-file=ca.crt=/path/to/ca -n openshift-config
1277+
> ----
1278+
> +
1279+
> [TIP]
1280+
> ====
1281+
> You can alternatively apply the following YAML to create the config map:
1282+
>
1283+
> [source,yaml]
1284+
> ----
1285+
> apiVersion: v1
1286+
> kind: ConfigMap
1287+
> metadata:
1288+
> name: ca-config-map
1289+
> namespace: openshift-config
1290+
> type: Opaque
1291+
> data:
1292+
> ca.crt: <base64_encoded_CA_certificate_PEM>
1293+
> ----
1294+
> ====
1295+
1296+
[NOTE]
1297+
====
1298+
If you are adding a particularly long YAML block, you can optionally use the xref:collapsible-content[`%collapsible`] feature to allow users to collapse the code block.
1299+
====
1300+
12321301
== Quick markup reference
12331302

12341303
|===

0 commit comments

Comments
 (0)