Skip to content

Commit 67c7cc9

Browse files
authored
Merge pull request #29488 from howieyuen/contribution-2
[zh]sync contribution files for 1.22(Part-2)
2 parents 1393a4a + 742824d commit 67c7cc9

File tree

6 files changed

+82
-72
lines changed

6 files changed

+82
-72
lines changed

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

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ will be different in your situation.
159159
<!--
160160
Here's an example of editing a comment in the Kubernetes source code.
161161
162-
In your local kubernetes/kubernetes repository, check out the master branch,
162+
In your local kubernetes/kubernetes repository, check out the default branch,
163163
and make sure it is up to date:
164164
-->
165165
以下在 Kubernetes 源代码中编辑注释的示例。
166166

167-
在您本地的 kubernetes/kubernetes 代码仓库中,检出 master 分支,并确保它是最新的:
167+
在您本地的 kubernetes/kubernetes 代码仓库中,检出默认分支,并确保它是最新的:
168168

169169
```shell
170170
cd <k8s-base>
@@ -173,9 +173,9 @@ git pull https://github.com/kubernetes/kubernetes master
173173
```
174174

175175
<!--
176-
Suppose this source file in the master branch has the typo "atmost":
176+
Suppose this source file in that default branch has the typo "atmost":
177177
-->
178-
假设 master 分支中的下面源文件中包含拼写错误 "atmost":
178+
假设默认分支中的下面源文件中包含拼写错误 "atmost":
179179

180180
[kubernetes/kubernetes/staging/src/k8s.io/api/apps/v1/types.go](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/apps/v1/types.go)
181181

@@ -228,7 +228,6 @@ Go to `<k8s-base>` and run these scripts:
228228
hack/update-generated-swagger-docs.sh
229229
hack/update-openapi-spec.sh
230230
hack/update-generated-protobuf.sh
231-
hack/update-api-reference-docs.sh
232231
```
233232

234233
<!-- Run `git status` to see what was generated. -->
@@ -238,8 +237,6 @@ hack/update-api-reference-docs.sh
238237
On branch master
239238
...
240239
modified: api/openapi-spec/swagger.json
241-
modified: api/swagger-spec/apps_v1.json
242-
modified: docs/api-reference/apps/v1/definitions.html
243240
modified: staging/src/k8s.io/api/apps/v1/generated.proto
244241
modified: staging/src/k8s.io/api/apps/v1/types.go
245242
modified: staging/src/k8s.io/api/apps/v1/types_swagger_doc_generated.go
@@ -310,24 +307,27 @@ In the preceding section, you edited a file in the master branch and then ran sc
310307
to generate an OpenAPI spec and related files. Then you submitted your changes in a pull request
311308
to the master branch of the kubernetes/kubernetes repository. Now suppose you want to backport
312309
your change into a release branch. For example, suppose the master branch is being used to develop
313-
Kubernetes version 1.10, and you want to backport your change into the release-1.9 branch.
310+
Kubernetes version {{< skew latestVersion >}}, and you want to backport your change into the
311+
release-{{< skew prevMinorVersion >}} branch.
314312
-->
315313
### 将你的提交 Cherrypick 到发布分支
316314

317315
在上一节中,你在 master 分支中编辑了一个文件,然后运行了脚本用来生成 OpenAPI 规范和相关文件。
318316
然后用 PR 将你的更改提交到 kubernetes/kubernetes 代码仓库的 master 分支中。
319317
现在,需要将你的更改反向移植到已经发布的分支。
320-
例如,假设 master 分支被用来开发 Kubernetes 1.10 版,并且你想将更改反向移植到 release-1.9 分支。
318+
例如,假设 master 分支被用来开发 Kubernetes {{< skew latestVersion >}} 版,
319+
并且你想将更改反向移植到 release-{{< skew prevMinorVersion >}} 分支。
321320

322321
<!--
323322
Recall that your pull request has two commits: one for editing `types.go`
324323
and one for the files generated by scripts. The next step is to propose a cherry pick of your first
325-
commit into the release-1.9 branch. The idea is to cherry pick the commit that edited `types.go`, but not
326-
the commit that has the results of running the scripts. For instructions, see
324+
commit into the release-{{< skew prevMinorVersion >}} branch. The idea is to cherry pick the commit
325+
that edited `types.go`, but not the commit that has the results of running the scripts. For instructions, see
327326
[Propose a Cherry Pick](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md).
328327
-->
329328
回想一下,您的 PR 有两个提交:一个用于编辑 `types.go`,一个用于由脚本生成的文件。
330-
下一步是将你的第一次提交 cherrypick 到 release-1.9 分支。这样做的原因是仅 cherrypick 编辑了 types.go 的提交,
329+
下一步是将你的第一次提交 cherrypick 到 release-{{< skew prevMinorVersion >}} 分支。
330+
这样做的原因是仅 cherrypick 编辑了 types.go 的提交,
331331
而不是具有脚本运行结果的提交。
332332
有关说明,请参见[提出 Cherry Pick](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md)
333333

@@ -337,16 +337,17 @@ pull request. If you don't have those permissions, you will need to work with so
337337
and milestone for you.
338338
-->
339339
{{< note >}}
340-
提出 Cherry Pick 要求你有权在 PR 中设置标签和里程碑。如果您没有这些权限
340+
提出 Cherry Pick 要求你有权在 PR 中设置标签和里程碑。如果你没有这些权限
341341
则需要与可以为你设置标签和里程碑的人员合作。
342342
{{< /note >}}
343343

344344
<!--
345-
When you have a pull request in place for cherry picking your one commit into the release-1.9 branch,
346-
the next step is to run these scripts in the release-1.9 branch of your local environment.
345+
When you have a pull request in place for cherry picking your one commit into the
346+
release-{{< skew prevMinorVersion >}} branch, the next step is to run these scripts in the
347+
release-{{< skew prevMinorVersion >}} branch of your local environment.
347348
-->
348-
当你发起 PR 将你的一个提交 cherry pick 到 release-1.9 分支中时,下一步是在本地环境的 release-1.9
349-
分支中运行如下脚本。
349+
当你发起 PR 将你的一个提交 cherry pick 到 release-{{< skew prevMinorVersion >}} 分支中时,
350+
下一步是在本地环境的 release-{{< skew prevMinorVersion >}} 分支中运行如下脚本。
350351

351352
```shell
352353
hack/update-generated-swagger-docs.sh
@@ -357,24 +358,29 @@ hack/update-api-reference-docs.sh
357358

