-
Notifications
You must be signed in to change notification settings - Fork 248
Complete transfer of kpt updates from Porch to kpt #4355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
c7e33ad to
73a0e40
Compare
73a0e40 to
4b64e3a
Compare
|
|
||
| // PkgUpdate is a wrapper around `kpt pkg update`, running it against the package in packageDir | ||
| func PkgUpdate(ctx context.Context, ref string, packageDir string, _ PkgUpdateOpts) error { | ||
| // TODO: Printer should be a logr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this TODO be done now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be way off the mark here but, should some of this stuff be in the krm-fn-sdk module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, let me try and write a refactoring epic for cleanup on all these topics.
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
05c548c to
9853d8b
Compare
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
This PR completes the transfer of updates to cloned kpt code in Porch to kpt.
Once this PR is merged, all cloned kpt code in Porch can be removed and Porch can use the definitive kpt code.
When this PR and its companion PR in Porch are merged, the kpt code base will increase by 2357 lines of code (1703 lines of go code) and the Porch codebase will decrease by 24,757 lines of code (22,948 lines of go code)
This PR also removes the porch dependency in kpt.
Fixes: #4271
Fixes: #4276
Fixes: #4356
See also the corresponding PR in Nephio: nephio-project/porch#411
Summary of Changes
Transferred kpt operations from Porch
Porch has the following macro kpt operations that properly belong in kpt:
These operations are transferred to kpt from Porch. By having them in kpt as operations that users can call, it reduces the dependencies
from Porch on the internals of kpt drastically. Porch just calls the operaitons, which delegates the implementaitons to kpt.
We may not need the
internal/kptopspackage because it contains translators and amendments of "apply-setters", "set-labels", and "set-namespace". Thesetranslators and amendments should probably be in the function implementations in the "krm-functions-catalog" repo,
see this issue
New files in kpt:
Transfer three way merge from Porch to kpt
New files in kpt:
Remove missed Porch reference from alpha commands
When the Porch commands (
kpt alpha rpkg) was removed, a reference to theporchpackagewas missed incommands/alpha/alphacmd.go, the reference is removed in this PRChange in file:
Remove KRM function suggestion that uses Porch
Kpt had a KRM function search/suggestion feature on
kpt fn docthat returned a list of KRM functions that matched the KRM function string entered by the user.This suggestion feature relies on searches of the Porch KRM function repositories. Porch has removed support for KRM function repositories.
This PR removes the references to the Porch function search support that no longer works. This functionality also made kpt dependent on
Porch, that dependency is gone
Modified file:
Removed files:
Move builtin KRM functions back into the "intenal" directory and just expose the Package Context generator over an interface
In kpt, there is a directory
internal/builtinsthat contains builtin KRM functions. Today there is only only one builtin KRM function, the Package Context generator.Rather than exposing all builtin functions, this PR puts the buitlin functions back under the "internal" directory. It exposes a "builtin" interface in "pkg/lib/builtin" where
a user can look up and get a reference to a builtin function without kpt having to expose the entire builtin function implementation.
New interface to look up and get a handle on builtin functions
Instead of having to explicitly call a builtin function, a user can now use the
GetBuiltinFnfunction inpkg/lib/builtinsto getan implementation of a builtin function that implements the
BuiltinFunctioninterface defined inpkg/lib/builtins/builtintypes.This means that the implementation of the builtin functions no longer needs to be exposed and can be moved back from
pkg/lib/builtinstointerna/buiultins.The data declarations below are moved from
internal/builtins/pkg_context.gotopkg/lib/builtins/builtintypes/builtintypes.gobecauseusers of the interface need access to those types:
New files to expose the types and interface:
Moved from pkg/lib/builtins to internal/builtins
These files are moved back into
internal/builtinsso that theya re not exposed:Move fnruntime back into "internal" so it is not externally exposed
We don not have to expose the function runtime in
internal/fnruntimein order for external users to use the functionruntime. We justhave to expose the funciton runner options and the image pull policy. The following new files are added to provide
the runtime options and image pull policy on the kpt lib:
The following types and functions were extracacted from
internal/fnruntimeintopkg/lib/runneroptionsbecauseusers of the function runtime need access to them to use the function runtime
FunctionRuntimeinterface from Porch topkg/lib/kptops/fnruntime.gopkg/lib/runneroptionsas the pull policy must be exposed to usersfnruntime.ResolveToImageForCLIFunc()is moved frominternal/fnruntime/container.gotopkg/lib/runneroptions.goFuncGenPkgContextandGHCRImagePrefixare moved frominternal/fnruntime/runner.gotopkg/lib/runneroptions.goImageResolveFuncis moved frominternal/fnruntime/runner.gotopkg/lib/runneroptions.goRunnerOptionsandSingleLineFormatterare moved frominternal/fnruntime/runner.gotopkg/lib/runneroptions.goInitDefaultsis moved frominternal/fnruntime/runner.gotopkg/lib/runneroptions.goNew files for the extracted parts of fnruntime:
Move the following files from
pkg/lib/fnruntimeback tointernal/fnruntimePort Porch Breadth First Rendering across to kpt
Porch supports breadth first rendering of kpt files if the annotation "kpt.dev/bfs-rendering" is set to "true".
Move porch
internal/kpt/util/rendercode to `internal/util/render'Files changed:
Add an interface for updaters
This PR adds an interface in
pkg/lib/updateso that updaters in ininternal/util/updatedo not haveto be directly exposed to users. Users can use the 'pkg/lib/update' interface to get an implementation of an updater.
The
Updatertype is moved frominternal/util/update/update.gotopkg/lib/update/updatetypes/updatetypes.go.The Update interface and types is moved from Porch to kpt. The files that publish the interface are:
Files updated to specify an implementation of the
updatetypes/updaterinterface:Bug fixes and improvements ported from Porch
Update of the root kpt file on "replace" updates:
Fixes to the "resource-merge" strategy:
GetUpdaterfunction ported from Porch:Support for running tests on MacOS:
Move files from
pkg/lib/tointernal/that no longer need to be exportedMove utility functions from
internal/topkg/lib/that need to be exportedGo files
go.mod
go.sum
Makefile changes
Removed the defunct test-live-plan target from the Makefile, "kpt live plan" is no longer supported
Tweaks to E2E test data
e2e/testdata/fn-render/basicpipeline-symlink/.expected/config.yaml
e2e/testdata/fn-render/exec-function-stderr/.expected/config.yaml
e2e/testdata/fn-render/out-of-place-fnchain-stdout-results/.expected/config.yaml
e2e/testdata/fn-render/out-of-place-fnchain-stdout/.expected/config.yaml
e2e/testdata/fn-render/selectors/basicpipeline/.expected/config.yaml
e2e/testdata/fn-render/selectors/exclude/.expected/config.yaml
e2e/testdata/fn-render/selectors/generator/.expected/config.yaml
e2e/testdata/fn-render/selectors/selectors-with-exclude/.expected/config.yaml
Import path changes only
The imports on these files were changed due to restucturing in other parts of the code.
Code volume changes
Before refactor
kpt codebase (kpt repo)
Porch codebase (porch repo):
After refactor:
kpt codebase (kpt repo)
Porch codebase (porch repo):