@@ -20,8 +20,7 @@ This page shows how to generate the `kubectl` command reference.
20
20
21
21
<!--
22
22
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
25
24
[kubectl apply](/docs/reference/generated/kubectl/kubectl-commands#apply) and
26
25
[kubectl taint](/docs/reference/generated/kubectl/kubectl-commands#taint).
27
26
This topic does not show how to generate the
@@ -46,20 +45,22 @@ reference page, see
46
45
<!-- steps -->
47
46
48
47
<!--
49
- ## Setting up the local repositories
48
+ ## Set up the local repositories
50
49
51
- Create a local workspace and set your `GOPATH`.
50
+ Create a local workspace and set your `GOPATH`:
52
51
-->
53
52
## 配置本地仓库
54
53
55
- 创建本地工作区并设置你的 ` GOPATH ` 。
54
+ 创建本地工作区并设置你的 ` GOPATH ` :
56
55
57
56
``` shell
58
57
mkdir -p $HOME /< workspace>
59
58
export GOPATH=$HOME /< workspace>
60
59
```
61
60
62
- <!-- Get a local clone of the following repositories: -->
61
+ <!--
62
+ Get a local clone of the following repositories:
63
+ -->
63
64
获取以下仓库的本地克隆:
64
65
65
66
``` shell
@@ -78,53 +79,58 @@ If you don't already have the kubernetes/website repository, get it now:
78
79
git clone https://github.com/< your-username> /website $GOPATH /src/github.com/< your-username> /website
79
80
```
80
81
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
+ -->
82
85
克隆 kubernetes/kubernetes 仓库作为 k8s.io/kubernetes:
83
86
84
87
``` shell
85
88
git clone https://github.com/kubernetes/kubernetes $GOPATH /src/k8s.io/kubernetes
86
89
```
87
90
88
91
<!--
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`:
90
93
-->
91
- 从 ` $GOPATH/src/k8s.io/kubernetes/vendor/github.com ` 中移除 spf13 软件包。
94
+ 从 ` $GOPATH/src/k8s.io/kubernetes/vendor/github.com ` 中移除 spf13 软件包:
92
95
93
96
``` shell
94
97
rm -rf $GOPATH /src/k8s.io/kubernetes/vendor/github.com/spf13
95
98
```
96
99
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
+ -->
98
103
kubernetes/kubernetes 仓库提供对 kubectl 和 kustomize 源代码的访问。
99
104
100
105
<!--
101
106
* 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>`.
106
111
-->
107
112
* 确定 [ kubernetes/kubernetes] ( https://github.com/kubernetes/kubernetes ) 仓库的本地主目录。
108
113
例如,如果按照前面的步骤来获取该仓库,则主目录是 ` $GOPATH/src/k8s.io/kubernetes. ` 。
109
114
下文将该目录称为 ` <k8s-base> ` 。
110
115
111
116
<!--
112
117
* 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>`.
117
122
-->
118
123
* 确定 [ kubernetes/website] ( https://github.com/kubernetes/website ) 仓库的本地主目录。
119
124
例如,如果按照前面的步骤来获取该仓库,则主目录是 ` $GOPATH/src/github.com/<your-username>/website ` 。
120
125
下文将该目录称为 ` <web-base> ` 。
121
126
122
127
<!--
123
128
* 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
+ -->
128
134
* 确定 [ kubernetes-sigs/reference-docs] ( https://github.com/kubernetes-sigs/reference-docs )
129
135
仓库的本地主目录。例如,如果按照前面的步骤来获取该仓库,则主目录是
130
136
` $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
152
158
源码,请按照说明[ 配置构建变量] ( #setting-build-variables ) 。
153
159
154
160
<!--
155
- ## Editing the kubectl source code
161
+ ## Edit the kubectl source code
156
162
157
163
The kubectl command reference documentation is automatically generated from
158
164
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
178
184
[ PR 56673] ( https://github.com/kubernetes/kubernetes/pull/56673/files ) 是一个对 kubectl
179
185
源码中的笔误进行修复的 PR 示例。
180
186
181
- 跟踪你的 PR,并回应评审人的评论。继续跟踪你的 PR,直到它合入到 kubernetes/kubernetes 仓库的目标分支中。
187
+ 跟踪你的 PR,并回应评审人的评论。继续跟踪你的 PR,直到它合入到
188
+ kubernetes/kubernetes 仓库的目标分支中。
182
189
183
190
<!--
184
- ## Cherry picking your change into a release branch
191
+ ## Cherry pick your change into a release branch
185
192
186
193
Your change is now in the master branch, which is used for development of the next
187
194
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.
195
202
cherry-pick 方式合入已发布分支。
196
203
197
204
<!--
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 >}}
200
206
and you want to backport your change to the release-{{< skew prevMinorVersion >}} branch. For instructions
201
207
on how to do this, see
202
208
[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.
223
229
{{< /note >}}
224
230
225
231
<!--
226
- ## Setting build variables
232
+ ## Set build variables
227
233
228
234
Go to `<rdocs-base>`, and open the `Makefile` for editing:
229
235
-->
@@ -235,7 +241,8 @@ Go to `<rdocs-base>`, and open the `Makefile` for editing:
235
241
* Set `K8S_ROOT` to `<k8s-base>`.
236
242
* Set `K8S_WEBROOT` to `<web-base>`.
237
243
* 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 >}}.
239
246
240
247
For example, update the following variables:
241
248
-->
@@ -280,12 +287,12 @@ make createversiondirs
280
287
```
281
288
282
289
<!--
283
- ## Checking out a branch in k8s.io/kubernetes
290
+ ## Check out a branch in k8s.io/kubernetes
284
291
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
286
293
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.
289
296
-->
290
297
## 从 kubernetes/kubernetes 检出一个分支
291
298
@@ -301,7 +308,7 @@ git pull https://github.com/kubernetes/kubernetes v{{< skew prevMinorVersion >}}
301
308
```
302
309
303
310
<!--
304
- ## Running the doc generation code
311
+ ## Run the doc generation code
305
312
306
313
In your local kubernetes-incubator/reference-docs repository, build and run the
307
314
kubectl command reference generation code. You might need to run the command as root:
@@ -319,8 +326,8 @@ make copycli
319
326
The `copycli` command will clean the staging directories, generate the kubectl command files,
320
327
and copy the collated kubectl reference HTML page and assets to `<web-base>`.
321
328
-->
322
- ` copycli ` 命令将清理暂存目录,生成 kubectl 命令文件,并将整理后的 kubectl 参考 HTML 页面和
323
- 文件复制到 ` <web-base> ` 。
329
+ ` copycli ` 命令将清理暂存目录,生成 kubectl 命令文件,并将整理后的 kubectl
330
+ 参考 HTML 页面和文件复制到 ` <web-base> ` 。
324
331
325
332
<!--
326
333
## Locate the generated files
@@ -350,16 +357,19 @@ cd <web-base>
350
357
git status
351
358
```
352
359
353
- <!-- The output should include the modified files: -->
360
+ <!--
361
+ The output should include the modified files:
362
+ -->
354
363
输出应包括修改后的文件:
355
364
356
365
```
357
366
static/docs/reference/generated/kubectl/kubectl-commands.html
358
367
static/docs/reference/generated/kubectl/navData.js
359
368
```
360
369
361
- <!-- Additionally, the output might show the modified files: -->
362
-
370
+ <!--
371
+ Additionally, the output might show the modified files:
372
+ -->
363
373
此外,输出可能还包含:
364
374
365
375
```
@@ -382,17 +392,22 @@ Build the Kubernetes documentation in your local `<web-base>`.
382
392
383
393
在本地 ` <web-base> ` 中构建 Kubernetes 文档。
384
394
395
+ <!--
396
+ # if not already done
397
+ -->
385
398
``` shell
386
399
cd < web-base>
387
- git submodule update --init --recursive --depth 1 # if not already done
400
+ git submodule update --init --recursive --depth 1 # 如果还没完成
388
401
make container-serve
389
402
```
390
403
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
+ -->
392
407
查看[ 本地预览] ( https://localhost:1313/docs/reference/generated/kubectl/kubectl-commands/ ) 。
393
408
394
409
<!--
395
- ## Adding and committing changes in kubernetes/website
410
+ ## Add and commit changes in kubernetes/website
396
411
397
412
Run `git add` and `git commit` to commit the files.
398
413
-->
@@ -401,15 +416,14 @@ Run `git add` and `git commit` to commit the files.
401
416
运行 ` git add ` 和 ` git commit ` 提交修改文件。
402
417
403
418
<!--
404
- ## Creating a pull request
419
+ ## Create a pull request
405
420
406
421
Create a pull request to the `kubernetes/website` repository. Monitor your
407
422
pull request, and respond to review comments as needed. Continue to monitor
408
423
your pull request until it is merged.
409
424
410
425
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).
413
427
-->
414
428
## 创建 PR
415
429
@@ -428,4 +442,3 @@ topics will be visible in the
428
442
* [ 生成参考文档快速入门] ( /zh-cn/docs/contribute/generate-ref-docs/quickstart/ )
429
443
* [ 为 Kubernetes 组件和工具生成参考文档] ( /zh-cn/docs/contribute/generate-ref-docs/kubernetes-components/ )
430
444
* [ 为 Kubernetes API 生成参考文档] ( /zh-cn/docs/contribute/generate-ref-docs/kubernetes-api/ )
431
-
0 commit comments