358359
<!--
359360
Now add a commit to your cherry-pick pull request that has the recently generated OpenAPI spec
360-
and related files. Monitor your pull request until it gets merged into the release-1.9 branch.
361+
and related files. Monitor your pull request until it gets merged into the
362+
release-{{< skew prevMinorVersion >}} branch.
361363
-->
362364
现在将提交添加到您的 Cherry-Pick PR 中,该 PR 中包含最新生成的 OpenAPI 规范和相关文件。
363-
关注你的 PR,直到其合并到 release-1.9 分支中为止。
365+
关注你的 PR,直到其合并到 release-{{< skew prevMinorVersion >}} 分支中为止。
364366

365367
<!--
366-
At this point, both the master branch and the release-1.9 branch have your updated `types.go`
368+
At this point, both the master branch and the release-{{< skew prevMinorVersion >}} branch have your updated `types.go`
367369
file and a set of generated files that reflect the change you made to `types.go`. Note that the
368-
generated OpenAPI spec and other generated files in the release-1.9 branch are not necessarily
369-
the same as the generated files in the master branch. The generated files in the release-1.9 branch
370-
contain API elements only from Kubernetes 1.9. The generated files in the master branch might contain
371-
API elements that are not in 1.9, but are under development for 1.10.
370+
generated OpenAPI spec and other generated files in the release-{{< skew prevMinorVersion >}} branch are not necessarily
371+
the same as the generated files in the master branch. The generated files in the release-{{< skew prevMinorVersion >}} branch
372+
contain API elements only from Kubernetes {{< skew prevMinorVersion >}}. The generated files in the master branch might contain
373+
API elements that are not in {{< skew prevMinorVersion >}}, but are under development for {{< skew latestVersion >}}.
372374
-->
373-
此时,master 分支和 release-1.9 分支都具有更新的 `types.go` 文件和一组生成的文件,
375+
此时,master 分支和 release-{{< skew prevMinorVersion >}}
376+
分支都具有更新的 `types.go` 文件和一组生成的文件,
374377
这些文件反映了对 `types.go` 所做的更改。
375-
请注意,生成的 OpenAPI 规范和其他 release-1.9 分支中生成的文件不一定与 master 分支中生成的文件相同。
376-
release-1.9 分支中生成的文件仅包含来自 Kubernetes 1.9 的 API 元素。
377-
master 分支中生成的文件可能包含不在 1.9 中但正在为 1.10 开发的 API 元素。
378+
请注意,生成的 OpenAPI 规范和其他 release-{{< skew prevMinorVersion >}}
379+
分支中生成的文件不一定与 master 分支中生成的文件相同。
380+
release-{{< skew prevMinorVersion >}} 分支中生成的文件仅包含来自
381+
Kubernetes {{< skew prevMinorVersion >}} 的 API 元素。
382+
master 分支中生成的文件可能包含不在 {{< skew prevMinorVersion >}}
383+
中但正在为 {{< skew latestVersion >}} 开发的 API 元素。
378384

379385
<!--
380386
## Generating the published reference docs

content/zh/docs/contribute/generate-ref-docs/kubectl.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ The remaining steps refer to your base directory as `<rdocs-base>`. -->
133133
<!--
134134
In your local k8s.io/kubernetes repository, check out the branch of interest,
135135
and make sure it is up to date. For example, if you want to generate docs for
136-
Kubernetes 1.17, you could use these commands:
136+
Kubernetes {{< skew prevMinorVersion >}}.0, you could use these commands:
137137
-->
138138
在本地的 k8s.io/kubernetes 仓库中,检出感兴趣的分支并确保它是最新的。例如,
139-
如果你想要生成 Kubernetes 1.17 的文档,可以使用以下命令:
139+
如果你想要生成 Kubernetes {{< skew prevMinorVersion >}}.0 的文档,可以使用以下命令:
140140

141141
```shell
142142
cd <k8s-base>
143-
git checkout v1.17.0
144-
git pull https://github.com/kubernetes/kubernetes v1.17.0
143+
git checkout v{{< skew prevMinorVersion >}}.0
144+
git pull https://github.com/kubernetes/kubernetes {{< skew prevMinorVersion >}}.0
145145
```
146146

147147
<!--
@@ -172,13 +172,13 @@ kubectl 源码中的一个或多个注释开始。在本地 kubernetes/kubernete
172172
is an example of a pull request that fixes a typo in the kubectl source code.
173173
174174
Monitor your pull request, and respond to reviewer comments. Continue to monitor your
175-
pull request until it is merged into the master branch of the kubernetes/kubernetes repository.
175+
pull request until it is merged into the target branch of the kubernetes/kubernetes repository.
176176
-->
177177

