Skip to content

Commit ae62625

Browse files
committed
[zh-cn] sync generate-ref-docs/kubernetes-api contribute-upstream
Signed-off-by: xin.li <[email protected]>
1 parent ada9a60 commit ae62625

File tree

2 files changed

+62
-54
lines changed

2 files changed

+62
-54
lines changed

content/zh-cn/docs/contribute/generate-ref-docs/contribute-upstream.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Kubernetes API 和 `kube-*` 组件(例如 `kube-apiserver`、`kube-controller-
9090
当你在生成的文档中看到错误时,你可能需要考虑创建一个 PR 用来在上游项目中对其进行修复。
9191

9292
<!--
93-
## Cloning the Kubernetes repository
93+
## Clone the Kubernetes repository
9494
9595
If you don't already have the kubernetes/kubernetes repository, get it now:
9696
-->
@@ -108,7 +108,7 @@ go get github.com/kubernetes/kubernetes
108108
Determine the base directory of your clone of the
109109
[kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository.
110110
For example, if you followed the preceding step to get the repository, your
111-
base directory is `$GOPATH/src/github.com/kubernetes/kubernetes.`
111+
base directory is `$GOPATH/src/github.com/kubernetes/kubernetes`.
112112
The remaining steps refer to your base directory as `<k8s-base>`.
113113
-->
114114
确定你的 [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) 代码仓库克隆的根目录。
@@ -119,7 +119,7 @@ The remaining steps refer to your base directory as `<k8s-base>`.
119119
Determine the base directory of your clone of the
120120
[kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs) repository.
121121
For example, if you followed the preceding step to get the repository, your
122-
base directory is `$GOPATH/src/github.com/kubernetes-sigs/reference-docs.`
122+
base directory is `$GOPATH/src/github.com/kubernetes-sigs/reference-docs`.
123123
The remaining steps refer to your base directory as `<rdocs-base>`.
124124
-->
125125
确定你的 [kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs)
@@ -129,7 +129,7 @@ The remaining steps refer to your base directory as `<rdocs-base>`.
129129
接下来其余步骤将你的根目录称为 `<rdocs-base>`
130130

131131
<!--
132-
## Editing the Kubernetes source code
132+
## Edit the Kubernetes source code
133133
134134
The Kubernetes API reference documentation is automatically generated from
135135
an OpenAPI spec, which is generated from the Kubernetes source code. If you
@@ -149,9 +149,9 @@ you want to fix in order to fix the generated documentation.
149149
`kube-*` 组件的文档也是从上游源代码生成的。你必须更改与要修复的组件相关的代码,才能修复生成的文档。
150150

151151
<!--
152-
### Making changes to the upstream source code
152+
### Make changes to the upstream source code
153153
154-
The following steps are an example, not a general procedure. Details
154+
The following steps are an example, not a general procedure. Details
155155
will be different in your situation.
156156
-->
157157
### 更改上游 Kubernetes 源代码
@@ -209,7 +209,7 @@ On branch master
209209
```
210210

211211
<!--
212-
### Committing your edited file
212+
### Commit your edited file
213213
214214
Run `git add` and `git commit` to commit the changes you have made so far. In the next step,
215215
you will do a second commit. It is important to keep your changes separated into two commits.
@@ -220,7 +220,7 @@ you will do a second commit. It is important to keep your changes separated into
220220
在下一步中,你将进行第二次提交,将更改分成两个提交很重要。
221221

222222
<!--
223-
### Generating the OpenAPI spec and related files
223+
### Generate the OpenAPI spec and related files
224224
225225
Go to `<k8s-base>` and run these scripts:
226226
-->
@@ -305,7 +305,7 @@ repository and in related repositories, such as
305305
{{< /note >}}
306306

307307
<!--
308-
### Cherry picking your commit into a release branch
308+
### Cherry pick your commit into a release branch
309309
310310
In the preceding section, you edited a file in the master branch and then ran scripts
311311
to generate an OpenAPI spec and related files. Then you submitted your changes in a pull request
@@ -324,7 +324,7 @@ release-{{< skew prevMinorVersion >}} branch.
324324

325325
<!--
326326
Recall that your pull request has two commits: one for editing `types.go`
327-
and one for the files generated by scripts. The next step is to propose a cherry pick of your first
327+
and one for the files generated by scripts. The next step is to propose a cherry pick of your first
328328
commit into the release-{{< skew prevMinorVersion >}} branch. The idea is to cherry pick the commit
329329
that edited `types.go`, but not the commit that has the results of running the scripts. For instructions, see
330330
[Propose a Cherry Pick](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md).
@@ -385,7 +385,7 @@ master 分支中生成的文件可能包含不在 {{< skew prevMinorVersion >}}
385385
中但正在为 {{< skew latestVersion >}} 开发的 API 元素。
386386

387387
<!--
388-
## Generating the published reference docs
388+
## Generate the published reference docs
389389
390390
The preceding section showed how to edit a source file and then generate
391391
several files, including `api/openapi-spec/swagger.json` in the
@@ -399,7 +399,9 @@ the API reference documentation.
399399
`api/openapi-spec/swagger.json``swagger.json` 文件是 OpenAPI 定义文件,可用于生成 API 参考文档。
400400

401401
<!--
402-
You are now ready to follow the [Generating Reference Documentation for the Kubernetes API](/docs/contribute/generate-ref-docs/kubernetes-api/) guide to generate the
402+
You are now ready to follow the
403+
[Generating Reference Documentation for the Kubernetes API](/docs/contribute/generate-ref-docs/kubernetes-api/)
404+
guide to generate the
403405
[published Kubernetes API reference documentation](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/).
404406
-->
405407
现在,你可以按照

content/zh-cn/docs/contribute/generate-ref-docs/kubernetes-api.md

+48-42
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,21 @@ using the [kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/re
2121
If you find bugs in the generated documentation, you need to
2222
[fix them upstream](/docs/contribute/generate-ref-docs/contribute-upstream/).
2323
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)
2526
spec, continue reading this page.
2627
-->
2728
本页面显示了如何更新 Kubernetes API 参考文档。
2829

2930
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+
生成代码。
3334

3435
如果你在生成的文档中发现错误,则需要[在上游修复](/zh-cn/docs/contribute/generate-ref-docs/contribute-upstream/)
3536

36-
如果你只需要从 [OpenAPI](https://github.com/OAI/OpenAPI-Specification) 规范中重新生成参考文档,请继续阅读此页。
37+
如果你只需要从 [OpenAPI](https://github.com/OAI/OpenAPI-Specification)
38+
规范中重新生成参考文档,请继续阅读此页。
3739

3840
## {{% heading "prerequisites" %}}
3941

@@ -42,13 +44,13 @@ Kubernetes API 参考文档是从
4244
<!-- steps -->
4345

4446
<!--
45-
## Setting up the local repositories
47+
## Set up the local repositories
4648
47-
Create a local workspace and set your `GOPATH`.
49+
Create a local workspace and set your `GOPATH`:
4850
-->
4951
## 配置本地仓库
5052

51-
创建本地工作区并设置你的 `GOPATH`
53+
创建本地工作区并设置你的 `GOPATH`
5254

5355
```shell
5456
mkdir -p $HOME/<workspace>
@@ -87,30 +89,30 @@ git clone https://github.com/kubernetes/kubernetes $GOPATH/src/k8s.io/kubernetes
8789

8890
<!--
8991
* 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>`.
9395
9496
* 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>`.
98100
99101
* 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>`.
103105
-->
104106
* [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) 仓库克隆后的根目录为
105107
`$GOPATH/src/k8s.io/kubernetes`。 后续步骤将此目录称为 `<k8s-base>`
106108
* [kubernetes/website](https://github.com/kubernetes/website) 仓库克隆后的根目录为
107109
`$GOPATH/src/github.com/<your username>/website`。后续步骤将此目录称为 `<web-base>`
108110
* [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`
110112
后续步骤将此目录称为 `<rdocs-base>`
111113

112114
<!--
113-
## Generating the API reference docs
115+
## Generate the API reference docs
114116
115117
This section shows how to generate the
116118
[published Kubernetes API reference documentation](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/).
@@ -120,20 +122,22 @@ This section shows how to generate the
120122
本节说明如何生成[已发布的 Kubernetes API 参考文档](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)。
121123

122124
<!--
123-
### Setting build variables
125+
### Set build variables
124126
125127
Go to `<rdocs-base>`, and open the `Makefile` for editing:
126128
-->
127-
### 设置构建变量 {#setting-build-variables}
129+
### 设置构建变量 {#set-build-variables}
130+
131+
进入 `<rdocs-base>` 目录,然后打开 `Makefile` 文件进行编辑:
128132

129133
<!--
130134
* Set `K8S_ROOT` to `<k8s-base>`.
131135
* Set `K8S_WEBROOT` to `<web-base>`.
132136
* Set `K8S_RELEASE` to the version of the docs you want to build.
133137
For example, if you want to build docs for Kubernetes 1.17.0, set `K8S_RELEASE` to 1.17.0.
134138
-->
135-
* 设置 `K8S_ROOT``<k8s-base>`.
136-
* 设置 `K8S_WEBROOT``<web-base>`.
139+
* 设置 `K8S_ROOT``<k8s-base>`
140+
* 设置 `K8S_WEBROOT``<web-base>`
137141
* 设置 `K8S_RELEASE` 为要构建的文档的版本。
138142
例如,如果你想为 Kubernetes 1.17.0 构建文档,请将 `K8S_RELEASE` 设置为 1.17.0。
139143

@@ -149,9 +153,9 @@ export K8S_RELEASE=1.17.0
149153
```
150154

151155
<!--
152-
### Creating versioned directory and fetching Open API spec
156+
### Create versioned directory and fetch Open API spec
153157
154-
The `updateapispec` build target creates the versioned build directory.
158+
The `updateapispec` build target creates the versioned build directory.
155159
After the directory is created, the Open API spec is fetched from the
156160
`<k8s-base>` repository. These steps ensure that the version
157161
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>`.
167171
<!--
168172
In the `<rdocs-base>` directory, run the following build target:
169173
-->
170-
`<rdocs-base>` 目录中,运行以下命令来构建:
174+
`<rdocs-base>` 目录中,运行以下命令来构建:
171175

172176
```shell
173177
cd <rdocs-base>
174178
make updateapispec
175179
```
176180

177181
<!--
178-
### Building the API reference docs
182+
### Build the API reference docs
179183
180184
The `copyapi` target builds the API reference and
181185
copies the generated files to directories in `<web-base>`.
182186
Run the following command in `<rdocs-base>`:
183-
184187
-->
185188
### 构建 API 参考文档
186189

@@ -236,7 +239,7 @@ static/docs/reference/generated/kubernetes-api/{{< param "version" >}}/js/scroll
236239
```
237240

238241
<!--
239-
## Updating the API reference index pages
242+
## Update the API reference index pages
240243
241244
When generating reference documentation for a new release, update the file,
242245
`<web-base>/content/en/docs/reference/kubernetes-api/api-index.md` with the new
@@ -251,25 +254,26 @@ version number.
251254
* Open `<web-base>/content/en/docs/reference/kubernetes-api/api-index.md` for editing,
252255
and update the API reference version number. For example:
253256
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+
```
258261
-->
259262
* 打开并编辑 `<web-base>/content/en/docs/reference/kubernetes-api/api-index.md`
260263
API 参考的版本号。例如:
261264

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+
266270
<!--
267271
* Open `<web-base>/content/en/docs/reference/_index.md` for editing, and add a
268272
new link for the latest API reference. Remove the oldest API reference version.
269273
There should be five links to the most recent API references.
270274
-->
271-
* 打开编辑 `<web-base>/content/en/docs/reference/_index.md`,添加指向最新 API 参考
272-
的链接,删除最老的 API 版本。
275+
* 打开编辑 `<web-base>/content/en/docs/reference/_index.md`,添加指向最新 API
276+
参考的链接,删除最老的 API 版本。
273277
通常保留最近的五个版本的 API 参考的链接。
274278

275279
<!--
@@ -283,16 +287,19 @@ Verify the [local preview](http://localhost:1313/docs/reference/generated/kubern
283287
发布 API 参考的本地版本。
284288
检查[本地预览](http://localhost:1313/docs/reference/generated/kubernetes-api/{{< param "version">}}/)。
285289

290+
<!--
291+
# if not already done
292+
-->
286293
```shell
287294
cd <web-base>
288-
git submodule update --init --recursive --depth 1 # if not already done
295+
git submodule update --init --recursive --depth 1 # 如果尚未完成
289296
make container-serve
290297
```
291298

292299
<!--
293300
## Commit the changes
294301
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.
296303
-->
297304
## 提交更改
298305

@@ -319,4 +326,3 @@ to monitor your pull request until it has been merged.
319326
* [生成参考文档快速入门](/zh-cn/docs/contribute/generate-ref-docs/quickstart/)
320327
* [为 Kubernetes 组件和工具生成参考文档](/zh-cn/docs/contribute/generate-ref-docs/kubernetes-components/)
321328
* [为 kubectl 命令集生成参考文档](/zh-cn/docs/contribute/generate-ref-docs/kubectl/)
322-

0 commit comments

Comments
 (0)