@@ -21,19 +21,21 @@ using the [kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/re
21
21
If you find bugs in the generated documentation, you need to
22
22
[fix them upstream](/docs/contribute/generate-ref-docs/contribute-upstream/).
23
23
24
- If you need only to regenerate the reference documentation from the [OpenAPI](https://github.com/OAI/OpenAPI-Specification)
24
+ If you need only to regenerate the reference documentation from the
25
+ [OpenAPI](https://github.com/OAI/OpenAPI-Specification)
25
26
spec, continue reading this page.
26
27
-->
27
28
本页面显示了如何更新 Kubernetes API 参考文档。
28
29
29
30
Kubernetes API 参考文档是从
30
- [ Kubernetes OpenAPI 规范] ( https://github.com/kubernetes/kubernetes/blob/master/api/openapi-spec/swagger.json )
31
- 构建的,
32
- 且使用 [ kubernetes-sigs/reference-docs ] ( https://github.com/kubernetes-sigs/reference-docs ) 生成代码。
31
+ [ Kubernetes OpenAPI 规范] ( https://github.com/kubernetes/kubernetes/blob/master/api/openapi-spec/swagger.json ) 构建的,
32
+ 且使用 [ kubernetes-sigs/reference-docs ] ( https://github.com/kubernetes-sigs/reference-docs )
33
+ 生成代码。
33
34
34
35
如果你在生成的文档中发现错误,则需要[ 在上游修复] ( /zh-cn/docs/contribute/generate-ref-docs/contribute-upstream/ ) 。
35
36
36
- 如果你只需要从 [ OpenAPI] ( https://github.com/OAI/OpenAPI-Specification ) 规范中重新生成参考文档,请继续阅读此页。
37
+ 如果你只需要从 [ OpenAPI] ( https://github.com/OAI/OpenAPI-Specification )
38
+ 规范中重新生成参考文档,请继续阅读此页。
37
39
38
40
## {{% heading "prerequisites" %}}
39
41
@@ -42,13 +44,13 @@ Kubernetes API 参考文档是从
42
44
<!-- steps -->
43
45
44
46
<!--
45
- ## Setting up the local repositories
47
+ ## Set up the local repositories
46
48
47
- Create a local workspace and set your `GOPATH`.
49
+ Create a local workspace and set your `GOPATH`:
48
50
-->
49
51
## 配置本地仓库
50
52
51
- 创建本地工作区并设置你的 ` GOPATH ` 。
53
+ 创建本地工作区并设置你的 ` GOPATH ` :
52
54
53
55
``` shell
54
56
mkdir -p $HOME /< workspace>
@@ -87,30 +89,30 @@ git clone https://github.com/kubernetes/kubernetes $GOPATH/src/k8s.io/kubernetes
87
89
88
90
<!--
89
91
* The base directory of your clone of the
90
- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository is
91
- `$GOPATH/src/k8s.io/kubernetes.`
92
- The remaining steps refer to your base directory as `<k8s-base>`.
92
+ [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository is
93
+ `$GOPATH/src/k8s.io/kubernetes.`
94
+ The remaining steps refer to your base directory as `<k8s-base>`.
93
95
94
96
* The base directory of your clone of the
95
- [kubernetes/website](https://github.com/kubernetes/website) repository is
96
- `$GOPATH/src/github.com/<your username>/website.`
97
- The remaining steps refer to your base directory as `<web-base>`.
97
+ [kubernetes/website](https://github.com/kubernetes/website) repository is
98
+ `$GOPATH/src/github.com/<your username>/website.`
99
+ The remaining steps refer to your base directory as `<web-base>`.
98
100
99
101
* The base directory of your clone of the
100
- [kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs)
101
- repository is `$GOPATH/src/github.com/kubernetes-sigs/reference-docs.`
102
- The remaining steps refer to your base directory as `<rdocs-base>`.
102
+ [kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs)
103
+ repository is `$GOPATH/src/github.com/kubernetes-sigs/reference-docs`.
104
+ The remaining steps refer to your base directory as `<rdocs-base>`.
103
105
-->
104
106
* [ kubernetes/kubernetes] ( https://github.com/kubernetes/kubernetes ) 仓库克隆后的根目录为
105
107
` $GOPATH/src/k8s.io/kubernetes ` 。 后续步骤将此目录称为 ` <k8s-base> ` 。
106
108
* [ kubernetes/website] ( https://github.com/kubernetes/website ) 仓库克隆后的根目录为
107
109
` $GOPATH/src/github.com/<your username>/website ` 。后续步骤将此目录称为 ` <web-base> ` 。
108
110
* [ kubernetes-sigs/reference-docs] ( https://github.com/kubernetes-sigs/reference-docs )
109
- 仓库克隆后的基本目录为 ` $GOPATH/src/github.com/kubernetes-sigs/reference-docs. ` 。
111
+ 仓库克隆后的基本目录为 ` $GOPATH/src/github.com/kubernetes-sigs/reference-docs ` 。
110
112
后续步骤将此目录称为 ` <rdocs-base> ` 。
111
113
112
114
<!--
113
- ## Generating the API reference docs
115
+ ## Generate the API reference docs
114
116
115
117
This section shows how to generate the
116
118
[published Kubernetes API reference documentation](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/).
@@ -120,20 +122,22 @@ This section shows how to generate the
120
122
本节说明如何生成[ 已发布的 Kubernetes API 参考文档] (/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)。
121
123
122
124
<!--
123
- ### Setting build variables
125
+ ### Set build variables
124
126
125
127
Go to `<rdocs-base>`, and open the `Makefile` for editing:
126
128
-->
127
- ### 设置构建变量 {#setting-build-variables}
129
+ ### 设置构建变量 {#set-build-variables}
130
+
131
+ 进入 ` <rdocs-base> ` 目录,然后打开 ` Makefile ` 文件进行编辑:
128
132
129
133
<!--
130
134
* Set `K8S_ROOT` to `<k8s-base>`.
131
135
* Set `K8S_WEBROOT` to `<web-base>`.
132
136
* Set `K8S_RELEASE` to the version of the docs you want to build.
133
137
For example, if you want to build docs for Kubernetes 1.17.0, set `K8S_RELEASE` to 1.17.0.
134
138
-->
135
- * 设置 ` K8S_ROOT ` 为 ` <k8s-base> ` .
136
- * 设置 ` K8S_WEBROOT ` 为 ` <web-base> ` .
139
+ * 设置 ` K8S_ROOT ` 为 ` <k8s-base> ` 。
140
+ * 设置 ` K8S_WEBROOT ` 为 ` <web-base> ` 。
137
141
* 设置 ` K8S_RELEASE ` 为要构建的文档的版本。
138
142
例如,如果你想为 Kubernetes 1.17.0 构建文档,请将 ` K8S_RELEASE ` 设置为 1.17.0。
139
143
@@ -149,9 +153,9 @@ export K8S_RELEASE=1.17.0
149
153
```
150
154
151
155
<!--
152
- ### Creating versioned directory and fetching Open API spec
156
+ ### Create versioned directory and fetch Open API spec
153
157
154
- The `updateapispec` build target creates the versioned build directory.
158
+ The `updateapispec` build target creates the versioned build directory.
155
159
After the directory is created, the Open API spec is fetched from the
156
160
`<k8s-base>` repository. These steps ensure that the version
157
161
of the configuration files and Kubernetes Open API spec match the release version.
@@ -167,20 +171,19 @@ The versioned directory name follows the pattern of `v<major>_<minor>`.
167
171
<!--
168
172
In the `<rdocs-base>` directory, run the following build target:
169
173
-->
170
- 在 ` <rdocs-base> ` 目录中,运行以下命令来构建:
174
+ 在 ` <rdocs-base> ` 目录中,运行以下命令来构建:
171
175
172
176
``` shell
173
177
cd < rdocs-base>
174
178
make updateapispec
175
179
```
176
180
177
181
<!--
178
- ### Building the API reference docs
182
+ ### Build the API reference docs
179
183
180
184
The `copyapi` target builds the API reference and
181
185
copies the generated files to directories in `<web-base>`.
182
186
Run the following command in `<rdocs-base>`:
183
-
184
187
-->
185
188
### 构建 API 参考文档
186
189
@@ -236,7 +239,7 @@ static/docs/reference/generated/kubernetes-api/{{< param "version" >}}/js/scroll
236
239
```
237
240
238
241
<!--
239
- ## Updating the API reference index pages
242
+ ## Update the API reference index pages
240
243
241
244
When generating reference documentation for a new release, update the file,
242
245
`<web-base>/content/en/docs/reference/kubernetes-api/api-index.md` with the new
@@ -251,25 +254,26 @@ version number.
251
254
* Open `<web-base>/content/en/docs/reference/kubernetes-api/api-index.md` for editing,
252
255
and update the API reference version number. For example:
253
256
254
- ```
255
- title: v1.17
256
- [Kubernetes API v1.17](/docs/reference/generated/kubernetes-api/v1.17/)
257
- ```
257
+ ```
258
+ title: v1.17
259
+ [Kubernetes API v1.17](/docs/reference/generated/kubernetes-api/v1.17/)
260
+ ```
258
261
-->
259
262
* 打开并编辑 ` <web-base>/content/en/docs/reference/kubernetes-api/api-index.md ` ,
260
263
API 参考的版本号。例如:
261
264
262
- ```
263
- title: v1.17
264
- [Kubernetes API v1.17](/docs/reference/generated/kubernetes-api/v1.17/)
265
- ```
265
+ ```
266
+ title: v1.17
267
+ [Kubernetes API v1.17](/docs/reference/generated/kubernetes-api/v1.17/)
268
+ ```
269
+
266
270
<!--
267
271
* Open `<web-base>/content/en/docs/reference/_index.md` for editing, and add a
268
272
new link for the latest API reference. Remove the oldest API reference version.
269
273
There should be five links to the most recent API references.
270
274
-->
271
- * 打开编辑 `<web-base>/content/en/docs/reference/_index.md`,添加指向最新 API 参考
272
- 的链接 ,删除最老的 API 版本。
275
+ * 打开编辑 ` <web-base>/content/en/docs/reference/_index.md ` ,添加指向最新 API
276
+ 参考的链接 ,删除最老的 API 版本。
273
277
通常保留最近的五个版本的 API 参考的链接。
274
278
275
279
<!--
@@ -283,16 +287,19 @@ Verify the [local preview](http://localhost:1313/docs/reference/generated/kubern
283
287
发布 API 参考的本地版本。
284
288
检查[ 本地预览] (http://localhost:1313/docs/reference/generated/kubernetes-api/{{ < param "version">}}/)。
285
289
290
+ <!--
291
+ # if not already done
292
+ -->
286
293
``` shell
287
294
cd < web-base>
288
- git submodule update --init --recursive --depth 1 # if not already done
295
+ git submodule update --init --recursive --depth 1 # 如果尚未完成
289
296
make container-serve
290
297
```
291
298
292
299
<!--
293
300
## Commit the changes
294
301
295
- In `<web-base>` run `git add` and `git commit` to commit the change.
302
+ In `<web-base>`, run `git add` and `git commit` to commit the change.
296
303
-->
297
304
## 提交更改
298
305
@@ -319,4 +326,3 @@ to monitor your pull request until it has been merged.
319
326
* [ 生成参考文档快速入门] ( /zh-cn/docs/contribute/generate-ref-docs/quickstart/ )
320
327
* [ 为 Kubernetes 组件和工具生成参考文档] ( /zh-cn/docs/contribute/generate-ref-docs/kubernetes-components/ )
321
328
* [ 为 kubectl 命令集生成参考文档] ( /zh-cn/docs/contribute/generate-ref-docs/kubectl/ )
322
-
0 commit comments