Skip to content

Make UpstreamLock more generic#4413

Open
mozesl-nokia wants to merge 4 commits intokptdev:mainfrom
nokia:locator
Open

Make UpstreamLock more generic#4413
mozesl-nokia wants to merge 4 commits intokptdev:mainfrom
nokia:locator

Conversation

@mozesl-nokia
Copy link
Contributor

@mozesl-nokia mozesl-nokia commented Feb 25, 2026

The gist of this PR is to rename the UpstreamLock type to Locator and add generic locator type.

This is mostly for API consumers, such as Porch, where we currently have no way of expressing in the UpstreamLock that the package comes from a database.

(This renaming is already present in Porch, which duplicates some of the kpt API types, so this is a step towards de-duplicating even further.)

*The big diff is just the yaml/json schema

Copilot AI review requested due to automatic review settings February 25, 2026 10:05
@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 232c2ec
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/69a1a346ed77510008c382e4
😎 Deploy Preview https://deploy-preview-4413--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 25, 2026
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
@dosubot
Copy link
Contributor

dosubot bot commented Feb 25, 2026

Related Documentation

1 document(s) may need updating based on files changed in this PR:

kpt

migration /kpt/blob/main/documentation/content/en/installation/migration.md
View Suggested Changes
@@ -105,8 +105,8 @@
 2. `upstream` section, in the `v1alpha1` Kptfile is split into `upstream` and
    `upstreamLock` sections in `v1` Kptfile. `upstream` section can be
    modified by users to declare the desired version of the package,
-   `upstreamLock` is the resolved package state and should not be modified by
-   users.
+   `upstreamLock` is the resolved package state (stored in the `Locator` type) and should not be modified by
+   users. The `Locator` type supports both Git origins and generic storage backends.
 3. The `OpenAPI` section in `v1alpha1` Kptfile is deprecated.
    [Details below](#changes-to-setters).
 4. `dependencies` section in `v1alpha1` Kptfile is deprecated.
@@ -244,7 +244,7 @@
 1. Best effort is made by the function to transform the `packageMetaData`
    section to the `info` section.
 2. `upstream` section, in the `v1alpha1` Kptfile is converted to `upstream` and
-   `upstreamLock` sections in `v1` version of Kptfile.
+   `upstreamLock` sections in `v1` version of Kptfile. The `upstreamLock` field uses the `Locator` type, which supports both Git and generic storage backends.
 3. `dependencies` section is removed from Kptfile.
 4. Starlark functions section is removed from Kptfile.
 5. `Setters` and `substitutions` are converted to new and simple setter

[Accept] [Decline]

Note: You must be authenticated to accept/decline updates.

How did I do? Any feedback?  Join Discord

Copy link

Copilot AI left a comment

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 updates the kpt Kptfile API to make the “where this package came from” metadata more generic by renaming the UpstreamLock type to Locator and introducing a new generic locator form for non-git storage backends.

Changes:

  • Rename kptfile/v1.UpstreamLock (type) to kptfile/v1.Locator and update call sites/tests accordingly.
  • Add GenericOrigin and GenericLock to represent packages stored in generic/custom storage (e.g., a DB).
  • Update helpers/utilities that populate or normalize the upstream lock data to use the renamed type.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pkg/api/kptfile/v1/types.go Renames the lock type to Locator and adds GenericOrigin / GenericLock.
pkg/kptfile/kptfileutil/util.go Writes UpstreamLock using the new Locator type.
pkg/lib/kptops/clone.go Updates helper APIs to accept/normalize Locator instead of UpstreamLock.
pkg/lib/kptops/clone_test.go Adjusts tests to construct Locator instead of UpstreamLock.
pkg/lib/kptops/pkgupdate.go Updates commented references from UpstreamLock to Locator.
internal/util/diff/pkgdiff.go Updates diff-ignore logic to use Locator.
internal/util/get/get_test.go Updates tests to construct Locator instead of UpstreamLock.
internal/util/fetch/fetch_test.go Updates tests to construct Locator instead of UpstreamLock.
internal/testutil/testutil.go Updates upstreamLock defaulting logic to use Locator.
internal/testutil/setup_manager.go Updates test expectations to use Locator.
internal/testutil/pkgbuilder/builder.go Builds Kptfiles with Locator for upstreamLock.
commands/pkg/get/cmdget_test.go Updates tests to construct Locator instead of UpstreamLock.
commands/pkg/update/cmdupdate_test.go Updates tests to construct Locator instead of UpstreamLock.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mozesl-nokia mozesl-nokia added the go Pull requests that update Go code label Feb 25, 2026
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Copilot AI review requested due to automatic review settings February 25, 2026 14:30
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 25, 2026
@mozesl-nokia
Copy link
Contributor Author

@liamfallon @efiacor @kispaljr Should we consider unifying the Upstream and Locator types?

From what I can see Upstream is meant for input ("user-specified locator") and UpstreamLock was meant to be generated by kpt ("resolved locator"), but would it not make sense to just have Locator with either a filled or unfilled git.commit field?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.


💡 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/porch go Pull requests that update Go code size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants