fix: Add stdin support to kpt fn doc for KRM functions expecting input#4352
fix: Add stdin support to kpt fn doc for KRM functions expecting input#4352pmady wants to merge 1 commit intokptdev:mainfrom
Conversation
Some KRM functions fail with 'kpt fn doc' because they try to parse input from stdin even when --help flag is provided, resulting in the error: 'failed to parse input bytes: expected exactly one object, got 0' This fix provides an empty ResourceList as stdin when running containers with --help flag, allowing functions that expect input to work properly while still displaying help documentation. Changes: - Add -i and --stdin flags to docker run command - Provide empty ResourceList YAML structure as stdin - Prevents 'expected exactly one object' errors for functions like set-namespace, set-labels, etc. Fixes kptdev#4278 Signed-off-by: pmady <[email protected]>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @efiacor, thanks for the feedback! You raise a valid point. I considered both approaches: Option 1: Fix individual KRM functions (your suggestion)
Option 2: Fix in
I went with Option 2 because:
That said, I'm happy to close this PR if the team prefers fixing the individual functions instead. Let me know which approach you'd like to proceed with! |
Hey, |
Some KRM functions fail with 'kpt fn doc' because they try to parse input from stdin even when --help flag is provided, resulting in the error: 'failed to parse input bytes: expected exactly one object, got 0'
This fix provides an empty ResourceList as stdin when running containers with --help flag, allowing functions that expect input to work properly while still displaying help documentation.
Changes:
Fixes #4278