Context
PR kptdev/krm-functions-sdk#752 adds fn.WithDocs to the SDK, enabling --help and --doc support via //go:embed. This issue tracks migrating all catalog functions to use it.
Parent issue: #4485
Already using fn.AsMain (just need fn.WithDocs added)
These 8 functions already use fn.AsMain — migration is adding //go:embed + fn.WithDocs and deleting generated/docs.go:
Still using kyaml/fn/framework + command.Build (full migration needed)
These functions need rewriting from framework.ResourceList to fn.ResourceList:
Simple (thin wrappers)
Medium
Complex
Migration steps per function
- Add
//go:embed README.md and //go:embed metadata.yaml
- Pass
fn.WithDocs(readme, metadata) to fn.AsMain
- Delete
generated/docs.go
- For legacy functions: rewrite from
framework.ResourceList to fn.ResourceList / fn.Runner
- Verify
kpt fn doc works: docker run --rm <image> --help
Done when
All catalog functions support --help and --doc via the SDK, and generated/docs.go files are removed.
Context
PR kptdev/krm-functions-sdk#752 adds
fn.WithDocsto the SDK, enabling--helpand--docsupport via//go:embed. This issue tracks migrating all catalog functions to use it.Parent issue: #4485
Already using fn.AsMain (just need fn.WithDocs added)
These 8 functions already use
fn.AsMain— migration is adding//go:embed+fn.WithDocsand deletinggenerated/docs.go:Still using kyaml/fn/framework + command.Build (full migration needed)
These functions need rewriting from
framework.ResourceListtofn.ResourceList:Simple (thin wrappers)
Medium
Complex
Migration steps per function
//go:embed README.mdand//go:embed metadata.yamlfn.WithDocs(readme, metadata)tofn.AsMaingenerated/docs.goframework.ResourceListtofn.ResourceList/fn.Runnerkpt fn docworks:docker run --rm <image> --helpDone when
All catalog functions support
--helpand--docvia the SDK, andgenerated/docs.gofiles are removed.