Skip to content

Commit 6a2e36b

Browse files
authored
Merge pull request #35700 from Sea-n/fix-json-highlight
Fix JSON syntax
2 parents 1a100a2 + 35700ba commit 6a2e36b

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

content/en/docs/concepts/overview/kubernetes-api.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,22 @@ for the kube-apiserver component.
9393
A discovery endpoint `/openapi/v3` is provided to see a list of all
9494
group/versions available. This endpoint only returns JSON. These group/versions
9595
are provided in the following format:
96-
```json
96+
97+
```yaml
9798
{
9899
"paths": {
99-
...
100+
...,
100101
"api/v1": {
101102
"serverRelativeURL": "/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF"
102103
},
103104
"apis/admissionregistration.k8s.io/v1": {
104105
"serverRelativeURL": "/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597"
105106
},
106-
...
107+
....
108+
}
107109
}
108110
```
111+
<!-- for editors: intionally use yaml instead of json here, to prevent syntax highlight error. -->
109112

110113
The relative URLs are pointing to immutable OpenAPI descriptions, in
111114
order to improve client-side caching. The proper HTTP caching headers

content/en/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,24 @@ struct has a `patchStrategy` of `merge`:
144144
type PodSpec struct {
145145
...
146146
Containers []Container `json:"containers" patchStrategy:"merge" patchMergeKey:"name" ...`
147+
...
148+
}
147149
```
148150

149151
You can also see the patch strategy in the
150152
[OpenApi spec](https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json):
151153

152-
```json
154+
```yaml
153155
"io.k8s.api.core.v1.PodSpec": {
154-
...
155-
"containers": {
156-
"description": "List of containers belonging to the pod. ...
157-
},
158-
"x-kubernetes-patch-merge-key": "name",
159-
"x-kubernetes-patch-strategy": "merge"
160-
},
156+
...,
157+
"containers": {
158+
"description": "List of containers belonging to the pod. ...."
159+
},
160+
"x-kubernetes-patch-merge-key": "name",
161+
"x-kubernetes-patch-strategy": "merge"
162+
}
161163
```
164+
<!-- for editors: intionally use yaml instead of json here, to prevent syntax highlight error. -->
162165

163166
And you can see the patch strategy in the
164167
[Kubernetes API documentation](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core).
@@ -204,6 +207,8 @@ strategic merge patch uses the default patch strategy, which is `replace`.
204207
type PodSpec struct {
205208
...
206209
Tolerations []Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`
210+
...
211+
}
207212
```
208213

209214
## Use a JSON merge patch to update a Deployment
@@ -365,19 +370,24 @@ type DeploymentSpec struct {
365370
...
366371
// +patchStrategy=retainKeys
367372
Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" ...`
373+
...
374+
}
368375
```
369376

370377
You can also see the `retainKeys` strategy in the [OpenApi spec](https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json):
371378

372-
```json
379+
```yaml
373380
"io.k8s.api.apps.v1.DeploymentSpec": {
374-
...
375-
"strategy": {
376-
"$ref": "#/definitions/io.k8s.api.apps.v1.DeploymentStrategy",
377-
"description": "The deployment strategy to use to replace existing pods with new ones.",
378-
"x-kubernetes-patch-strategy": "retainKeys"
379-
},
381+
...,
382+
"strategy": {
383+
"$ref": "#/definitions/io.k8s.api.apps.v1.DeploymentStrategy",
384+
"description": "The deployment strategy to use to replace existing pods with new ones.",
385+
"x-kubernetes-patch-strategy": "retainKeys"
386+
},
387+
....
388+
}
380389
```
390+
<!-- for editors: intionally use yaml instead of json here, to prevent syntax highlight error. -->
381391

382392
And you can see the `retainKeys` strategy in the
383393
[Kubernetes API documentation](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#deploymentspec-v1-apps).

0 commit comments

Comments
 (0)