cozyvalues-gen

command module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

README

cozyvalues-gen

Tiny helper that turns comment-annotated values.yaml files into:

  1. Go structs – strongly typed, IDE-friendly.
  2. CustomResourceDefinitions (CRD) – produced by controller-gen.
  3. values.schema.json – OpenAPI schema extracted from the CRD.
  4. README.md – auto-updated ## Parameters section.

The chain “structs → CRD → OpenAPI” re-uses the same code that Kubernetes itself relies on, so you get maximum type compatibility for free.


How it works

graph LR
    A[values.yaml] --> B(Go structs)
    B --> C[CRD YAML]
    C --> D[values.schema.json]
    A --> E[README.md]
  • Annotate your values.yaml (see examples for the exact syntax).
  • Run cozyvalues-gen; it parses the comments and spits out Go code.
  • controller-gen compiles that code, emitting a CRD.
  • The tool trims the CRD down to a Helm-compatible schema.

Usage (one-liner)

cozyvalues-gen \
  --values values.yaml \
  --schema values.schema.json

See cozyvalues-gen -h for all flags.

Created for the Cozystack project. 🚀

Documentation

Overview

values-gen: Generate Go structs, CRDs and Helm-compatible JSON Schemas

from “## @param / @field” comments inside a values.yaml file.

Controller-gen ≥ v0.16 is required for CRD generation.

Directories

Path Synopsis
internal
readme
internal/readme/readme.go
internal/readme/readme.go

Jump to

Keyboard shortcuts

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