Eliminate apimachinery dependency in the api module - #4614
Merged
Conversation
Assisted-by: Cursor:composer-2.5 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:composer-2.5 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
mozesl-nokia
requested review from
efiacor,
kispaljr and
liamfallon
as code owners
July 2, 2026 13:10
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a small, vendored-in schema package inside the api module to replace the k8s.io/apimachinery/pkg/runtime/schema dependency, reducing the api module’s dependency footprint while preserving the Group/Version/Kind types kpt needs.
Changes:
- Added
api/schema/v1with localGroupVersion,GroupKind, andGroupVersionKindtypes + helpers (ported from apimachinery) and accompanying tests. - Updated
apitypes to import the new local schema package instead ofk8s.io/apimachinery/pkg/runtime/schema. - Removed
k8s.io/apimachinery(and related indirect deps) fromapi/go.mod/api/go.sum.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| api/schema/v1/group_version.go | Adds local GVK/GV/GK types and parsing helpers (ported from apimachinery). |
| api/schema/v1/group_version_test.go | Adds unit tests for the new schema helpers. |
| api/schema/doc.go | Documents the new schema package purpose (no apimachinery dependency). |
| api/resourcegroup/v1alpha1/types.go | Switches ResourceGroup GVK helper to local schema types. |
| api/kptfile/v1/types.go | Switches Kptfile GVK helper to local schema types. |
| api/fnresult/v1/types.go | Switches FunctionResultList GVK helper to local schema types. |
| api/go.mod | Removes direct apimachinery dependency; updates indirect deps. |
| api/go.sum | Drops apimachinery-related sums and other no-longer-needed entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
liamfallon
approved these changes
Jul 2, 2026
mozesl-nokia
requested review from
aravindtga,
dgyorgy-nokia,
nagygergo and
rendre-greyling
July 2, 2026 14:17
tgzsolt
approved these changes
Jul 2, 2026
dgyorgy-nokia
approved these changes
Jul 2, 2026
rendre-greyling
approved these changes
Jul 2, 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.
This PR removes the dependency on
apimachineryby vendoring in the parts relevant for kpt. This is part of an effort to reduce the "dependency footprint" of kpt modules.Needs a follow-up where this new version of the api module is adopted by the main kpt module (already ready from me).
Feel free to suggest additional parts of the GVK interface to include, I only added what kpt and the function SDK need.
Required by: kptdev/krm-functions-sdk#762
AI disclosure: Cursor's composer 2.5 was used to create the cut down files in the new schema package.