@@ -12,24 +12,24 @@ weight: 50
12
12
<!-- overview -->
13
13
14
14
<!--
15
- This page shows how to update the generated reference docs for the Kubernetes API.
15
+ This page shows how to update the Kubernetes API reference documentation .
16
16
17
17
The Kubernetes API reference documentation is built from the
18
18
[Kubernetes OpenAPI spec](https://github.com/kubernetes/kubernetes/blob/master/api/openapi-spec/swagger.json)
19
- and tools from [kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs).
19
+ using the [kubernetes-sigs/reference-docs](https://github.com/kubernetes-sigs/reference-docs) generation code .
20
20
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
24
If you need only to regenerate the reference documentation from the [OpenAPI](https://github.com/OAI/OpenAPI-Specification)
25
25
spec, continue reading this page.
26
26
-->
27
- 本页面展示了如何为 Kubernetes API 更新自动生成的参考文档 。
27
+ 本页面显示了如何更新 Kubernetes API 参考文档 。
28
28
29
29
Kubernetes API 参考文档是从
30
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
+ 构建的,
32
+ 且使用 [ kubernetes-sigs/reference-docs] ( https://github.com/kubernetes-sigs/reference-docs ) 生成代码 。
33
33
34
34
如果您在生成的文档中发现错误,则需要[ 在上游修复] ( /zh/docs/contribute/generate-ref-docs/contribute-upstream/ ) 。
35
35
@@ -55,23 +55,30 @@ mkdir -p $HOME/<workspace>
55
55
export GOPATH=$HOME /< workspace>
56
56
```
57
57
58
- <!-- Get a local clone of the following repositories: -->
58
+ <!--
59
+ Get a local clone of the following repositories:
60
+ -->
59
61
获取以下仓库的本地克隆:
60
62
61
63
``` shell
62
- go get -u github.com/kubernetes-incubator/reference-docs
64
+ go get -u github.com/kubernetes-sigs/reference-docs
65
+
63
66
go get -u github.com/go-openapi/loads
64
67
go get -u github.com/go-openapi/spec
65
68
```
66
69
67
- <!-- If you don't already have the kubernetes/website repository, get it now: -->
70
+ <!--
71
+ If you don't already have the kubernetes/website repository, get it now:
72
+ -->
68
73
如果你还没有下载过 ` kubernetes/website ` 仓库,现在下载:
69
74
70
75
``` shell
71
76
git clone https://github.com/< your-username> /website $GOPATH /src/github.com/< your-username> /website
72
77
```
73
78
74
- <!-- Get a clone of the kubernetes/kubernetes repository as k8s.io/kubernetes: -->
79
+ <!--
80
+ Get a clone of the kubernetes/kubernetes repository as k8s.io/kubernetes:
81
+ -->
75
82
克隆 kubernetes/kubernetes 仓库作为 k8s.io/kubernetes:
76
83
77
84
``` shell
@@ -90,16 +97,16 @@ The remaining steps refer to your base directory as `<k8s-base>`.
90
97
The remaining steps refer to your base directory as `<web-base>`.
91
98
92
99
* The base directory of your clone of the
93
- [kubernetes-incubator /reference-docs](https://github.com/kubernetes-incubator /reference-docs)
94
- repository is `$GOPATH/src/github.com/kubernetes-incubator /reference-docs.`
100
+ [kubernetes-sigs /reference-docs](https://github.com/kubernetes-sigs /reference-docs)
101
+ repository is `$GOPATH/src/github.com/kubernetes-sigs /reference-docs.`
95
102
The remaining steps refer to your base directory as `<rdocs-base>`.
96
103
-->
97
104
* [ kubernetes/kubernetes] ( https://github.com/kubernetes/kubernetes ) 仓库克隆后的根目录为
98
105
` $GOPATH/src/k8s.io/kubernetes ` 。 后续步骤将此目录称为 ` <k8s-base> ` 。
99
106
* [ kubernetes/website] ( https://github.com/kubernetes/website ) 仓库克隆后的根目录为
100
107
` $GOPATH/src/github.com/<your username>/website ` 。后续步骤将此目录称为 ` <web-base> ` 。
101
108
* [ kubernetes-sigs/reference-docs] ( https://github.com/kubernetes-sigs/reference-docs )
102
- 仓库克隆后的基本目录为 ` $GOPATH/src/github.com/kubernetes-sigs/reference-docs ` 。
109
+ 仓库克隆后的基本目录为 ` $GOPATH/src/github.com/kubernetes-sigs/reference-docs. ` 。
103
110
后续步骤将此目录称为 ` <rdocs-base> ` 。
104
111
105
112
<!--
@@ -122,21 +129,23 @@ Go to `<rdocs-base>`, and open the `Makefile` for editing:
122
129
<!--
123
130
* Set `K8S_ROOT` to `<k8s-base>`.
124
131
* Set `K8S_WEBROOT` to `<web-base>`.
125
- * Set `K8S_RELEASE` to the minor version of the docs you want to build.
126
- For example, if you want to build docs for Kubernetes 1.17, set `K8S_RELEASE` to 1.17.
132
+ * Set `K8S_RELEASE` to the version of the docs you want to build.
133
+ For example, if you want to build docs for Kubernetes 1.17.0 , set `K8S_RELEASE` to 1.17.0 .
127
134
-->
128
135
* 设置 ` K8S_ROOT ` 为 ` <k8s-base> ` .
129
136
* 设置 ` K8S_WEBROOT ` 为 ` <web-base> ` .
130
137
* 设置 ` K8S_RELEASE ` 为要构建的文档的版本。
131
- 例如,如果您想为 Kubernetes 1.17 构建文档,请将 ` K8S_RELEASE ` 设置为 1.17。
138
+ 例如,如果您想为 Kubernetes 1.17.0 构建文档,请将 ` K8S_RELEASE ` 设置为 1.17.0 。
132
139
133
- <!-- For example, update the following variables: -->
140
+ <!--
141
+ For example:
142
+ -->
134
143
例如:
135
144
136
- ```
145
+ ``` shell
137
146
export K8S_WEBROOT=$( GOPATH) /src/github.com/< your-username> /website
138
147
export K8S_ROOT=$( GOPATH) /src/k8s.io/kubernetes
139
- export K8S_RELEASE=1.17
148
+ export K8S_RELEASE=1.17.0
140
149
```
141
150
142
151
<!--
@@ -156,9 +165,9 @@ The versioned directory name follows the pattern of `v<major>_<minor>`.
156
165
版本化目录的名称形式为 ` v<major>_<minor> ` 。
157
166
158
167
<!--
159
- In the ' <rdocs-base>' directory, run the following build target:
168
+ In the ` <rdocs-base>` directory, run the following build target:
160
169
-->
161
- 在 ' <rdocs-base >' 目录中,运行以下命令来构建:
170
+ 在 ` <rdocs-base> ` 目录中,运行以下命令来构建:
162
171
163
172
``` shell
164
173
cd < rdocs-base>
@@ -184,12 +193,14 @@ cd <rdocs-base>
184
193
make copyapi
185
194
```
186
195
187
- <!-- Verify that these two files have been generated: -->
196
+ <!--
197
+ Verify that these two files have been generated:
198
+ -->
188
199
验证是否已生成这两个文件:
189
200
190
201
``` shell
191
- [ -e " <rdocs-base>/gen-apidocs/generators/ build/index.html" ] && echo " index.html built" || echo " no index.html"
192
- [ -e " <rdocs-base>/gen-apidocs/generators/ build/navData.js" ] && echo " navData.js built" || echo " no navData.js"
202
+ [ -e " <rdocs-base>/gen-apidocs/build/index.html" ] && echo " index.html built" || echo " no index.html"
203
+ [ -e " <rdocs-base>/gen-apidocs/build/navData.js" ] && echo " navData.js built" || echo " no navData.js"
193
204
```
194
205
195
206
<!--
@@ -203,7 +214,9 @@ cd <web-base>
203
214
git status
204
215
```
205
216
206
- <!-- The output is similar to: -->
217
+ <!--
218
+ The output is similar to:
219
+ -->
207
220
输出类似于:
208
221
209
222
```
0 commit comments