-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix api generation #35
Conversation
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.
As far as I can tell by looking through it:
/lgtm
Trigger CLI e2e
It also looks fine to me. Also I have built it locally and run the tests locally and they pass. I have also manually ran through the Porch tutorial locally, testing PVSs and VPs and it all works fine. However, let's leave the PR open for another day or so to get more reviews on it given that it is such a big PR. |
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.
It also looks fine to me. Also I have built it locally and run the tests locally and they pass. I have also manually ran through the Porch tutorial locally, testing PVSs and VPs and it all works fine. However, let's leave the PR open for another day or so to get more reviews on it given that it is such a big PR.
/assign @johnbelamaric @s3wong @henderiw |
@@ -38,8 +38,8 @@ var ( | |||
|
|||
func addKnownTypes(scheme *runtime.Scheme) error { | |||
scheme.AddKnownTypes(SchemeGroupVersion, | |||
&Package{}, | |||
&PackageList{}, | |||
&PorchPackage{}, |
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.
Curious as to why the renaming is needed? Thanks
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.
It uses kube-codegen to generate the api code.
With naming the CR Package, the code generator didn't like that apparently as package is a keyword in golang, so they forked it and customised it here. Didn't dig into what they did really.
As part of the migration/clean up plan, the Package and Function CRs will be removed, so the idea here is to provide a stop gap solution (hopefully without breaking anything), by renaming to "PorchPackage.."
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.
Curious as to why the renaming is needed? Thanks
@vjayaramrh Are you OK with this?
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.
@efiacor @liamfallon , Thanks for the response, I am good.
@@ -1,24 +1,9 @@ | |||
# Copyright 2023 The kpt and Nephio Authors |
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.
Why are these getting removed?
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.
Good spot. Not sure how they were getting added before. I have update the controller-gen directives to add the header now.
func mapObjectsToRequests(mgrClient client.Reader) handler.MapFunc { | ||
return func(ctx context.Context, obj client.Object) []reconcile.Request { | ||
attachedPackageVariants := &api.PackageVariantList{} | ||
err := mgrClient.List(context.TODO(), attachedPackageVariants, &client.ListOptions{ |
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.
With the new function signature, you get the associated context as a param of the function, that should be used.
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.
Done
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.
Done
func mapObjectsToRequests(mgrClient client.Reader) handler.MapFunc { | ||
return func(ctx context.Context, obj client.Object) []reconcile.Request { | ||
attachedPackageVariants := &api.PackageVariantSetList{} | ||
err := mgrClient.List(context.TODO(), attachedPackageVariants, &client.ListOptions{ |
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.
Same as above, use the provided context.
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.
Done
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.
Done
o.RecommendedOptions.Etcd.StorageConfig.Paging = utilfeature.DefaultFeatureGate.Enabled(features.APIListChunking) | ||
} | ||
// if o.RecommendedOptions.Etcd != nil { | ||
// o.RecommendedOptions.Etcd.StorageConfig.Paging = utilfeature.DefaultFeatureGate.Enabled(features.APIListChunking) |
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.
Couldn't you just remove this?
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.
Possibly but my knowledge of the Paging functionality in etcd is limited.
They removed it in the latest version. Plan was maybe to reintroduce it once I have the know how.
Can remove if it's cleaner. Don't think we are losing much.
if err != nil { | ||
return nil, err | ||
} | ||
return resources, nil | ||
} | ||
|
||
func loadResourcesFromTar(ctx context.Context, tarReader *tar.Reader) (*repository.PackageResources, error) { | ||
func loadResourcesFromTar(tarReader *tar.Reader) (*repository.PackageResources, error) { |
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.
Why dropping context here? If anything, context cancelation should be part of the for loop at #195.
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.
Slightly lazy one but it shows up as an unused param. There is a few of them in the code which prob should be cleaned up. Unless my understanding of how the context is passed/used in k8s is incorrect.
@@ -0,0 +1,39 @@ | |||
|
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'm not really a bash expert, I couldn't figure out what this is used for. Could you add 1-2 lines to explain it?
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.
Nor am I :D
I borrowed this from another project. From my understanding, it catches the exit codes if any and gives some nice output to the user.
@efiacor any specific files that you would recommend a newbie porch reviewer to get familar with while reviewing this PR. Thanks |
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.
The updates all look fine @efiacor
Hi @vjayaramrh . |
@@ -174,6 +176,40 @@ func KubectlDeleteNamespace(t *testing.T, name string) { | |||
t.Logf("output: %v", string(out)) | |||
} | |||
|
|||
func RemovePackagerevFinalizers(t *testing.T, namespace string) { |
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.
Was the test case not failing before because of finalizers?
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.
Intermittently yes.
See the history here - https://github.com/nephio-project/porch/actions/workflows/porchctl-cli-e2e.yaml
I believe there is some timing/race condition on how the PackageRev api-resource gets updated. If the Finalizers remain, it blocks the NameSpace deletion.
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.
Ok, that's fine, I'll open a separate issue on this one. Seems strange that porch-server is sometimes able to delete the packagerevs and sometimes not.
Nice work, @efiacor! I know how gnarly this problem was, I spent a fair bit of time on it myself and gave up in frustration :) - thanks for sticking through it. /approve |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: efiacor, johnbelamaric, liamfallon, nagygergo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Upgrade code gen to latest and use the provided script to generate the api.
Bump versions to align with the code-gen version.
Fix cli e2e test suite.
The following files are auto generated and therefore do not require a "full" review: