Skip to content

Commit 1210760

Browse files
authored
updating contrib for ref docs (kubernetes#18787)
more cleanup
1 parent 79e1b94 commit 1210760

File tree

8 files changed

+424
-376
lines changed

8 files changed

+424
-376
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
2-
title: Reference docs overview
2+
title: Reference Docs Overview
33
main_menu: true
44
weight: 80
55
---
66

7-
Much of the Kubernetes reference documentation is generated from Kubernetes
8-
source code, using scripts. The topics in this section document how to generate
9-
this type of content.
7+
The topics in this section document how to generate the Kubernetes
8+
reference guides.
9+
10+
To build the reference documentation, see the following guide:
11+
12+
* [Generating Reference Documentation Quickstart](/docs/contribute/generate-ref-docs/quickstart/)

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

+18-22
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
title: Contributing to the Upstream Kubernetes Code
33
content_template: templates/task
4+
weight: 20
45
---
56

67
{{% capture overview %}}
78

8-
This page shows how to contribute to the upstream kubernetes/kubernetes project
9-
to fix bugs found in the Kubernetes API documentation or the `kube-*`
10-
components such as `kube-apiserver`, `kube-controller-manager`, etc.
9+
This page shows how to contribute to the upstream `kubernetes/kubernetes` project.
10+
You can fix bugs found in the Kubernetes API documentation or the content of
11+
the Kubernetes components such as `kubeadm`, `kube-apiserver`, and `kube-controller-manager`.
1112

1213
If you instead want to regenerate the reference documentation for the Kubernetes
1314
API or the `kube-*` components from the upstream code, see the following instructions:
@@ -17,28 +18,25 @@ API or the `kube-*` components from the upstream code, see the following instruc
1718

1819
{{% /capture %}}
1920

20-
2121
{{% capture prerequisites %}}
2222

23-
You need to have these tools installed:
23+
- You need to have these tools installed:
2424

25-
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
26-
* [Golang](https://golang.org/doc/install) version 1.9.1 or later
27-
* [Docker](https://docs.docker.com/engine/installation/)
28-
* [etcd](https://github.com/coreos/etcd/)
25+
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
26+
- [Golang](https://golang.org/doc/install) version 1.13+
27+
- [Docker](https://docs.docker.com/engine/installation/)
28+
- [etcd](https://github.com/coreos/etcd/)
2929

30-
Your $GOPATH environment variable must be set, and the location of `etcd`
31-
must be in your $PATH environment variable.
30+
- Your `GOPATH` environment variable must be set, and the location of `etcd`
31+
must be in your `PATH` environment variable.
3232

33-
You need to know how to create a pull request to a GitHub repository.
34-
Typically, this involves creating a fork of the repository. For more
35-
information, see
36-
[Creating a Pull Request](https://help.github.com/articles/creating-a-pull-request/) and
37-
[GitHub Standard Fork & Pull Request Workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962).
33+
- You need to know how to create a pull request to a GitHub repository.
34+
Typically, this involves creating a fork of the repository.
35+
For more information, see [Creating a Pull Request](https://help.github.com/articles/creating-a-pull-request/)
36+
and [GitHub Standard Fork & Pull Request Workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962).
3837

3938
{{% /capture %}}
4039

41-
4240
{{% capture steps %}}
4341

4442
## The big picture
@@ -221,11 +219,10 @@ the same as the generated files in the master branch. The generated files in the
221219
contain API elements only from Kubernetes 1.9. The generated files in the master branch might contain
222220
API elements that are not in 1.9, but are under development for 1.10.
223221

224-
225222
## Generating the published reference docs
226223

227224
The preceding section showed how to edit a source file and then generate
228-
several files, including `api/openapi-spec/swagger.json` in the
225+
several files, including `api/openapi-spec/swagger.json` in the
229226
`kubernetes/kubernetes` repository.
230227
The `swagger.json` file is the OpenAPI definition file to use for generating
231228
the API reference documentation.
@@ -238,8 +235,7 @@ You are now ready to follow the [Generating Reference Documentation for the Kube
238235
{{% capture whatsnext %}}
239236

240237
* [Generating Reference Documentation for the Kubernetes API](/docs/contribute/generate-ref-docs/kubernetes-api/)
241-
* [Generating Reference Docs for Kubernetes Components and Tools](/docs/home/contribute/generated-reference/kubernetes-components/)
242-
* [Generating Reference Documentation for kubectl Commands](/docs/home/contribute/generated-reference/kubectl/)
238+
* [Generating Reference Docs for Kubernetes Components and Tools](/docs/contribute/generate-ref-docs/kubernetes-components/)
239+
* [Generating Reference Documentation for kubectl Commands](/docs/contribute/generate-ref-docs/kubectl/)
243240

244241
{{% /capture %}}
245-

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

+39-62
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: Generating Reference Documentation for kubectl Commands
33
content_template: templates/task
4+
weight: 90
45
---
56

67
{{% capture overview %}}
78

8-
This page shows how to automatically generate reference pages for the
9-
commands provided by the `kubectl` tool.
9+
This page shows how to generate the `kubectl` command reference.
1010

1111
{{< note >}}
1212
This topic shows how to generate reference documentation for
@@ -23,29 +23,12 @@ reference page, see
2323

2424
{{% /capture %}}
2525

26-
2726
{{% capture prerequisites %}}
2827

29-
* You need to have
30-
[Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
31-
installed.
32-
33-
* You need to have
34-
[Golang](https://golang.org/doc/install) version 1.9.1 or later installed,
35-
and your `$GOPATH` environment variable must be set.
36-
37-
* You need to have
38-
[Docker](https://docs.docker.com/engine/installation/) installed.
39-
40-
* You need to know how to create a pull request to a GitHub repository.
41-
Typically, this involves creating a fork of the repository. For more
42-
information, see
43-
[Creating a Documentation Pull Request](/docs/home/contribute/create-pull-request/) and
44-
[GitHub Standard Fork & Pull Request Workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962).
28+
{{< include "prerequisites-ref-docs.md" >}}
4529

4630
{{% /capture %}}
4731

48-
4932
{{% capture steps %}}
5033

5134
## Setting up the local repositories
@@ -85,8 +68,7 @@ Remove the spf13 package from `$GOPATH/src/k8s.io/kubernetes/vendor/github.com`.
8568
rm -rf $GOPATH/src/k8s.io/kubernetes/vendor/github.com/spf13
8669
```
8770

88-
The kubernetes/kubernetes repository provides access to the kubectl and kustomize source code.
89-
71+
The kubernetes/kubernetes repository provides the `kubectl` and `kustomize` source code.
9072

9173
* Determine the base directory of your clone of the
9274
[kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository.
@@ -108,15 +90,16 @@ The remaining steps refer to your base directory as `<rdocs-base>`.
10890

10991
In your local k8s.io/kubernetes repository, check out the branch of interest,
11092
and make sure it is up to date. For example, if you want to generate docs for
111-
Kubernetes 1.15, you could use these commands:
93+
Kubernetes 1.17, you could use these commands:
11294

11395
```shell
11496
cd <k8s-base>
115-
git checkout release-1.15
116-
git pull https://github.com/kubernetes/kubernetes release-1.15
97+
git checkout v1.17.0
98+
git pull https://github.com/kubernetes/kubernetes v1.17.0
11799
```
118100

119-
If you do not need to edit the kubectl source code, follow the instructions to [Edit the Makefile](#editing-makefile).
101+
If you do not need to edit the `kubectl` source code, follow the instructions for
102+
[Setting build variables](#setting-build-variables).
120103

121104
## Editing the kubectl source code
122105

@@ -152,65 +135,60 @@ milestone in your pull request. If you don’t have those permissions, you will
152135
need to work with someone who can set the label and milestone for you.
153136
{{< /note >}}
154137

155-
## Editing Makefile
138+
## Setting build variables
156139

157-
Go to `<rdocs-base>`, and open the `Makefile` for editing:
140+
Go to `<rdocs-base>`. On you command line, set the following environment variables.
158141

159-
* Set `K8SROOT` to `<k8s-base>`.
160-
* Set `WEBROOT` to `<web-base>`.
161-
* Set `MINOR_VERSION` to the minor version of the docs you want to build. For example,
162-
if you want to build docs for Kubernetes 1.15, set `MINOR_VERSION` to 15. Save and close the `Makefile`.
142+
* Set `K8S_ROOT` to `<k8s-base>`.
143+
* Set `WEB_ROOT` to `<web-base>`.
144+
* Set `K8S_RELEASE` to the version of the docs you want to build.
145+
For example, if you want to build docs for Kubernetes 1.17, set `K8S_RELEASE` to 1.17.
163146

164-
For example, update the following variables:
147+
For example:
165148

166-
```
167-
WEBROOT=$(GOPATH)/src/github.com/<your-username>/website
168-
K8SROOT=$(GOPATH)/src/k8s.io/kubernetes
169-
MINOR_VERSION=15
149+
```shell
150+
export WEB_ROOT=$(GOPATH)/src/github.com/<your-username>/website
151+
export K8S_ROOT=$(GOPATH)/src/k8s.io/kubernetes
152+
export K8S_RELEASE=1.17
170153
```
171154

172-
## Creating a version directory
155+
## Creating a versioned directory
173156

174-
The version directory is a staging area for the kubectl command reference build.
175-
The YAML files in this directory are used to create the structure and navigation
176-
of the kubectl command reference.
157+
The `createversiondirs` build target creates a versioned directory
158+
and copies the kubectl reference configuration files to the versioned directory.
159+
The versioned directory name follows the pattern of `v<major>_<minor>`.
177160

178-
In the `<rdocs-base>/gen-kubectldocs/generators` directory, if you do not already
179-
have a directory named `v1_<MINOR_VERSION>`, create one now by copying the directory
180-
for the previous version. For example, suppose you want to generate docs for
181-
Kubernetes 1.15, but you don't already have a `v1_15` directory. Then you could
182-
create and populate a `v1_15` directory by running these commands:
161+
In the `<rdocs-base>` directory, run the following build target:
183162

184163
```shell
185-
mkdir gen-kubectldocs/generators/v1_15
186-
cp -r gen-kubectldocs/generators/v1_14/* gen-kubectldocs/generators/v1_15
164+
cd <rdocs-base>
165+
make createversiondirs
187166
```
188167

189-
## Checking out a branch in k8s.io/kubernetes
168+
## Checking out a release tag in k8s.io/kubernetes
190169

191-
In your local <k8s-base> repository, checkout the branch that has
170+
In your local `<k8s-base>` repository, checkout the branch that has
192171
the version of Kubernetes that you want to document. For example, if you want
193-
to generate docs for Kubernetes 1.15, checkout the release-1.15 branch. Make sure
172+
to generate docs for Kubernetes 1.17, checkout the `v1.17.0` tag. Make sure
194173
you local branch is up to date.
195174

196175
```shell
197176
cd <k8s-base>
198-
git checkout release-1.15
199-
git pull https://github.com/kubernetes/kubernetes release-1.15
177+
git checkout v1.17.0
178+
git pull https://github.com/kubernetes/kubernetes v1.17.0
200179
```
201180

202181
## Running the doc generation code
203182

204-
In your local kubernetes-sigs/reference-docs repository, build and run the
205-
kubectl command reference generation code. You might need to run the command as root:
183+
In your local `<rdocs-base>`, run the `copycli` build target. The command runs as `root`:
206184

207185
```shell
208186
cd <rdocs-base>
209187
make copycli
210188
```
211189

212-
The `copycli` command will clean the staging directories, generate the kubectl command files,
213-
and copy the collated kubectl reference HTML page and assets to `<web-base>`.
190+
The `copycli` command cleans the temporary build directory, generates the kubectl command files,
191+
and copies the collated kubectl command reference HTML page and assets to `<web-base>`.
214192

215193
## Locate the generated files
216194

@@ -237,7 +215,7 @@ static/docs/reference/generated/kubectl/kubectl-commands.html
237215
static/docs/reference/generated/kubectl/navData.js
238216
```
239217

240-
Additionally, the output might show the modified files:
218+
The output may also include:
241219

242220
```
243221
static/docs/reference/generated/kubectl/scroll.js
@@ -275,13 +253,12 @@ A few minutes after your pull request is merged, your updated reference
275253
topics will be visible in the
276254
[published documentation](/docs/home).
277255

278-
279256
{{% /capture %}}
280257

281258
{{% capture whatsnext %}}
282259

283-
* [Generating Reference Documentation for Kubernetes Components and Tools](/docs/home/contribute/generated-reference/kubernetes-components/)
284-
* [Generating Reference Documentation for the Kubernetes API](/docs/home/contribute/generated-reference/kubernetes-api/)
285-
* [Generating Reference Documentation for the Kubernetes Federation API](/docs/home/contribute/generated-reference/federation-api/)
260+
* [Generating Reference Documentation Quickstart](/docs/contribute/generate-ref-docs/quickstart/)
261+
* [Generating Reference Documentation for Kubernetes Components and Tools](/docs/contribute/generate-ref-docs/kubernetes-components/)
262+
* [Generating Reference Documentation for the Kubernetes API](/docs/contribute/generate-ref-docs/kubernetes-api/)
286263

287264
{{% /capture %}}

0 commit comments

Comments
 (0)