-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GSoD'20] Update how the Kubernetes website serves API references #23294
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "themes/docsy"] | ||
path = themes/docsy | ||
url = https://github.com/google/docsy.git | ||
[submodule "api-ref-generator"] | ||
path = api-ref-generator | ||
url = https://github.com/kubernetes-sigs/reference-docs | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
# change is that the Hugo version is now an overridable argument rather than a fixed | ||
# environment variable. | ||
|
||
FROM alpine:latest | ||
FROM golang:1.15-alpine | ||
|
||
LABEL maintainer="Luc Perkins <[email protected]>" | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -59,6 +59,49 @@ make serve | |||||
|
||||||
This will start the local Hugo server on port 1313. Open up your browser to http://localhost:1313 to view the website. As you make changes to the source files, Hugo updates the website and forces a browser refresh. | ||||||
|
||||||
## Building the API reference pages | ||||||
|
||||||
The API reference pages located in `content/en/docs/reference/kubernetes-api` are built from the Swagger specification, using https://github.com/kubernetes-sigs/reference-docs/tree/master/gen-resourcesdocs. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: We should signpost readers to a page that describes prerequisites; for example, |
||||||
|
||||||
To update the reference pages for a new Kubernetes release (replace v1.20 in the following examples with the release to update to): | ||||||
|
||||||
1. Pull the `kubernetes-resources-reference` submodule: | ||||||
|
||||||
``` | ||||||
git submodule update --init --recursive --depth 1 | ||||||
``` | ||||||
|
||||||
2. Create a new API revision into the submodule, and add the Swagger specification: | ||||||
|
||||||
``` | ||||||
mkdir api-ref-generator/gen-resourcesdocs/api/v1.20 | ||||||
curl 'https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json' > api-ref-generator/gen-resourcesdocs/api/v1.20/swagger.json | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd run:
Suggested change
|
||||||
``` | ||||||
|
||||||
3. Copy the table of contents and fields configuration for the new release from a previous one: | ||||||
|
||||||
``` | ||||||
mkdir api-ref-generator/gen-resourcesdocs/api/v1.20 | ||||||
cp api-ref-generator/gen-resourcesdocs/api/v1.19/* api-ref-generator/gen-resourcesdocs/api/v1.20/ | ||||||
``` | ||||||
|
||||||
4. Adapt the files `toc.yaml` and `fields.yaml` to reflect the changes between the two releases | ||||||
|
||||||
5. Next, build the pages: | ||||||
|
||||||
``` | ||||||
make api-reference | ||||||
``` | ||||||
|
||||||
You can test the results locally by making and serving the site from a container image: | ||||||
|
||||||
``` | ||||||
make container-image | ||||||
make container-serve | ||||||
``` | ||||||
|
||||||
6. When all changes of the new contract are reflected into the configuration files `toc.yaml` and `fields.yaml`, create a Pull Request with the newly generated API reference pages. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Contract? I'm not sure this is the right English term.
Suggested change
? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this part needs clarification. Changes to the configuration files need to be created in |
||||||
|
||||||
## Troubleshooting | ||||||
### error: failed to transform resource: TOCSS: failed to transform "scss/main.scss" (text/x-scss): this feature is not available in your current Hugo version | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
--- | ||
title: API Reference | ||
title: "Kubernetes API" | ||
weight: 30 | ||
--- | ||
|
||
<!-- overview --> | ||
|
||
{{< glossary_definition prepend="Kubernetes' API is" term_id="kubernetes-api" length="all" >}} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
title: "Authentication Resources" | ||
weight: 4 | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we should update
README.md
to mention that there is more than one submodule