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

Fix staticcheck warnings on cmd and example #3720

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

xovoxy
Copy link
Contributor

@xovoxy xovoxy commented Sep 12, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

fix staticcheck warnings on cmd and example, warnings like this

cmd/controller-manager/app/server.go:84:9: opt.LockObjectNamespace is deprecated: use ResourceNamespace instead.  (SA1019)
cmd/controller-manager/app/server.go:85:42: opt.LockObjectNamespace is deprecated: use ResourceNamespace instead.  (SA1019)
cmd/scheduler/app/server.go:117:9: opt.LockObjectNamespace is deprecated: use ResourceNamespace instead.  (SA1019)
cmd/scheduler/app/server.go:118:42: opt.LockObjectNamespace is deprecated: use ResourceNamespace instead.  (SA1019)
cmd/webhook-manager/app/util.go:49:13: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
cmd/webhook-manager/app/util.go:82:13: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
example/extender/extender.go:28:5: var snapshot is unused (U1000)

Which issue(s) this PR fixes:

Parts of #3713

@volcano-sh-bot
Copy link
Contributor

Welcome @xovoxy!

It looks like this is your first PR to volcano-sh/volcano.

Thank you, and welcome to Volcano. 😃

@volcano-sh-bot volcano-sh-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 12, 2024
@volcano-sh-bot volcano-sh-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 12, 2024
@xovoxy
Copy link
Contributor Author

xovoxy commented Sep 12, 2024

hi @hwdef, i fix the staticcheck warnings, could you have a look? thanks~
/assign @hwdef

Copy link
Member

@hwdef hwdef left a comment

Choose a reason for hiding this comment

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

/ok-to-test
By the way, this PR is too long. If it can be split into multiple parts, it may be more convenient to review.

@volcano-sh-bot volcano-sh-bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Sep 12, 2024
@xovoxy
Copy link
Contributor Author

xovoxy commented Sep 12, 2024

/ok-to-test By the way, this PR is too long. If it can be split into multiple parts, it may be more convenient to review.

ohh right, let me split it~

@volcano-sh-bot volcano-sh-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 12, 2024
@xovoxy xovoxy changed the title Fix staticcheck warnings Fix staticcheck warnings on cmd and example Sep 12, 2024
@@ -21,6 +21,7 @@ import (
"io"
"net/http"

"k8s.io/klog"
Copy link
Member

Choose a reason for hiding this comment

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

Currently volcano should be using v2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Monokaix
Copy link
Member

Monokaix commented Oct 8, 2024

/ok-to-test

@@ -49,6 +50,7 @@ func onSessionOpen(w http.ResponseWriter, r *http.Request) {
NamespaceInfo: req.NamespaceInfo,
RevocableNodes: req.RevocableNodes,
}
klog.V(4).Infof("the snapshot of cluster %+v", *snapshot)
Copy link
Member

Choose a reason for hiding this comment

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

Why add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

example/extender/extender.go:28:5: var snapshot is unused (U1000)

add this code to avoid staticcheck warnings, or delete the field. i think adding a log for this is better. if you have a better method, can tell me.

@@ -46,7 +46,7 @@ func addCaCertForWebhook(kubeClient *kubernetes.Clientset, service *router.Admis
var mutatingWebhookName = volcanoAdmissionPrefix + strings.ReplaceAll(service.Path, "/", "-")
var mutatingWebhook *v1.MutatingWebhookConfiguration
webhookChanged := false
if err := wait.Poll(time.Second, 5*time.Minute, func() (done bool, err error) {
if err := wait.PollUntilContextTimeout(context.Background(), time.Second, 5*time.Minute, false, func(_ context.Context) (done bool, err error) {
Copy link
Member

Choose a reason for hiding this comment

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

How about set the immediate to true?

Copy link
Contributor Author

@xovoxy xovoxy Oct 10, 2024

Choose a reason for hiding this comment

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

alright, setting immediate to true more closely aligns with the behavior of wait.Poll, i have changed it.

@Monokaix
Copy link
Member

/lgtm

@volcano-sh-bot volcano-sh-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 10, 2024
@hwdef
Copy link
Member

hwdef commented Oct 10, 2024

/approve

@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hwdef

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

@volcano-sh-bot volcano-sh-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 10, 2024
@volcano-sh-bot volcano-sh-bot merged commit 7dfa8c6 into volcano-sh:master Oct 10, 2024
17 checks passed
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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants