Separate API types module#1060
Conversation
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>
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>
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>
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>
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>
✅ Deploy Preview for kpt-porch ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR refactors Porch’s API surface so the api/ directory becomes an independently importable Go module, and updates the codebase to consume the standalone github.com/kptdev/kpt/api module. It also streamlines code generation (single go:generate) and centralizes generated CRDs under api/generated/crds.
Changes:
- Split
api/into its own Go module (github.com/kptdev/porch/api) and adjust build/tidy/lint workflows accordingly. - Migrate imports from
github.com/kptdev/kpt/pkg/api/...togithub.com/kptdev/kpt/api/...across controllers, pkg, func, and tests. - Consolidate/move PackageVariant / PackageVariantSet / internal PackageRev APIs into
api/porchconfig, and update CRD generation + deployment scripts to use the generated CRD directory.
Reviewed changes
Copilot reviewed 108 out of 119 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| test/mockery/mocks/porch/pkg/repository/mock_PackageRevision.go | Update kptfile import path to kpt/api. |
| test/mockery/mocks/porch/pkg/repository/mock_PackageContent.go | Update kptfile import path to kpt/api. |
| test/mockery/mocks/porch/pkg/repository/mock_ExternalPackageFetcher.go | Update kptfile import path to kpt/api. |
| test/e2e/suiteutils/suite.go | Update kptfile import and scheme registration for moved APIs. |
| test/e2e/suiteutils/suite_utils.go | Update kptfile import and switch to porchconfig API types for PV/PkgRev usage. |
| test/e2e/api/rpkg_subpkg_test.go | Update kptfile import path to kpt/api. |
| test/e2e/api/rpkg_init_test.go | Update kptfile import path to kpt/api. |
| test/e2e/api/rpkg_edit_test.go | Update kptfile import path to kpt/api. |
| test/e2e/api/rpkg_clone_test.go | Update kptfile import path to kpt/api. |
| test/e2e/api/render_failure_test.go | Update kptfile import path to kpt/api. |
| test/disaster/api/environment/packagevariantsets/packagevariantsets.go | Switch PVSet API import to porchconfig v1alpha2. |
| test/disaster/api/environment/packagevariants/packagevariants.go | Switch PV API import to porchconfig v1alpha1. |
| scripts/generate-api.sh | Run codegen from api/ module root and emit to api/generated. |
| scripts/create-deployment-blueprint.sh | Copy CRDs from api/generated/crds instead of legacy locations. |
| pkg/task/upgrade_test.go | Update kptfile import path to kpt/api. |
| pkg/task/simpleruntime_test.go | Update kptfile import path to kpt/api. |
| pkg/task/render.go | Update fnresult import path to kpt/api. |
| pkg/task/render_test.go | Update kptfile import path to kpt/api. |
| pkg/task/patch_test.go | Update kptfile import path to kpt/api. |
| pkg/task/generictaskhandler.go | Update kptfile import path to kpt/api. |
| pkg/task/generictaskhandler_test.go | Update kptfile import path to kpt/api. |
| pkg/task/edit_test.go | Update kptfile import path to kpt/api. |
| pkg/task/clone.go | Update kptfile import path to kpt/api. |
| pkg/task/clone_test.go | Update kptfile import path to kpt/api. |
| pkg/repository/util.go | Update kptfile import path to kpt/api. |
| pkg/repository/util_test.go | Update kptfile import path to kpt/api. |
| pkg/repository/repository.go | Update kptfile import path to kpt/api. |
| pkg/repository/repository_test.go | Update kptfile import path to kpt/api. |
| pkg/repository/content.go | Update kptfile import path to kpt/api. |
| pkg/registry/porch/packagerevision_test.go | Update kptfile import path to kpt/api. |
| pkg/externalrepo/oci/oci.go | Update kptfile import path to kpt/api. |
| pkg/externalrepo/git/package.go | Update kptfile import path to kpt/api. |
| pkg/externalrepo/git/package_test.go | Update kptfile import path to kpt/api. |
| pkg/externalrepo/git/git.go | Update kptfile import path to kpt/api. |
| pkg/externalrepo/fake/repository.go | Update kptfile import path to kpt/api. |
| pkg/externalrepo/fake/packagerevision.go | Update kptfile import path to kpt/api. |
| pkg/engine/pushpr.go | Update kptfile import path to kpt/api. |
| pkg/engine/pushpr_test.go | Update kptfile import path to kpt/api. |
| pkg/engine/grpcruntime.go | Update kptfile import path to kpt/api. |
| pkg/engine/grpcruntime_test.go | Update kptfile import path to kpt/api. |
| pkg/engine/engine_test.go | Update kptfile import path to kpt/api. |
| pkg/engine/builtinruntime.go | Update kptfile import path to kpt/api. |
| pkg/engine/builtinruntime_test.go | Update kptfile import path to kpt/api. |
| pkg/cli/commands/rpkg/util/common.go | Update kptfile import path to kpt/api. |
| pkg/cli/commands/rpkg/upgrade/command.go | Update kptfile import path to kpt/api. |
| pkg/cli/commands/rpkg/pull/command.go | Update kptfile import path to kpt/api. |
| pkg/cli/commands/rpkg/get/command.go | Update kptfile import path to kpt/api. |
| pkg/cache/dbcache/dbreposync_test.go | Update kptfile import path to kpt/api. |
| pkg/cache/dbcache/dbrepository.go | Update kptfile import path to kpt/api. |
| pkg/cache/dbcache/dbpackagerevisionsql.go | Update kptfile import path to kpt/api. |
| pkg/cache/dbcache/dbpackagerevision.go | Update kptfile import path to kpt/api. |
| pkg/cache/crcache/meta/store.go | Switch internal PackageRev usage to porchconfig API types. |
| pkg/cache/crcache/meta/store_test.go | Update test types from internalapi to porchconfig PackageRev. |
| pkg/cache/contentcache/wrappers.go | Update kptfile import path to kpt/api. |
| pkg/cache/contentcache/wrappers_test.go | Update kptfile import path to kpt/api. |
| pkg/cache/contentcache/externalfetcher.go | Update kptfile import path to kpt/api. |
| pkg/apiserver/apiserver.go | Update scheme types and switch internal PackageRev type to porchconfig. |
| make/go.mk | Add api-module sub-make targets; adjust lint/fix/vet/fmt/tidy flow. |
| make/build.mk | Limit API module generation loop to api/; make tidy run api tidy too. |
| internal/api/porchinternal/v1alpha1/zz_generated.deepcopy.go | Remove internal API deepcopy output (types moved). |
| go.sum | Bump kpt version; add kpt/api and module split sums. |
| go.mod | Add replace+require for github.com/kptdev/porch/api; add kpt/api. |
| func/internal/executableevaluator.go | Update kptfile import path to kpt/api. |
| func/internal/executableevaluator_test.go | Update kptfile import path to kpt/api. |
| func/Dockerfile-wrapperserver | Reorder/collapse grpc-health-probe install and improve build caching. |
| func/Dockerfile | Reorder/collapse grpc-health-probe install and improve build caching. |
| controllers/repositories/pkg/controllers/repository/repository_controller.go | Bump controller-gen version for RBAC generation. |
| controllers/repositories/pkg/controllers/repository/pkgrevsync_test.go | Update kptfile import path to kpt/api. |
| controllers/packagevariantsets/pkg/controllers/packagevariantset/validate.go | Switch PV/PVSet API imports to porchconfig module. |
| controllers/packagevariantsets/pkg/controllers/packagevariantset/validate_test.go | Switch PVSet API imports to porchconfig module. |
| controllers/packagevariantsets/pkg/controllers/packagevariantset/render.go | Switch PV/PVSet API imports to porchconfig module + update kptfile import. |
| controllers/packagevariantsets/pkg/controllers/packagevariantset/render_test.go | Switch PV/PVSet API imports to porchconfig module + update kptfile import. |
| controllers/packagevariantsets/pkg/controllers/packagevariantset/packagevariantset_controller.go | Rewire controller to use porchconfig v1alpha2 PVSet and v1alpha1 PV types. |
| controllers/packagevariantsets/pkg/controllers/packagevariantset/packagevariantset_controller_test.go | Update tests to use porchconfig PV/PVSet types. |
| controllers/packagevariantsets/pkg/controllers/packagevariantset/fake_client.go | Switch PV API import to porchconfig module. |
| controllers/packagevariantsets/api/v1alpha2/groupversion_info.go | Remove old controller-local PVSet API types. |
| controllers/packagevariantsets/api/v1alpha1/zz_generated.deepcopy.go | Remove old controller-local PVSet API deepcopies. |
| controllers/packagevariantsets/api/v1alpha1/groupversion_info.go | Remove old controller-local PVSet API groupversion. |
| controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller.go | Switch PV type usage to porchconfig and update kptfile import. |
| controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller-with-workspacename_test.go | Switch PV API import to porchconfig module. |
| controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller_test.go | Switch PV API import to porchconfig module. |
| controllers/packagevariants/pkg/controllers/packagevariant/injection.go | Switch PV API import to porchconfig module + update kptfile import. |
| controllers/packagevariants/pkg/controllers/packagevariant/injection-with-workspacename_test.go | Switch PV API import to porchconfig module + update kptfile import. |
| controllers/packagevariants/pkg/controllers/packagevariant/injection_test.go | Switch PV API import to porchconfig module + update kptfile import. |
| controllers/packagevariants/api/v1alpha1/zz_generated.deepcopy.go | Remove old controller-local PV API deepcopies. |
| controllers/packagevariants/api/v1alpha1/groupversion_info.go | Remove old controller-local PV API groupversion. |
| controllers/packagerevisions/pkg/controllers/packagerevision/status.go | Update kptfile import path to kpt/api. |
| controllers/packagerevisions/pkg/controllers/packagerevision/status_test.go | Update kptfile import path to kpt/api. |
| controllers/packagerevisions/pkg/controllers/packagerevision/source.go | Update kptfile import path to kpt/api. |
| controllers/packagerevisions/pkg/controllers/packagerevision/source_test.go | Update kptfile import path to kpt/api. |
| controllers/packagerevisions/pkg/controllers/packagerevision/render.go | Update fnresult/kptfile imports to kpt/api. |
| controllers/packagerevisions/pkg/controllers/packagerevision/packagerevision_controller.go | Bump controller-gen version for RBAC generation. |
| controllers/packagerevisions/pkg/controllers/packagerevision/packagerevision_controller_test.go | Update kptfile import path to kpt/api. |
| controllers/main.go | Bump controller-gen version and update scheme registration for moved APIs. |
| controllers/Dockerfile | Remove separate go mod download step (build caching changes). |
| build/Dockerfile | Remove separate go mod download step (build caching changes). |
| api/porchconfig/v1alpha2/zz_generated.deepcopy.go | Update deepcopy imports after moving PV types into porchconfig. |
| api/porchconfig/v1alpha2/packagevariantset_types.go | Update PVSet types to use new module paths and shared v1alpha1 types. |
| api/porchconfig/v1alpha2/groupversion_info.go | Define lightweight TypeInfo registration for v1alpha2 PVSet. |
| api/porchconfig/v1alpha1/zz_generated.deepcopy.go | Add deepcopies for moved PV/PVSet and new PackageRev types. |
| api/porchconfig/v1alpha1/packagevariantset_types.go | Update PVSet v1alpha1 types; align policy types with porchconfig. |
| api/porchconfig/v1alpha1/packagevariant_types.go | Update kptfile import path to kpt/api. |
| api/porchconfig/v1alpha1/packagerev.go | Add new porchconfig PackageRev CRD type. |
| api/porchconfig/v1alpha1/groupversion_info.go | Register added porchconfig types (PackageRev, PV, PVSet) in scheme. |
| api/porchconfig/doc.go | Add groupName doc for porchconfig API group. |
| api/porch/v1alpha2/kptdata_conversion.go | Update kptfile import path to kpt/api. |
| api/porch/v1alpha2/kptdata_conversion_test.go | Update kptfile import path to kpt/api. |
| api/porch/v1alpha2/groupversion_info.go | Remove old controller-gen directives (generation centralized). |
| api/Makefile | Add module-local fmt/vet/fix/tidy/lint targets. |
| api/go.sum | Add sums for the new api module. |
| api/go.mod | Introduce standalone github.com/kptdev/porch/api module definition. |
| api/generated/crds/porch.kpt.dev_packagerevisions.yaml | Regenerate CRD with newer controller-gen version. |
| api/generated/crds/config.porch.kpt.dev_servicetemplates.yaml | Regenerate CRD with newer controller-gen version. |
| api/generated/crds/config.porch.kpt.dev_repositories.yaml | Regenerate CRD with newer controller-gen version. |
| api/generated/crds/config.porch.kpt.dev_packagevariantsets.yaml | Regenerate CRD with newer controller-gen version. |
| api/generated/crds/config.porch.kpt.dev_packagevariants.yaml | Regenerate CRD with newer controller-gen version. |
| api/generated/crds/config.porch.kpt.dev_packagerevs.yaml | Add/regenerate PackageRev CRD (new type) with license header + version update. |
| api/generated/crds/config.porch.kpt.dev_functionconfigs.yaml | Regenerate CRD with newer controller-gen version. |
| api/doc.go | Centralize controller-gen directives for generating api module CRDs. |
Files not reviewed (1)
- api/porchconfig/v1alpha1/zz_generated.deepcopy.go: Generated file
Comments suppressed due to low confidence (1)
pkg/apiserver/apiserver.go:186
- buildCompleteScheme adds configapi types twice, and the second error message still refers to "internalapi" even though configapi is being added. This makes failures misleading and the extra AddToScheme call is unnecessary.
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>
|
efiacor
left a comment
There was a problem hiding this comment.
Looks good overall. Would be nice to get a few more human reviews on it.




Title
Separate API types module
Description
Simplified the code generation so it is now done by one
go:generateline, but the side effect of that is all the CRDs are now generated into a single directory (I think this is a positive).This PR also includes using the independent kpt api module, thus the kpt version has been bumped as well.
Related Issue(s)
Type of Change
Checklist
Testing Instructions (Optional)
Additional Notes (Optional)
AI Disclosure
I have not used AI in the creation of this PR.