docgen

command
v0.0.0-...-bb91830 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: MIT Imports: 28 Imported by: 0

README

docgen

The docgen tool automatically:

  • Discovers all CRDs in the specified API directory via +kubebuilder:object:root=true markers
  • Auto-detects the group and version from the package's GroupVersion variable
  • Generates markdown documentation for each CRD that has a registered example function

Command Line Usage

go run cmd/docgen/docgen.go \
    --api-dir ./pkg/api/...      \  # Directory containing CRD type definitions
    --output-dir doc/output      \  # Output directory for generated docs
    --template-dir doc/templates \  # Directory containing templates
    --openapi-output ./schemas      # (Optional) Generate JSON schema

Directory Structure

Templates and output follow the directory structure <group>/<version>/<kind>/.

For example, the Postgres CRD (group data.nais.io, version v1) with the above flags uses:

  • Templates: doc/templates/data.nais.io/v1/postgres/
  • Output: doc/output/data.nais.io/v1/postgres/

Register example functions

Register the example function in ExampleRegistry in docgen.go:

var ExampleRegistry = map[schema.GroupVersionKind]func() object.NaisObject{
   {Group: "data.nais.io", Version: "v1", Kind: "Postgres"}: datav1.ExamplePostgresForDocumentation,
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL