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

optimize unstructured convert methods #2311

Merged

Conversation

weilaaa
Copy link
Member

@weilaaa weilaaa commented Aug 2, 2022

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Instead of adding a conversion function for each resource, we should replace it with a generic conversion function.

@karmada-bot karmada-bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Aug 2, 2022
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 2, 2022
@weilaaa weilaaa force-pushed the optimize_unstructured_convert_methods branch from 01bd99c to 9a29630 Compare August 2, 2022 11:46
@RainbowMango
Copy link
Member

Generally looks good. We didn't use the Golang generic feature in this patch, right? (I didn't see it, just a confirmation).

@weilaaa
Copy link
Member Author

weilaaa commented Aug 3, 2022

Generally looks good. We didn't use the Golang generic feature in this patch, right? (I didn't see it, just a confirmation).

Not yet, when upgrading to go 1.18, consider using generics.

@weilaaa weilaaa force-pushed the optimize_unstructured_convert_methods branch from c00673e to 1500254 Compare August 3, 2022 01:45
@RainbowMango
Copy link
Member

Not yet, when upgrading to go 1.18, consider using generics.

I'm hesitant to introduce generics even though we are already in Go1.18. Because technically we can use generics in master(v1.3), but can't cherry-pick patches to release branches(<=release-1.2).
Basically, I agree with Kubernetes Generics Policy.

@weilaaa weilaaa force-pushed the optimize_unstructured_convert_methods branch from 113939d to 151b3f1 Compare August 3, 2022 02:47
@weilaaa
Copy link
Member Author

weilaaa commented Aug 3, 2022

Not yet, when upgrading to go 1.18, consider using generics.

I'm hesitant to introduce generics even though we are already in Go1.18. Because technically we can use generics in master(v1.3), but can't cherry-pick patches to release branches(<=release-1.2). Basically, I agree with Kubernetes Generics Policy.

Thanks for sharing, I read k8s generics policy and I agreed. We need to use generics sparingly.

@weilaaa
Copy link
Member Author

weilaaa commented Aug 3, 2022

/assign pigletfly RainbowMango

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

Looks great!
Let's fix the new added todo with this patch.

pkg/dependenciesdistributor/dependencies_distributor.go Outdated Show resolved Hide resolved
@weilaaa weilaaa force-pushed the optimize_unstructured_convert_methods branch from d472b43 to 3df223b Compare August 3, 2022 13:45
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/lgtm

You might need to squash your commits.

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2022
@weilaaa weilaaa force-pushed the optimize_unstructured_convert_methods branch from 3df223b to 6438571 Compare August 4, 2022 03:37
@karmada-bot karmada-bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2022
Signed-off-by: weilaaa <weilanidaye@gmail.com>
@weilaaa weilaaa force-pushed the optimize_unstructured_convert_methods branch from 6438571 to 4ed7010 Compare August 4, 2022 03:38
@weilaaa
Copy link
Member Author

weilaaa commented Aug 4, 2022

/lgtm

You might need to squash your commits.

PTAL again

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2022
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 4, 2022
@karmada-bot karmada-bot merged commit 7097347 into karmada-io:master Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants