added support for multiple kubernetes openapi schemas

This commit is contained in:
Natasha Sarkar
2020-11-11 18:08:46 -08:00
parent 66221d17d4
commit b61a115e76
19 changed files with 360029 additions and 380 deletions

View File

@@ -1,35 +1,57 @@
# Sampling New OpenAPI Data
[OpenAPI schema]: ./kubernetesapi/swagger.json
[OpenAPI schema]: ./kubernetesapi/
[kind clusters]: https://hub.docker.com/r/kindest/node/tags
This document describes how to fetch OpenAPI data from
a particular kubernetes version number.
a particular kubernetes version number. Note that you can
only fetch data from versions supported by [kind clusters].
### Fetching the Schema
### Delete all currently built-in schema
```
make nuke
```
In this directory, fetch the openapi schema for the kubernetes api:
### Add a new built-in schema
In this directory, fetch the openapi schema and generate the
corresponding swagger.go for the kubernetes api:
```
make kubernetesapi/swagger.go
```
To fetch the schema without generating the swagger.go, you can
run:
```
make nuke
make kubernetesapi/swagger.json
```
Note that generating the swagger.go will re-fetch the schema.
You can specify a specific version with the "API_VERSION"
parameter. The default version is v1.19.1. Here is an
example for fetching the data for v1.14.1.
example for generating swagger.go for v1.14.1.
```
make kubernetesapi/swagger.json API_VERSION=v1.14.1
make kubernetesapi/swagger.go API_VERSION=v1.14.1
```
This will update the [OpenAPI schema].
This will update the [OpenAPI schema]. The above command will
create a directory kubernetesapi/v1141 and store the resulting
swagger.json and swagger.go files there.
### Generating Swagger.go
### Make the schema available for use
In this directory, generate the swagger.go files.
While the above commands generate the swagger.go files, they
do not make them available for use nor do they update the
info field reported by `kustomize openapi info`. To make the
newly fetched schema and swagger.go available:
```
make
make kubernetesapi/openapiinfo.go
```
### Run all tests