FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

hack/schema at main · knative/hack · GitHub

/ hack Public

Latest commit

 

History

History

README.md

Schema Tool

Warning

This module is now deprecated. Please, use k8s controller-gen instead. See, example: knative-extensions/sample-controller#931

Schema is a seed of a CLI tool that a downstream can use to use reflection and go file inspection to generate a base version of OpenAPI for a CRD. The resulting schema will be used by Kubernetes to provide results from kubectl explain <type> calls, and type validation.

Knative does not currently support full CRD generation via tools like controller-gen, this tool is to be used to support managing CRD manifests manually.

Integration steps

Demo

Register the type you wish to expose in the CLI,

registry.Register(&example.LoremIpsum{})

Run the schema dump command for the you wish to have schema for,

cd ./schema
go run ./ dump LoremIpsum | pbcopy

Paste this inside the CRD for LoremIpsum,

...
      schema:
        openAPIV3Schema:
          <**paste**>
      additionalPrinterColumns:
...

Downstream

Start with example.go, copy this into the downstream and modify which kinds are registered via registry.Register. You can register more than one kind at a time. (TODO: support versions in the CLI.)


Back | FazBrowse Home | New Git URL