@@ -4,7 +4,7 @@ title: Generating Reference Documentation for the Kubernetes API
4
4
5
5
{% capture overview %}
6
6
7
- This page shows how to automatically generate reference documentation for the
7
+ This page shows how to automatically generate reference pages for the
8
8
Kubernetes API.
9
9
10
10
{% endcapture %}
@@ -20,12 +20,15 @@ installed.
20
20
[ Golang] ( https://golang.org/doc/install ) version 1.8 or later installed,
21
21
and your ` $GOPATH ` environment variable must be set.
22
22
23
+ * You need to have
24
+ [ Docker] ( https://docs.docker.com/engine/installation/ ) installed.
25
+
23
26
{% endcapture %}
24
27
25
28
26
29
{% capture steps %}
27
30
28
- ## Runnig the code generator
31
+ ## Getting the source code
29
32
30
33
If you don't already have the Kubernetes source code, get it now:
31
34
@@ -38,25 +41,112 @@ go get github.com/kubernetes/kubernetes
38
41
Determine the base directory of your clone of the
39
42
[ kubernetes/kubernetes] ( https://github.com/kubernetes/kubernetes ) repository.
40
43
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. `
42
45
The remaining steps refer to your base directory as ` <k8s-base> ` .
43
46
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:
45
76
46
77
``` shell
47
- TODO
78
+ cd $GOPATH /src
79
+ go get github.com/kubernetes-incubator/reference-docs
48
80
```
49
81
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.
51
141
52
142
{% endcapture %}
53
143
54
144
{% capture whatsnext %}
55
145
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/ )
60
150
61
151
{% endcapture %}
62
152
0 commit comments