This repository exists to collect OpenAPI schemas from our OpenShift/Kubernetes clusters, patching them if required so that Kustomize can appropriate apply strategic merge patches to lists. We use automated tooling to generate extract individual resource schemas into the schemas/
directory, and then a top level kustomization.yaml
file applies patches. The final output is processed with yq
to generate a valid OpenAPI document.
You will need a recent Python, the click
package, and yq
(this one, not that one).
To update this repository with schemas from your currently cluster:
./refresh-schemas.sh
This will:
- Fetch OpenAPI schemas from the remote cluster (using
./schemautil fetch
) - Split the schema definitions into individual files under the
schemas
directory (using./schemautil split
) - Re-generate
schemas/kustomization.yaml
(using./schemautil kustomize
)
At this point, you need to add new schemas to the repository. If you only want new schemas (that is, you want to ignore any modifications to existing schemas), you can do something like this:
git checkout schemas/*/*.json
git add schemas
git commit ...
To generate the final openshift-api-schema.json
document, run:
make