-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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 #23809
Comments
Great to see this work starting @feloy! |
Another site that might be useful for inspiration: https://k8syaml.com/ That's a reference for manifests, not the API. |
This comment has been minimized.
This comment has been minimized.
I have created this generic As an example, a script using this CLI filters the complete Kubernetes API definition to output new swagger definitions for each K8s API Group: https://github.com/feloy/swagger-filter I would like to be able to include the files generated by this CLI into the kubernetes/website repository, so we can reference these files from One solution I can imagine is to create a public external service (hosted in a Cloud Run container for example) based on this code, that could be queried from a script in the |
Thanks @feloy for opening this issue. I will review the swagger-filter code. |
Hi @feloy . I quickly looked at the filter code. Will review in detail. Some initial questions:
|
Hi @kbhawkey,
I will need to dive into the API server code before to reply, but I can imagine it could be possible, in a similar way it is possible to start the API server with specific groups only, with the
You are right, the I wanted to make a generic filter, reusable for any OpenAPI spec, not coupled to the Kubernetes API spec. If we use such a method, it will become a dedicated tool for the API spec. |
OK. I'd avoid manually creating and maintaining a list of API groups.
OK. Seems reasonable. You have created a new command line tool based off the spf13/cobra code to parse the complete spec and generate individual or groups of openAPI files (or snippets?). |
@feloy, how do you think the Swagger approach is working out? For example: details of everything that can go in YAML manifests vs. the JSON or protobuf on-the-wire representation vs. Golang source code. |
@sftim I think the documentation reader first needs an help to write YAMLs manifests for the moment. In a more or less near future, when the writing of Operators and Cloud Native apps is democratized, an help for writing the Go structures rpresenting the K8s resources would be helpful. I'm not very satisfied with the actual presentation of the swagger-ui documentation for the following reasons:
|
Building the page as Markdown sounds more viable. Are you thinking of proposing a change to https://github.com/kubernetes-sigs/reference-docs ? |
Yes, as this generator uses an interface for the writer, it would be interesting to try and implement a writer for Markdown pages |
More on Markdown output at kubernetes-sigs/reference-docs#173 |
/kind feature |
I've logged #25505 specifically to track the work to do with migrating from the existing generator (and the pages in generates) to the new one. |
@feloy are you happy to close this issue? |
/close Remaining work is in #25505 |
This issue helps following my Google Season of Docs project: https://developers.google.com/season-of-docs/docs/participants/project-cncf-feloy and resumes the first discussions in #23294 and this doc.
Introduction
Currently, the Kubernetes API references are large HTML documents generated from Swagger specs by scripts hosted outside the website repository, then added into this website repository.
On another side, the Kubernetes documentation website is built with Hugo from documentation written in Markdown format in the website repository, using the Docsy Hugo theme.
The goal of this project is to integrate the generation of the Kubernetes API references into the process that builds the documentation website.
swaggerui
Specifically, we will focus on the swaggerui shortcode, wrapper around swagger-ui, provided by the Docsy Hugo theme and on specific tooling, enabling the insertion of parts of the API specification in the flow of the Kubernetes documentation.
The actual generation of the API Reference has some drawbacks:
With this project, we will try to address some of these drawbacks:
Some drawbacks won't be addressed by the proposed solution:
Splitting the API Specs
Specific tooling will be needed as swagger-ui is able to output the complete specification described in a swagger file, but not parts of it. The Kubernetes API is too big to be displayed in one part only.
We will use or create a tool that gets as input the complete swagger file of the Kubernetes API found here and that outputs a new swagger file for a specific endpoint or a limited number of endpoints, and its associated resources and definitions, then use these swagger files as input of swaggerui shortcodes at specific places in the Kubernetes documentation website.
Interactivity
There are "Authorize"/"Try it out" features that come default with most Swagger renderings. Kubernetes is usually deployed "on prem", i.e. by and for a specific team, rather than being an API available to anyone with auth access. Maintaining a k8s deployment for people to 'try it out' on could also pose security risks.
We will first disable these features, and consider to make a version distribuable to end-users to install locally and to use interactively on their own cluster.
Classification
The Kubernetes API contains several dozens of Resources and several hundreds of endpoints.
We want to first classify the endpoints grouped by Kubernetes Resources (Pods, Deployments, etc), and also classify the Resources. Two classifications come to mind for the Resources:
concepts
section (Container, Workloads, Services, Storage, Configuration, Security, Policies, Scheduling, Cluster, Extending)In the first case, the whole set of reference pages would be regrouped in a specific section (the
reference
section itself).In the second case, the reference pages would be placed at the end of each corresponding sub-section in the
concepts
section.Landing Page
We will work on a landing page that points to all the reference pages of the specification. Also, this page will make clear if translations exist for some pages.
Generation
As the sources of the specifications reside in other repositories than the sources of the documentation, we will need to find a way to automatically update them in the documentation repository when they change.
I18n
As the Kubernetes documentation is available in different languages, we will pay special attention to the possibility of publishing translations for the Kubernetes API reference.
kubernetes-resource-reference
It turned out to be difficult to customize the page generated by swagger UI to highlight the Resources of the API instead of the Endpoints, as it is done traditionally. We want to highlight the Resources because users are currently writing K8s manifests based on the Resources, and are not calling HTTP endpoints directly but are essentially using kubectl to call the API.
For this reason, we decided to experiment the integration of the pages generated by the tool https://github.com/feloy/kubernetes-resources-reference that I created lastly to create the website k8sref.io.
Here the list of features implemented by this tool:
The text was updated successfully, but these errors were encountered: