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

Adopt deprecated AddToScheme functions #5177

Merged

Conversation

RainbowMango
Copy link
Member

@RainbowMango RainbowMango commented Jul 11, 2024

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
This PR adopts the deprecated AddToScheme and SchemeGroupVersion, which becomes the blocker of #5146.

# hack/verify-staticcheck.sh 
Using golangci-lint version:
golangci-lint has version 1.59.0 built with go1.22.3 from 2059b18a on 2024-05-26T18:13:27Z
pkg/apis/search/install/install.go:30:19: SA1019: searchv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(searchv1alpha1.AddToScheme(scheme))
	                 ^
pkg/util/gclient/gclient.go:45:19: SA1019: clusterv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(clusterv1alpha1.AddToScheme(aggregatedScheme))     // add cluster schemes
	                 ^
pkg/util/gclient/gclient.go:46:19: SA1019: configv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(configv1alpha1.AddToScheme(aggregatedScheme))      // add config v1alpha1 schemes
	                 ^
pkg/util/gclient/gclient.go:47:19: SA1019: networkingv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(networkingv1alpha1.AddToScheme(aggregatedScheme))  // add network v1alpha1 schemes
	                 ^
pkg/util/gclient/gclient.go:48:19: SA1019: policyv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(policyv1alpha1.AddToScheme(aggregatedScheme))      // add propagation schemes
	                 ^
pkg/util/gclient/gclient.go:49:19: SA1019: workv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(workv1alpha1.AddToScheme(aggregatedScheme))        // add work v1alpha1 schemes
	                 ^
pkg/util/gclient/gclient.go:50:19: SA1019: workv1alpha2.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(workv1alpha2.AddToScheme(aggregatedScheme))        // add work v1alpha2 schemes
	                 ^
pkg/util/gclient/gclient.go:51:19: SA1019: searchv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(searchv1alpha1.AddToScheme(aggregatedScheme))      // add search v1alpha1 schemes
	                 ^
pkg/util/gclient/gclient.go:54:19: SA1019: autoscalingv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(autoscalingv1alpha1.AddToScheme(aggregatedScheme)) // add autoscaling v1alpha1 schemes
	                 ^
pkg/util/gclient/gclient.go:55:19: SA1019: remedyv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(remedyv1alpha1.AddToScheme(aggregatedScheme))      // add remedy v1alpha1 schemes
	                 ^
pkg/util/gclient/gclient.go:56:19: SA1019: appsv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(appsv1alpha1.AddToScheme(aggregatedScheme))        // add apps v1alpha1 schemes
	                 ^
pkg/apis/cluster/install/install.go:30:19: SA1019: clusterv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
	utilruntime.Must(clusterv1alpha1.AddToScheme(scheme))
	                 ^
pkg/resourceinterpreter/customized/webhook/customized.go:57:3: SA1019: configv1alpha1.AddToScheme is deprecated: use Install instead (staticcheck)
		configv1alpha1.AddToScheme,

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
This is a kind of technical debt that I hope to do by a separate PR so that we can review it more carefully.
Does this PR introduce a user-facing change?:

NONE

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
@karmada-bot karmada-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Jul 11, 2024
@RainbowMango RainbowMango marked this pull request as ready for review July 11, 2024 07:19
@karmada-bot karmada-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 11, 2024
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 11, 2024
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 73.91304% with 6 lines in your changes missing coverage. Please review.

Project coverage is 28.24%. Comparing base (71de3dc) to head (5d14b8d).

Files Patch % Lines
...sourceinterpreter/customized/webhook/customized.go 0.00% 6 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5177      +/-   ##
==========================================
+ Coverage   28.22%   28.24%   +0.02%     
==========================================
  Files         632      632              
  Lines       43566    43570       +4     
==========================================
+ Hits        12296    12307      +11     
+ Misses      30371    30366       -5     
+ Partials      899      897       -2     
Flag Coverage Δ
unittests 28.24% <73.91%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

Thanks~
/lgtm
/cc @chaunceyjiang

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 11, 2024
@RainbowMango
Copy link
Member Author

Let's do this as it is a blocker. @chaunceyjiang Please leave your comments here if there are any.

By the way, I don't understand why the AddToScheme and SchemeGroupVersion are deprecated, but I don't want to skip the static check for this.

@RainbowMango RainbowMango added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 12, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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 merged commit 7f0961f into karmada-io:master Jul 12, 2024
12 checks passed
@RainbowMango RainbowMango deleted the pr_adopt_deprecated_addtoscheme branch August 27, 2024 08:21
@RainbowMango RainbowMango added this to the v1.11 milestone Aug 31, 2024
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants