Skip to content

Tooling to create user-friendly reference documentation for Kubernetes Custom Resource Definitions (CRDs)

License

Notifications You must be signed in to change notification settings

egmar/crd-docs-generator

 
 

Repository files navigation

CircleCI Docker Repository on Quay

crd-docs-generator

Generates schema reference documentation for Kubernetes Custom Resource Definitions (CRDs).

This tool is built to generate our Management API CRD schema reference.

The generated output consists of Markdown files packed with HTML. By itself, this does not provide a fully readable and user-friendly set of documentation pages. Instead it relies on the HUGO website context, as the giantswarm/docs repository, to provide an index page and useful styling.

Assumptions/Prerequisites

This tool relies on:

  • CRDs being defined in public source repositories
  • Each CRD, identified by its full name, occurs only once
  • CRDs providing an OpenAPIv3 validation schema
    • either in the .spec.validation section of a CRD containg only one version
    • or in the .spec.versions[*].schema position of a CRD containing multiple versions
  • OpenAPIv3 schemas containing description attributes for every property.
  • The topmost description value explaining the CRD itself. (For a CRD containing multiple versions, the first description found is used as such.)
  • CR examples to be found in the apiextensions docs/cr folder as one example per YAML file.

Usage

The generator can be executed in Docker using a command like this:

docker run \
    -v $PWD/path/to/output-folder:/opt/crd-docs-generator/output \
    -v $PWD:/opt/crd-docs-generator/config \
    quay.io/giantswarm/crd-docs-generator \
      --config /opt/crd-docs-generator/config/config.example.yaml

or in Go like this:

go run main.go --config config.example.yaml

The volume mapping defines where the generated output will land.

TODO

  • Parse template only once instead of for every CRD

About

Tooling to create user-friendly reference documentation for Kubernetes Custom Resource Definitions (CRDs)

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 89.6%
  • Makefile 10.0%
  • Dockerfile 0.4%