Skip to content

Commit eeca929

Browse files
authored
Merge pull request #32990 from bergerhoffer/declarative-contrib
Guidelines for adding declarative YAML examples to procedures
2 parents 9bf6d3d + b10040e commit eeca929

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
@@ -1062,6 +1062,7 @@ Note the following:
10621062
* To match the table cell's font size, start the ordered list with a `[.small]`
10631063
style and wrap it in a `--` block.
10641064

1065+
[id="collapsible-content"]
10651066
=== Collapsible content
10661067
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.
10671068

@@ -1262,6 +1263,74 @@ style guidelines. For example:
12621263
- Node Tuning Operator
12631264
- Cluster Version Operator
12641265

1266+
== Declarative config examples
1267+
1268+
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.
1269+
1270+
[IMPORTANT]
1271+
====
1272+
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.
1273+
====
1274+
1275+
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.
1276+
1277+
....
1278+
* Define a `ConfigMap` object containing the certificate authority by using the following command:
1279+
+
1280+
[source,terminal]
1281+
----
1282+
$ oc create configmap ca-config-map --from-file=ca.crt=/path/to/ca -n openshift-config
1283+
----
1284+
+
1285+
[TIP]
1286+
====
1287+
You can alternatively apply the following YAML to create the config map:
1288+
1289+
[source,yaml]
1290+
----
1291+
apiVersion: v1
1292+
kind: ConfigMap
1293+
metadata:
1294+
name: ca-config-map
1295+
namespace: openshift-config
1296+
type: Opaque
1297+
data:
1298+
ca.crt: <base64_encoded_CA_certificate_PEM>
1299+
----
1300+
====
1301+
....
1302+
1303+
This renders as:
1304+
1305+
> * Define a `ConfigMap` object containing the certificate authority by using the following command:
1306+
> +
1307+
> [source,terminal]
1308+
> ----
1309+
> $ oc create configmap ca-config-map --from-file=ca.crt=/path/to/ca -n openshift-config
1310+
> ----
1311+
> +
1312+
> [TIP]
1313+
> ====
1314+
> You can alternatively apply the following YAML to create the config map:
1315+
>
1316+
> [source,yaml]
1317+
> ----
1318+
> apiVersion: v1
1319+
> kind: ConfigMap
1320+
> metadata:
1321+
> name: ca-config-map
1322+
> namespace: openshift-config
1323+
> type: Opaque
1324+
> data:
1325+
> ca.crt: <base64_encoded_CA_certificate_PEM>
1326+
> ----
1327+
> ====
1328+
1329+
[NOTE]
1330+
====
1331+
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.
1332+
====
1333+
12651334
== Quick markup reference
12661335

12671336
|===

0 commit comments

Comments
 (0)