Skip to content

Eliminate apimachinery dependency in the api module - #4614

Merged
liamfallon merged 3 commits into
kptdev:mainfrom
nokia:elim-apimachinery
Jul 2, 2026
Merged

Eliminate apimachinery dependency in the api module#4614
liamfallon merged 3 commits into
kptdev:mainfrom
nokia:elim-apimachinery

Conversation

@mozesl-nokia

Copy link
Copy Markdown
Contributor

This PR removes the dependency on apimachinery by 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.

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>
Copilot AI review requested due to automatic review settings July 2, 2026 13:10
@netlify

netlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 70800a8
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a4665990040950008231296
😎 Deploy Preview https://deploy-preview-4614--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. go Pull requests that update Go code labels Jul 2, 2026
@mozesl-nokia mozesl-nokia added dependencies Pull requests that update a dependency file area/api labels Jul 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/v1 with local GroupVersion, GroupKind, and GroupVersionKind types + helpers (ported from apimachinery) and accompanying tests.
  • Updated api types to import the new local schema package instead of k8s.io/apimachinery/pkg/runtime/schema.
  • Removed k8s.io/apimachinery (and related indirect deps) from api/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.

Comment thread api/schema/v1/group_version.go
Comment thread api/schema/doc.go Outdated
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
@liamfallon
liamfallon merged commit a0b8114 into kptdev:main Jul 2, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api dependencies Pull requests that update a dependency file go Pull requests that update Go code lgtm size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants