Skip to content
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

🐛 run make update fail because deepcopy doesn't support generic … #288

Conversation

xuezhaojun
Copy link
Member

@xuezhaojun xuezhaojun commented Oct 17, 2023

…type.

Summary

Run make update fail because of deepcopy-gen doesn't support generic type yet. kubernetes/gengo#225

It will log errors:

W1017 14:10:32.195161   62703 parse.go:863] Making unsupported type entry "T" for: &types.TypeParam{check:(*types.Checker)(nil), id:0x1, obj:(*types.TypeName)(0xc009651900), index:0, bound:(*types.Interface)(0xc00009a960)}
F1017 14:10:32.221298   62703 deepcopy.go:890] Hit an unsupported type open-cluster-management.io/api/cluster/v1alpha1.ClusterRolloutStatusFunc[T] for open-cluster-management.io/api/cluster/v1alpha1.ClusterRolloutStatusFunc[T], from open-cluster-management.io/api/cluster/v1alpha1.RolloutHandler[T]

The generic type was introduced by this PR: #276

In this PR, we change the strategy from 'opt-out'(via deepcopy-gen=false comment) to 'opt-in'(via deepcopy-gen=true comment)

Related issue(s)

Fixes #

@openshift-ci openshift-ci bot requested review from deads2k and mdelder October 17, 2023 10:09
@xuezhaojun
Copy link
Member Author

/assign @qiujian16

cc @haoqing0110 @serngawy

@xuezhaojun
Copy link
Member Author

After this PR merged, we should add make update as a ci step.

@serngawy
Copy link
Member

Thanks @xuezhaojun , I'm able to reproduce the error as well. It should be enough to set the // +k8s:deepcopy-gen=false to ClusterRolloutStatusFunc[T any] type similar to RolloutHandler[T any] type here .
It is strange that it didn't show up with original PR .
Based on the deepCopy code doc here setting the deepcopy-gen=false should work.

@xuezhaojun
Copy link
Member Author

xuezhaojun commented Oct 17, 2023

Thanks @xuezhaojun , I'm able to reproduce the error as well. It should be enough to set the // +k8s:deepcopy-gen=false to ClusterRolloutStatusFunc[T any] type similar to RolloutHandler[T any] type here . It is strange that it didn't show up with original PR . Based on the deepCopy code doc here setting the deepcopy-gen=false should work.

Hi, @serngawy , unfortunately, adding // +k8s:deepcopy-gen=false to ClusterRolloutStatusFunc[T any] doesn't work, because the root cause is generic type, when deepcopy-gen parsing the code of a generic type, it end up with getting 2 types:

I1017 16:48:42.317012    5707 deepcopy.go:273] Type open-cluster-management.io/api/cluster/v1alpha1.RolloutHandler[T any] is not copyable
I1017 16:48:42.317023    5707 deepcopy.go:276] Type open-cluster-management.io/api/cluster/v1alpha1.RolloutHandler[T] is copyable

You can see from the above log, // +k8s:deepcopy-gen=false only works for RolloutHandler[T any] so it's shown as not capable. But for RolloutHandler[T](which I think is a result of incorrect parsering) is copyable.

@qiujian16
Copy link
Member

hrm, I thought make verify already cover the process of make update...

@qiujian16
Copy link
Member

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16, xuezhaojun

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@xuezhaojun
Copy link
Member Author

xuezhaojun commented Oct 18, 2023

This PR is not the final solution, I will follow up to watch the progress of code-gen libs's generic type supporting, and we will solve this before upgrade these generic types to v1beta1.

@xuezhaojun
Copy link
Member Author

/assign @haoqing0110

@haoqing0110
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Oct 18, 2023
@openshift-ci openshift-ci bot merged commit ae208c8 into open-cluster-management-io:main Oct 18, 2023
10 checks passed
@xuezhaojun xuezhaojun deleted the fix-generic-type-not-support-error branch October 18, 2023 03:04
dhaiducek added a commit to dhaiducek/api that referenced this pull request Oct 18, 2023
dhaiducek added a commit to dhaiducek/api that referenced this pull request Oct 18, 2023
@dhaiducek
Copy link
Member

@xuezhaojun I noticed this PR merged, but I opened a PR off of my branch in case there was interest in going the controller-gen route instead:

@serngawy
Copy link
Member

@xuezhaojun I noticed this PR merged, but I opened a PR off of my branch in case there was interest in going the controller-gen route instead:

+1 for using controller-gen it's more cleaner , we don't need to set deep-copy for every struct

@xuezhaojun
Copy link
Member Author

@serngawy @dhaiducek Thanks for submitting the fix! vote to this alternative, great work!

openshift-ci bot pushed a commit that referenced this pull request Oct 27, 2023
…#291)

* Revert "Fix: run `make update` fail because deepcopy doesn't support generic type. (#288)"

This reverts commit ae208c8.

Signed-off-by: Dale Haiducek <[email protected]>

* Use `controller-gen` for deepcopy cluster:v1alpha1

GenGo isn't respecting the `+k8s:deepcopy-gen=false` tag to skip
generation for the generic type

Signed-off-by: Dale Haiducek <[email protected]>

---------

Signed-off-by: Dale Haiducek <[email protected]>
haoqing0110 pushed a commit to haoqing0110/api that referenced this pull request Nov 24, 2023
haoqing0110 pushed a commit to haoqing0110/api that referenced this pull request Nov 24, 2023
…open-cluster-management-io#291)

* Revert "Fix: run `make update` fail because deepcopy doesn't support generic type. (open-cluster-management-io#288)"

This reverts commit ae208c8.

Signed-off-by: Dale Haiducek <[email protected]>

* Use `controller-gen` for deepcopy cluster:v1alpha1

GenGo isn't respecting the `+k8s:deepcopy-gen=false` tag to skip
generation for the generic type

Signed-off-by: Dale Haiducek <[email protected]>

---------

Signed-off-by: Dale Haiducek <[email protected]>
haoqing0110 pushed a commit to haoqing0110/api that referenced this pull request Nov 24, 2023
haoqing0110 pushed a commit to haoqing0110/api that referenced this pull request Nov 24, 2023
…open-cluster-management-io#291)

* Revert "Fix: run `make update` fail because deepcopy doesn't support generic type. (open-cluster-management-io#288)"

This reverts commit ae208c8.

Signed-off-by: Dale Haiducek <[email protected]>

* Use `controller-gen` for deepcopy cluster:v1alpha1

GenGo isn't respecting the `+k8s:deepcopy-gen=false` tag to skip
generation for the generic type

Signed-off-by: Dale Haiducek <[email protected]>

---------

Signed-off-by: Dale Haiducek <[email protected]>
haoqing0110 pushed a commit to haoqing0110/api that referenced this pull request Nov 24, 2023
Signed-off-by: melserngawy <[email protected]>

Fix: run `make update` fail because deepcopy doesn't support generic type. (open-cluster-management-io#288)

Signed-off-by: xuezhaojun <[email protected]>

Fix verify ci step missing. (open-cluster-management-io#289)

Signed-off-by: xuezhaojun <[email protected]>

:bug: Use controller-runtime for deepcopy generation for cluster:v1alpha1 (open-cluster-management-io#291)

* Revert "Fix: run `make update` fail because deepcopy doesn't support generic type. (open-cluster-management-io#288)"

This reverts commit ae208c8.

Signed-off-by: Dale Haiducek <[email protected]>

* Use `controller-gen` for deepcopy cluster:v1alpha1

GenGo isn't respecting the `+k8s:deepcopy-gen=false` tag to skip
generation for the generic type

Signed-off-by: Dale Haiducek <[email protected]>

---------

Signed-off-by: Dale Haiducek <[email protected]>

🐛 add ca bundle to addon proxy settings (open-cluster-management-io#293)

Signed-off-by: Yang Le <[email protected]>

Revert "remove ClusterSet ClusterSetBinding API version v1beta1 (open-cluster-management-io#266)"

This reverts commit 9675ab7.

Signed-off-by: haoqing0110 <[email protected]>
openshift-merge-bot bot pushed a commit that referenced this pull request Nov 24, 2023
Fix: run `make update` fail because deepcopy doesn't support generic type. (#288)



Fix verify ci step missing. (#289)



:bug: Use controller-runtime for deepcopy generation for cluster:v1alpha1 (#291)

* Revert "Fix: run `make update` fail because deepcopy doesn't support generic type. (#288)"

This reverts commit ae208c8.



* Use `controller-gen` for deepcopy cluster:v1alpha1

GenGo isn't respecting the `+k8s:deepcopy-gen=false` tag to skip
generation for the generic type



---------



🐛 add ca bundle to addon proxy settings (#293)



Revert "remove ClusterSet ClusterSetBinding API version v1beta1 (#266)"

This reverts commit 9675ab7.

Signed-off-by: haoqing0110 <[email protected]>
Co-authored-by: Mohamed ElSerngawy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants