Skip to content

Commit e8d927b

Browse files
committed
[zh-cn]sync generate-ref-docs/kubectl.md
Signed-off-by: xin.li <[email protected]>
1 parent 0a87391 commit e8d927b

File tree

1 file changed

+59
-46
lines changed
  • content/zh-cn/docs/contribute/generate-ref-docs

1 file changed

+59
-46
lines changed

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

Lines changed: 59 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ This page shows how to generate the `kubectl` command reference.
2020

2121
<!--
2222
This topic shows how to generate reference documentation for
23-
[kubectl commands](/docs/reference/generated/kubectl/kubectl-commands)
24-
like
23+
[kubectl commands](/docs/reference/generated/kubectl/kubectl-commands) like
2524
[kubectl apply](/docs/reference/generated/kubectl/kubectl-commands#apply) and
2625
[kubectl taint](/docs/reference/generated/kubectl/kubectl-commands#taint).
2726
This topic does not show how to generate the
@@ -46,20 +45,22 @@ reference page, see
4645
<!-- steps -->
4746

4847
<!--
49-
## Setting up the local repositories
48+
## Set up the local repositories
5049
51-
Create a local workspace and set your `GOPATH`.
50+
Create a local workspace and set your `GOPATH`:
5251
-->
5352
## 配置本地仓库
5453

55-
创建本地工作区并设置你的 `GOPATH`
54+
创建本地工作区并设置你的 `GOPATH`
5655

5756
```shell
5857
mkdir -p $HOME/<workspace>
5958
export GOPATH=$HOME/<workspace>
6059
```
6160

62-
<!-- Get a local clone of the following repositories: -->
61+
<!--
62+
Get a local clone of the following repositories:
63+
-->
6364
获取以下仓库的本地克隆:
6465

6566
```shell
@@ -78,53 +79,58 @@ If you don't already have the kubernetes/website repository, get it now:
7879
git clone https://github.com/<your-username>/website $GOPATH/src/github.com/<your-username>/website
7980
```
8081

81-
<!-- Get a clone of the kubernetes/kubernetes repository as k8s.io/kubernetes: -->
82+
<!--
83+
Get a clone of the kubernetes/kubernetes repository as k8s.io/kubernetes:
84+
-->
8285
克隆 kubernetes/kubernetes 仓库作为 k8s.io/kubernetes:
8386

8487
```shell
8588
git clone https://github.com/kubernetes/kubernetes $GOPATH/src/k8s.io/kubernetes
8689
```
8790

8891
<!--
89-
Remove the spf13 package from `$GOPATH/src/k8s.io/kubernetes/vendor/github.com`.
92+
Remove the spf13 package from `$GOPATH/src/k8s.io/kubernetes/vendor/github.com`:
9093
-->
91-
`$GOPATH/src/k8s.io/kubernetes/vendor/github.com` 中移除 spf13 软件包
94+
`$GOPATH/src/k8s.io/kubernetes/vendor/github.com` 中移除 spf13 软件包
9295

9396
```shell
9497
rm -rf $GOPATH/src/k8s.io/kubernetes/vendor/github.com/spf13
9598
```
9699

97-
<!-- The kubernetes/kubernetes repository provides access to the kubectl and kustomize source code. -->
100+
<!--
101+
The kubernetes/kubernetes repository provides access to the kubectl and kustomize source code.
102+
-->
98103
kubernetes/kubernetes 仓库提供对 kubectl 和 kustomize 源代码的访问。
99104

100105
<!--
101106
* Determine the base directory of your clone of the
102-
[kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository.
103-
For example, if you followed the preceding step to get the repository, your
104-
base directory is `$GOPATH/src/k8s.io/kubernetes.`
105-
The remaining steps refer to your base directory as `<k8s-base>`.
107+
[kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository.
108+
For example, if you followed the preceding step to get the repository, your
109+
base directory is `$GOPATH/src/k8s.io/kubernetes.`
110+
The remaining steps refer to your base directory as `<k8s-base>`.
106111
-->
107112
* 确定 [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) 仓库的本地主目录。
108113
例如,如果按照前面的步骤来获取该仓库,则主目录是 `$GOPATH/src/k8s.io/kubernetes.`
109114
下文将该目录称为 `<k8s-base>`
110115

111116
<!--
112117
* Determine the base directory of your clone of the
113-
[kubernetes/website](https://github.com/kubernetes/website) repository.
114-
For example, if you followed the preceding step to get the repository, your
115-
base directory is `$GOPATH/src/github.com/<your-username>/website.`
116-
The remaining steps refer to your base directory as `<web-base>`.
118+
[kubernetes/website](https://github.com/kubernetes/website) repository.
119+
For example, if you followed the preceding step to get the repository, your
120+
base directory is `$GOPATH/src/github.com/<your-username>/website.`
121+
The remaining steps refer to your base directory as `<web-base>`.
117122
-->
118123
* 确定 [kubernetes/website](https://github.com/kubernetes/website) 仓库的本地主目录。
119124
例如,如果按照前面的步骤来获取该仓库,则主目录是 `$GOPATH/src/github.com/<your-username>/website`
120125
下文将该目录称为 `<web-base>`
121126

122127
<!--
123128
* Determine the base directory of your clone of the
124-
[kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs) repository.
125-
For example, if you followed the preceding step to get the repository, your
126-
base directory is `$GOPATH/src/github.com/kubernetes-sigs/reference-docs.`
127-
The remaining steps refer to your base directory as `<rdocs-base>`. -->
129+
[kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs) repository.
130+
For example, if you followed the preceding step to get the repository, your
131+
base directory is `$GOPATH/src/github.com/kubernetes-sigs/reference-docs.`
132+
The remaining steps refer to your base directory as `<rdocs-base>`.
133+
-->
128134
* 确定 [kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs)
129135
仓库的本地主目录。例如,如果按照前面的步骤来获取该仓库,则主目录是
130136
`$GOPATH/src/github.com/kubernetes-sigs/reference-docs`
@@ -152,7 +158,7 @@ If you do not need to edit the kubectl source code, follow the instructions to
152158
源码,请按照说明[配置构建变量](#setting-build-variables)
153159

154160
<!--
155-
## Editing the kubectl source code
161+
## Edit the kubectl source code
156162
157163
The kubectl command reference documentation is automatically generated from
158164
the kubectl source code. If you want to change the reference documentation, the first step
@@ -178,10 +184,11 @@ pull request until it is merged into the target branch of the kubernetes/kuberne
178184
[PR 56673](https://github.com/kubernetes/kubernetes/pull/56673/files) 是一个对 kubectl
179185
源码中的笔误进行修复的 PR 示例。
180186

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

183190
<!--
184-
## Cherry picking your change into a release branch
191+
## Cherry pick your change into a release branch
185192
186193
Your change is now in the master branch, which is used for development of the next
187194
Kubernetes release. If you want your change to appear in the docs for a Kubernetes
@@ -195,8 +202,7 @@ cherry picked into the release branch.
195202
cherry-pick 方式合入已发布分支。
196203

197204
<!--
198-
For example, suppose the master branch is being used to develop Kubernetes
199-
{{< skew currentVersion >}}
205+
For example, suppose the master branch is being used to develop Kubernetes {{< skew currentVersion >}}
200206
and you want to backport your change to the release-{{< skew prevMinorVersion >}} branch. For instructions
201207
on how to do this, see
202208
[Propose a Cherry Pick](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md).
@@ -223,7 +229,7 @@ need to work with someone who can set the label and milestone for you.
223229
{{< /note >}}
224230

225231
<!--
226-
## Setting build variables
232+
## Set build variables
227233
228234
Go to `<rdocs-base>`, and open the `Makefile` for editing:
229235
-->
@@ -235,7 +241,8 @@ Go to `<rdocs-base>`, and open the `Makefile` for editing:
235241
* Set `K8S_ROOT` to `<k8s-base>`.
236242
* Set `K8S_WEBROOT` to `<web-base>`.
237243
* Set `K8S_RELEASE` to the version of the docs you want to build.
238-
For example, if you want to build docs for Kubernetes {{< skew prevMinorVersion >}}, set `K8S_RELEASE` to {{< skew prevMinorVersion >}}.
244+
For example, if you want to build docs for Kubernetes {{< skew prevMinorVersion >}},
245+
set `K8S_RELEASE` to {{< skew prevMinorVersion >}}.
239246
240247
For example, update the following variables:
241248
-->
@@ -280,12 +287,12 @@ make createversiondirs
280287
```
281288

282289
<!--
283-
## Checking out a branch in k8s.io/kubernetes
290+
## Check out a branch in k8s.io/kubernetes
284291
285-
In your local <k8s-base> repository, checkout the branch that has
292+
In your local <k8s-base> repository, check out the branch that has
286293
the version of Kubernetes that you want to document. For example, if you want
287-
to generate docs for Kubernetes {{< skew prevMinorVersion >}}.0, checkout the `v{{< skew prevMinorVersion >}}` tag. Make sure
288-
you local branch is up to date.
294+
to generate docs for Kubernetes {{< skew prevMinorVersion >}}.0, checkout the
295+
`v{{< skew prevMinorVersion >}}` tag. Make sure you local branch is up to date.
289296
-->
290297
## 从 kubernetes/kubernetes 检出一个分支
291298

@@ -301,7 +308,7 @@ git pull https://github.com/kubernetes/kubernetes v{{< skew prevMinorVersion >}}
301308
```
302309

303310
<!--
304-
## Running the doc generation code
311+
## Run the doc generation code
305312
306313
In your local kubernetes-incubator/reference-docs repository, build and run the
307314
kubectl command reference generation code. You might need to run the command as root:
@@ -319,8 +326,8 @@ make copycli
319326
The `copycli` command will clean the staging directories, generate the kubectl command files,
320327
and copy the collated kubectl reference HTML page and assets to `<web-base>`.
321328
-->
322-
`copycli` 命令将清理暂存目录,生成 kubectl 命令文件,并将整理后的 kubectl 参考 HTML 页面和
323-
文件复制到 `<web-base>`
329+
`copycli` 命令将清理暂存目录,生成 kubectl 命令文件,并将整理后的 kubectl
330+
参考 HTML 页面和文件复制到 `<web-base>`
324331

325332
<!--
326333
## Locate the generated files
@@ -350,16 +357,19 @@ cd <web-base>
350357
git status
351358
```
352359

353-
<!-- The output should include the modified files: -->
360+
<!--
361+
The output should include the modified files:
362+
-->
354363
输出应包括修改后的文件:
355364

356365
```
357366
static/docs/reference/generated/kubectl/kubectl-commands.html
358367
static/docs/reference/generated/kubectl/navData.js
359368
```
360369

361-
<!-- Additionally, the output might show the modified files: -->
362-
370+
<!--
371+
Additionally, the output might show the modified files:
372+
-->
363373
此外,输出可能还包含:
364374

365375
```
@@ -382,17 +392,22 @@ Build the Kubernetes documentation in your local `<web-base>`.
382392

383393
在本地 `<web-base>` 中构建 Kubernetes 文档。
384394

395+
<!--
396+
# if not already done
397+
-->
385398
```shell
386399
cd <web-base>
387-
git submodule update --init --recursive --depth 1 # if not already done
400+
git submodule update --init --recursive --depth 1 # 如果还没完成
388401
make container-serve
389402
```
390403

391-
<!-- View the [local preview](https://localhost:1313/docs/reference/generated/kubectl/kubectl-commands/). -->
404+
<!--
405+
View the [local preview](https://localhost:1313/docs/reference/generated/kubectl/kubectl-commands/).
406+
-->
392407
查看[本地预览](https://localhost:1313/docs/reference/generated/kubectl/kubectl-commands/)
393408

394409
<!--
395-
## Adding and committing changes in kubernetes/website
410+
## Add and commit changes in kubernetes/website
396411
397412
Run `git add` and `git commit` to commit the files.
398413
-->
@@ -401,15 +416,14 @@ Run `git add` and `git commit` to commit the files.
401416
运行 `git add``git commit` 提交修改文件。
402417

403418
<!--
404-
## Creating a pull request
419+
## Create a pull request
405420
406421
Create a pull request to the `kubernetes/website` repository. Monitor your
407422
pull request, and respond to review comments as needed. Continue to monitor
408423
your pull request until it is merged.
409424
410425
A few minutes after your pull request is merged, your updated reference
411-
topics will be visible in the
412-
[published documentation](/docs/home).
426+
topics will be visible in the [published documentation](/docs/home).
413427
-->
414428
## 创建 PR
415429

@@ -428,4 +442,3 @@ topics will be visible in the
428442
* [生成参考文档快速入门](/zh-cn/docs/contribute/generate-ref-docs/quickstart/)
429443
* [为 Kubernetes 组件和工具生成参考文档](/zh-cn/docs/contribute/generate-ref-docs/kubernetes-components/)
430444
* [为 Kubernetes API 生成参考文档](/zh-cn/docs/contribute/generate-ref-docs/kubernetes-api/)
431-

0 commit comments

Comments
 (0)