Fix create-setters matching setter values in internal kpt annotations#1229
Merged
efiacor merged 1 commit intokptdev:mainfrom Apr 13, 2026
Merged
Conversation
✅ Deploy Preview for krm-function-catalog canceled.
|
99b0337 to
bb6af3d
Compare
Contributor
Author
|
This should be rebased once #1227 is merged. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes non-deterministic setter comment generation by preventing create-setters from matching and annotating kpt runtime metadata stored in internal.config.kubernetes.io/* and config.kubernetes.io/* annotations.
Changes:
- Skip scalar nodes whose field path is under
metadata.annotations.internal.config.kubernetes.io/*ormetadata.annotations.config.kubernetes.io/*. - Add a regression test ensuring annotation values containing a setter substring are ignored while normal fields (e.g.
spec.replicas) still getkpt-setcomments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| functions/go/create-setters/createsetters/create_setters.go | Adds a path-based guard in visitScalar to avoid generating setter comments for internal/config kpt annotations. |
| functions/go/create-setters/createsetters/create_setters_test.go | Adds a test case validating internal/config kpt annotations are skipped while regular fields continue to be annotated. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
liamfallon
approved these changes
Apr 8, 2026
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
bb6af3d to
fe096cc
Compare
mozesl-nokia
approved these changes
Apr 13, 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.
Fixes kptdev/kpt#4462
Summary
The create-setters function was incorrectly creating setter comments on
internal.config.kubernetes.io/*andconfig.kubernetes.io/*annotations. These are kpt runtime metadata injected during fn render (e.g. filesystem paths) and are not user-authored resource content. When a setter value like 4 appeared as a substring in a temp directory path, the function would produce spurious and non-deterministic results.Changes
functions/go/create-setters/createsetters/create_setters.go:
internal.config.kubernetes.ioand `config.kubernetes.io annotationsfunctions/go/create-setters/createsetters/create_setters_test.go:
internal.config.kubernetes.io/package-pathcontaining the setter value is not matchedspec.replicasstill correctly receive setter comments