Skip to content

Commit df7d5b9

Browse files
committed
Continue with Kubernetes API
1 parent dce2e0c commit df7d5b9

File tree

1 file changed

+100
-10
lines changed

1 file changed

+100
-10
lines changed

docs/home/contribute/generated-reference/kubernetes-api.md

+100-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Generating Reference Documentation for the Kubernetes API
44

55
{% capture overview %}
66

7-
This page shows how to automatically generate reference documentation for the
7+
This page shows how to automatically generate reference pages for the
88
Kubernetes API.
99

1010
{% endcapture %}
@@ -20,12 +20,15 @@ installed.
2020
[Golang](https://golang.org/doc/install) version 1.8 or later installed,
2121
and your `$GOPATH` environment variable must be set.
2222

23+
* You need to have
24+
[Docker](https://docs.docker.com/engine/installation/) installed.
25+
2326
{% endcapture %}
2427

2528

2629
{% capture steps %}
2730

28-
## Runnig the code generator
31+
## Getting the source code
2932

3033
If you don't already have the Kubernetes source code, get it now:
3134

@@ -38,25 +41,112 @@ go get github.com/kubernetes/kubernetes
3841
Determine the base directory of your clone of the
3942
[kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository.
4043
For example, if you followed the preceding step to get the Kubernetes source
41-
code, you base directory is `$GOPATH/src/github.com/kubernetes/kubernetes.`
44+
code, your base directory is `$GOPATH/src/github.com/kubernetes/kubernetes.`
4245
The remaining steps refer to your base directory as `<k8s-base>`.
4346

44-
If you don't already have ...
47+
Determine the name of your Git remote that is associated with
48+
[https://github.com/kubernetes/kubernetes](https://github.com/kubernetes/kubernetes).
49+
50+
```shell
51+
cd <k8s-base>
52+
git remote -v
53+
```
54+
55+
The output shows the names and URLs of your remotes. Typical names are `origin`
56+
and `upstream`.
57+
58+
```shell
59+
origin https://github.com/kubernetes-incubator/reference-docs (fetch)
60+
origin https://github.com/kubernetes-incubator/reference-docs (push)
61+
```
62+
63+
Check out the branch of interest, and make sure it is up to date. For example,
64+
suppose you want to generate docs for Kubernetes 1.8, and your remote is named `origin`.
65+
Then you could use these commands:
66+
67+
```shell
68+
cd <k8s-base>
69+
git checkout release-1.8
70+
git pull origin release-1.8
71+
```
72+
73+
If you don't already have the code at
74+
[kubernetes-incubator/reference-docs](https://github.com/kubernetes-incubator/reference-docs)
75+
repository, get it now:
4576

4677
```shell
47-
TODO
78+
cd $GOPATH/src
79+
go get github.com/kubernetes-incubator/reference-docs
4880
```
4981

50-
TODO
82+
Determine the base directory of your clone of the
83+
[kubernetes-incubator/reference-docs](https://github.com/kubernetes-incubator/reference-docs) repository.
84+
For example, if you followed the preceding step to get the reference-docs source
85+
code, your base directory is `$GOPATH/src/github.com/kubernetes-incubator/reference-docs.`
86+
The remaining steps refer to your base directory as `<rdocs-base>`.
87+
88+
## Editing Makefile
89+
90+
Go to `<rdocs-base>`, and open `Makefile` for editing:
91+
92+
Change the value of `K8SROOT` to the base directory of your clone of the kubernetes/kubernetes
93+
repository. Set `MINOR_VERSION` to the minor version of the docs you want to build. For example,
94+
if you want to build docs for Kubernetes 1.8, set `MINOR_VERSION` to 8. Save and close Makefile.
95+
96+
## Building the brodocs image
97+
98+
The doc generation code requires the `pwittrock/brodocs` Docker image.
99+
100+
This command creates the `pwittrock/brodocs` Docker image. It also tries to push the image to
101+
DockerHub, but it's OK if that step fails. As long as you have the image locally, the code generation
102+
can succeed.
103+
104+
105+
```shell
106+
make brodocs
107+
```
108+
109+
Verify that you have the brodocs image:
110+
111+
```shell
112+
docker images
113+
```
114+
115+
The output shows `pwittrock/brodocs` as one of the available images:
116+
117+
```shell
118+
REPOSITORY TAG IMAGE ID CREATED SIZE
119+
pwittrock/brodocs latest 999d34a50d56 5 weeks ago 714MB
120+
```
121+
122+
## Running the doc generation code
123+
124+
Build and run the doc generation code. You might need to run these commands as root:
125+
126+
```shell
127+
cd <rdocs-base>
128+
make api
129+
```
130+
131+
## Locate the generated files
132+
133+
These two files are the output of a successful build. Verify that they exist:
134+
135+
* `<rdocs-base>/gen-apidocs/generators/build/index.html`
136+
* `<rdocs-base>/gen-apidocs/generators/build/navData.js`
137+
138+
The generated files do not get published automatically. They have to be manually copied to the
139+
[kubernetes/website](https://github.com/kubernetes/website/tree/master/docs/reference/generated)
140+
repository.
51141

52142
{% endcapture %}
53143

54144
{% capture whatsnext %}
55145

56-
[Generating Reference Docs for Kubernetes Components and Tools]()
57-
[Generating the Kubernetes API Reference Docs]()
58-
[Generating Kubernetes Federation Reference Pages]()
59-
[Generating the Kubernetes Federation API Reference Docs]()
146+
* [Generating Reference Docs for Kubernetes Components and Tools](/docs/home/contribute/generated-reference/kubernetes-components/)
147+
* [Generating Reference Documentation for the Kubernetes API](/docs/home/contribute/generated-reference/kubernetes-api/)
148+
* [Generating Reference Docs for Kubernetes Federation](/docs/home/contribute/generated-reference/federation-components/)
149+
* [Generating Reference Documentaion for the Kubernetes Federation API](/docs/home/contribute/generated-reference/federation-api/)
60150

61151
{% endcapture %}
62152

0 commit comments

Comments
 (0)