178178
[PR 56673](https://github.com/kubernetes/kubernetes/pull/56673/files) 是一个对 kubectl
179179
源码中的笔误进行修复的 PR 示例。
180180

181-
跟踪你的 PR,并回应评审人的评论。继续跟踪你的 PR,直到它合入到 kubernetes/kubernetes 仓库的 master 分支中
181+
跟踪你的 PR,并回应评审人的评论。继续跟踪你的 PR,直到它合入到 kubernetes/kubernetes 仓库的目标分支中
182182

183183
<!--
184184
## Cherry picking your change into a release branch
@@ -195,15 +195,17 @@ cherry picked into the release branch.
195195
cherry-pick 方式合入已发布分支。
196196

197197
<!--
198-
For example, suppose the master branch is being used to develop Kubernetes 1.10,
199-
and you want to backport your change to the release-1.15 branch. For instructions
198+
For example, suppose the master branch is being used to develop Kubernetes
199+
{{< skew currentVersion >}}
200+
and you want to backport your change to the release-{{< skew prevMinorVersion >}} branch. For instructions
200201
on how to do this, see
201202
[Propose a Cherry Pick](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md).
202203
203204
Monitor your cherry-pick pull request until it is merged into the release branch.
204205
-->
205206

206-
例如,假设 master 分支正用于开发 Kubernetes 1.16 版本,而你希望将修改合入到已发布的 1.15 版本分支。
207+
例如,假设 master 分支正用于开发 Kubernetes {{< skew currentVersion >}} 版本,
208+
而你希望将修改合入到 release-{{< skew prevMinorVersion >}} 版本分支。
207209
相关的操作指南,请参见
208210
[提议一个 cherry-pick](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md)
209211

@@ -233,21 +235,22 @@ Go to `<rdocs-base>`, and open the `Makefile` for editing:
233235
* Set `K8S_ROOT` to `<k8s-base>`.
234236
* Set `K8S_WEBROOT` to `<web-base>`.
235237
* Set `K8S_RELEASE` to the version of the docs you want to build.
236-
For example, if you want to build docs for Kubernetes 1.17, set `K8S_RELEASE` to 1.17.
238+
For example, if you want to build docs for Kubernetes {{< skew prevMinorVersion >}}, set `K8S_RELEASE` to {{< skew prevMinorVersion >}}.
237239
238240
For example, update the following variables:
239241
-->
240242
* 设置 `K8S_ROOT``<k8s-base>`
241243
* 设置 `K8S_WEBROOT``<web-base>`
242244
* 设置 `K8S_RELEASE` 为要构建文档的版本。
243-
例如,如果您想为 Kubernetes 1.17 构建文档,请将 `K8S_RELEASE` 设置为 1.17。
245+
例如,如果您想为 Kubernetes {{< skew prevMinorVersion >}} 构建文档,
246+
请将 `K8S_RELEASE` 设置为 {{< skew prevMinorVersion >}}。
244247

245248
例如:
246249

247250
```
248251
export K8S_WEBROOT=$(GOPATH)/src/github.com/<your-username>/website
249252
export K8S_ROOT=$(GOPATH)/src/k8s.io/kubernetes
250-
export K8S_RELEASE=1.17
253+
export K8S_RELEASE={{< skew prevMinorVersion >}}
251254
```
252255

253256
<!--
@@ -281,19 +284,20 @@ make createversiondirs
281284
282285
In your local <k8s-base> repository, checkout the branch that has
283286
the version of Kubernetes that you want to document. For example, if you want
284-
to generate docs for Kubernetes 1.15, checkout the release-1.15 branch. Make sure
287+
to generate docs for Kubernetes {{< skew prevMinorVersion >}}.0, checkout the `v{{< skew prevMinorVersion >}}` tag. Make sure
285288
you local branch is up to date.
286289
-->
287290
## 从 kubernetes/kubernetes 检出一个分支
288291

289292
在本地 `<k8s-base>` 仓库中,检出你想要生成文档的、包含 Kubernetes 版本的分支。
290-
例如,如果希望为 Kubernetes 1.17 版本生成文档,请检出 `v1.17.0` 标记。
293+
例如,如果希望为 Kubernetes {{< skew prevMinorVersion >}}.0 版本生成文档,
294+
请检出 `v{{< skew prevMinorVersion >}}` 标记。
291295
确保本地分支是最新的。
292296

293297
```shell
294298
cd <k8s-base>
295-
git checkout v1.17.0
296-
git pull https://github.com/kubernetes/kubernetes v1.17.0
299+
git checkout v{{< skew prevMinorVersion >}}.0
300+
git pull https://github.com/kubernetes/kubernetes v{{< skew prevMinorVersion >}}.0
297301
```
298302

299303
<!--

content/zh/docs/contribute/generate-ref-docs/quickstart.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ weight: 40
1212
<!-- overview -->
1313

1414
<!--
15-
This page shows how to use the `update-imported-docs` script to generate
15+
This page shows how to use the `update-imported-docs.py` script to generate
1616
the Kubernetes reference documentation. The script automates
1717
the build setup and generates the reference documentation for a release.
1818
-->
19-
本页讨论如何使用 `update-imported-docs` 脚本来生成 Kubernetes 参考文档。
19+
本页讨论如何使用 `update-imported-docs.py` 脚本来生成 Kubernetes 参考文档。
2020
此脚本将构建的配置过程自动化,并为某个发行版本生成参考文档。
2121

2222
## {{% heading "prerequisites" %}}
@@ -27,13 +27,13 @@ the build setup and generates the reference documentation for a release.
2727
<!--
2828
## Getting the docs repository
2929
30-
Make sure your `website` fork is up-to-date with the `kubernetes/website` master and clone
31-
your `website` fork.
30+
Make sure your `website` fork is up-to-date with the `kubernetes/website` remote on
31+
GitHub (`main` branch), and clone your `website` fork.
3232
-->
3333
## 获取文档仓库 {#getting-the-docs-repository}
3434

35-
确保你的 `website` 派生仓库与 `kubernetes/website` 主分支一致,并克隆
36-
你的派生仓库
35+
确保你的 `website` 派生仓库与 GitHub 上的 `kubernetes/website` 远程仓库(`main` 分支)保持同步,
36+
并克隆你的派生仓库
3737

3838
```shell
3939
mkdir github.com
@@ -63,7 +63,7 @@ see the [contributing upstream guide](/docs/contribute/generate-ref-docs/contrib
6363
<!--
6464
## Overview of update-imported-docs
6565
66-
The `update-imported-docs` script is located in the `<web-base>/update-imported-docs/`
66+
The `update-imported-docs.py` script is located in the `<web-base>/update-imported-docs/`
6767
directory.
6868
6969
The script builds the following references:
@@ -74,15 +74,15 @@ The script builds the following references:
7474
-->
7575
## update-imported-docs 的概述
7676

77-
脚本 `update-imported-docs` 位于 `<web-base>/update-imported-docs/` 目录下,
77+
脚本 `update-imported-docs.py` 位于 `<web-base>/update-imported-docs/` 目录下,
7878
能够生成以下参考文档:
7979

8080
* Kubernetes 组件和工具的参考页面
8181
* `kubectl` 命令参考文档
8282
* Kubernetes API 参考文档
8383

8484
<!--
85-
The `update-imported-docs` script generates the Kubernetes reference documentation
85+
The `update-imported-docs.py` script generates the Kubernetes reference documentation
8686
from the Kubernetes source code. The script creates a temporary directory
8787
under `/tmp` on your machine and clones the required repositories: `kubernetes/kubernetes` and
8888
`kubernetes-sigs/reference-docs` into this directory.
@@ -93,7 +93,7 @@ Three additional environment variables are set:
9393
* `K8S_ROOT`
9494
* `K8S_WEBROOT`
9595
-->
96-
脚本 `update-imported-docs` 基于 Kubernetes 源代码生成参考文档。
96+
脚本 `update-imported-docs.py` 基于 Kubernetes 源代码生成参考文档。
9797
过程中会在你的机器的 `/tmp` 目录下创建临时目录,克隆所需要的仓库
9898
`kubernetes/kubernetes``kubernetes-sigs/reference-docs` 到此临时目录。
9999
脚本会将 `GOPATH` 环境变量设置为指向此临时目录。
@@ -124,7 +124,7 @@ determines the version of the release.
124124
变量 `K8S_RELEASE` 用来确定所针对的发行版本。
125125

126126
<!--
127-
The `update-imported-docs` script performs the following steps:
127+
The `update-imported-docs.py` script performs the following steps:
128128
129129
1. Clones the related repositories specified in a configuration file. For the
130130
purpose of generating reference docs, the repository that is cloned by
@@ -136,7 +136,7 @@ The `update-imported-docs` script performs the following steps:
136136
1. Updates `kubectl` command links from `kubectl`.md to the refer to
137137
the sections in the `kubectl` command reference.
138138
-->
139-
脚本 `update-imported-docs` 执行以下步骤:
139+
脚本 `update-imported-docs.py` 执行以下步骤:
140140

141141
1. 克隆配置文件中所指定的相关仓库。就生成参考文档这一目的而言,要克隆的
142142
仓库默认为 `kubernetes-sigs/reference-docs`
@@ -260,22 +260,22 @@ For example:
260260
<!--
261261
## Running the update-imported-docs tool
262262

263-
You can run the `update-imported-docs` tool as follows:
263+
You can run the `update-imported-docs.py` tool as follows:
264264
-->
265265
## 运行 update-imported-docs 工具
266266

267-
你可以用如下方式运行 `update-imported-docs` 工具:
267+
你可以用如下方式运行 `update-imported-docs.py` 工具:
268268

269269
```shell
270270
cd <web-base>/update-imported-docs
271-
./update-imported-docs <configuration-file.yml> <release-version>
271+
./update-imported-docs.py <configuration-file.yml> <release-version>
272272
```
273273

274274
<!-- For example: -->
275275
例如:
276276

277277
```shell
278-
./update-imported-docs reference.yml 1.17
278+
./update-imported-docs.py reference.yml 1.17
279279
```
280280

281281
<!-- Revisit: is the release configuration used -->
@@ -284,13 +284,13 @@ cd <web-base>/update-imported-docs
284284
The `release.yml` configuration file contains instructions to fix relative links.
285285
To fix relative links within your imported files, set the`gen-absolute-links`
286286
property to `true`. You can find an example of this in
287-
[`release.yml`](https://github.com/kubernetes/website/blob/master/update-imported-docs/release.yml).
287+
[`release.yml`](https://github.com/kubernetes/website/blob/main/update-imported-docs/release.yml).
288288
-->
289289
## 修复链接
290290

291291
配置文件 `release.yml` 中包含用来修复相对链接的指令。
292292
若要修复导入文件中的相对链接,将 `gen-absolute-links` 属性设置为 `true`。
293-
你可以在 [`release.yml`](https://github.com/kubernetes/website/blob/master/update-imported-docs/release.yml)
293+
你可以在 [`release.yml`](https://github.com/kubernetes/website/blob/main/update-imported-docs/release.yml)
294294
文件中找到示例。
295295

296296
<!--

0 commit comments

Comments
 (0)