You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/contribute/style/style-guide.md
+45-19Lines changed: 45 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,17 +116,20 @@ The copy is called a "fork". | The copy is called a "fork."
116
116
117
117
## Inline code formatting
118
118
119
-
### Use code style for inline code, commands, and API objects {#code-style-inline-code}
119
+
### Use code style for inline code, commands {#code-style-inline-code}
120
120
121
121
For inline code in an HTML document, use the `<code>` tag. In a Markdown
122
-
document, use the backtick (`` ` ``).
122
+
document, use the backtick (`` ` ``). However, API kinds such as StatefulSet
123
+
or ConfigMap are written verbatim (no backticks); this allows using possessive
124
+
apostrophes.
123
125
124
126
{{< table caption = "Do and Don't - Use code style for inline code, commands, and API objects" >}}
125
127
Do | Don't
126
128
:--| :-----
127
-
The `kubectl run` command creates a `Pod`. | The "kubectl run" command creates a pod.
128
-
The kubelet on each node acquires a `Lease`… | The kubelet on each node acquires a lease…
129
-
A `PersistentVolume` represents durable storage… | A Persistent Volume represents durable storage…
129
+
The `kubectl run` command creates a Pod. | The "kubectl run" command creates a Pod.
130
+
The kubelet on each node acquires a Lease… | The kubelet on each node acquires a `Lease`…
131
+
A PersistentVolume represents durable storage… | A `PersistentVolume` represents durable storage…
132
+
The CustomResourceDefinition's `.spec.group` field… | The `CustomResourceDefinition.spec.group` field…
130
133
For declarative management, use `kubectl apply`. | For declarative management, use "kubectl apply".
131
134
Enclose code samples with triple backticks. (\`\`\`)| Enclose code samples with any other syntax.
132
135
Use single backticks to enclose inline code. For example, `var example = true`. | Use two asterisks (`**`) or an underscore (`_`) to enclose inline code. For example, **var example = true**.
@@ -191,37 +194,60 @@ Set the value of `image` to nginx:1.16. | Set the value of `image` to `nginx:1.1
191
194
Set the value of the `replicas` field to 2. | Set the value of the `replicas` field to `2`.
192
195
{{< /table >}}
193
196
197
+
However, consider quoting values where there is a risk that readers might confuse the value
198
+
with an API kind.
199
+
194
200
## Referring to Kubernetes API resources
195
201
196
202
This section talks about how we reference API resources in the documentation.
197
203
198
204
### Clarification about "resource"
199
205
200
-
Kubernetes uses the word "resource" to refer to API resources, such as `pod`,
201
-
`deployment`, and so on. We also use "resource" to talk about CPU and memory
202
-
requests and limits. Always refer to API resources as "API resources" to avoid
203
-
confusion with CPU and memory resources.
206
+
Kubernetes uses the word _resource_ to refer to API resources. For example,
207
+
the URL path `/apis/apps/v1/namespaces/default/deployments/my-app` represents a
208
+
Deployment named "my-app" in the "default"
209
+
{{< glossary_tooltip text="namespace" term_id="namespace" >}}. In HTTP jargon,
210
+
{{< glossary_tooltip text="namespace" term_id="namespace" >}} is a resource -
211
+
the same way that all web URLs identify a resource.
212
+
213
+
Kubernetes documentation also uses "resource" to talk about CPU and memory
214
+
requests and limits. It's very often a good idea to refer to API resources
215
+
as "API resources"; that helps to avoid confusion with CPU and memory resources,
216
+
or with other kinds of resource.
217
+
218
+
If you are using the lowercase plural form of a resource name, such as
219
+
`deployments` or `configmaps`, provide extra written context to help readers
220
+
understand what you mean. If you are using the term in a context where the
221
+
UpperCamelCase name could work too, and there is a risk of ambiguity,
222
+
consider using the API kind in UpperCamelCase.
204
223
205
224
### When to use Kubernetes API terminologies
206
225
207
226
The different Kubernetes API terminologies are:
208
227
209
-
- Resource type: the name used in the API URL (such as `pods`, `namespaces`)
210
-
- Resource: a single instance of a resource type (such as `pod`, `secret`)
211
-
- Object: a resource that serves as a "record of intent". An object is a desired
228
+
-_API kinds_: the name used in the API URL (such as `pods`, `namespaces`).
229
+
API kinds are sometimes also called _resource types_.
230
+
-_API resource_: a single instance of an API kind (such as `pod`, `secret`).
231
+
-_Object_: a resource that serves as a "record of intent". An object is a desired
212
232
state for a specific part of your cluster, which the Kubernetes control plane tries to maintain.
233
+
All objects in the Kubernetes API are also resources.
213
234
214
-
Always use "resource" or "object" when referring to an API resource in docs.
215
-
For example, use "a `Secret` object" over just "a `Secret`".
235
+
For clarity, you can add "resource" or "object" when referring to an API resource in Kubernetes
236
+
documentation.
237
+
An example: write "a Secret object" instead of "a Secret".
238
+
If it is clear just from the capitalization, you don't need to add the extra word.
239
+
240
+
Consider rephrasing when that change helps avoid misunderstandings. A common situation is
241
+
when you want to start a sentence with an API kind, such as “Secret”; because English
242
+
and other languages capitalize at the start of sentences, readers cannot tell whether you
243
+
mean the API kind or the general concept. Rewording can help.
216
244
217
245
### API resource names
218
246
219
247
Always format API resource names using [UpperCamelCase](https://en.wikipedia.org/wiki/Camel_case),
220
-
also known as PascalCase, and code formatting.
221
-
222
-
For inline code in an HTML document, use the `<code>` tag. In a Markdown document, use the backtick (`` ` ``).
248
+
also known as PascalCase. Do not write API kinds with code formatting.
223
249
224
-
Don't split an API object name into separate words. For example, use `PodTemplateList`, not Pod Template List.
250
+
Don't split an API object name into separate words. For example, use PodTemplateList, not Pod Template List.
225
251
226
252
For more information about PascalCase and code formatting, please review the related guidance on
227
253
[Use upper camel case for API objects](/docs/contribute/style/style-guide/#use-upper-camel-case-for-api-objects)
@@ -237,7 +263,7 @@ guidance on [Kubernetes API terminology](/docs/reference/using-api/api-concepts/
237
263
{{< table caption = "Do and Don't - Don't include the command prompt" >}}
0 commit comments