feat(set-labels): migrate to SDK v1.0.4 with WithDocs support#1258
Merged
Conversation
efiacor
requested review from
kispaljr,
liamfallon and
mozesl-nokia
as code owners
June 9, 2026 10:31
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the set-labels KRM function to SDK fn v1.0.4 and wires in embedded function documentation so the binary can serve --help (human docs) and --doc (kpt fn doc JSON) via the SDK’s WithDocs support.
Changes:
- Embed
README.mdandmetadata.yamlinto the Go binary and pass them viafn.WithDocs(...)tofn.AsMain. - Migrate
fn.WithContextusage to the newcontext.Context-based API. - Bump
github.com/kptdev/krm-functions-sdk/go/fnfromv1.0.3tov1.0.4.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| functions/go/set-labels/run.go | Embeds README/metadata and enables --help/--doc via fn.WithDocs; updates WithContext call signature. |
| functions/go/set-labels/run_js.go | Updates JS/WASM runner to new WithContext signature (now takes context.Context). |
| functions/go/set-labels/go.mod | Bumps SDK dependency to v1.0.4. |
| functions/go/set-labels/go.sum | Updates sums for SDK v1.0.4 and newly pulled transitive deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ Deploy Preview for krm-function-catalog canceled.
|
✅ Deploy Preview for krm-function-catalog canceled.
|
- Add //go:embed for README.md and metadata.yaml - Pass fn.WithDocs(readme, metadata) to fn.AsMain for --help and --doc - Update fn.WithContext to use context.Context directly (API change) - Bump SDK dependency from v1.0.3 to v1.0.4 The function now supports: - --help: renders human-readable docs from README.md - --doc: renders machine-readable JSON for kpt fn doc - Standalone file mode (positional args) This is Phase 2 of the SDK migration plan for the 8 already-migrated functions. The orphaned generated/docs.go is left in place for now to avoid disrupting the shared mdtogo Makefile target. Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech>
efiacor
force-pushed
the
set_labels_sdk_withdocs
branch
from
June 9, 2026 10:46
5a57914 to
a392e9d
Compare
Contributor
Author
|
Addresses kptdev/kpt#4516 |
liamfallon
approved these changes
Jun 10, 2026
aravindtga
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The function now supports:
This is Phase 2 of the SDK migration plan for the 8 already-migrated functions. The orphaned generated/docs.go is left in place for now to avoid disrupting the shared mdtogo Makefile target.