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

Enable golinting for scheduler packages. #58437

Merged
merged 2 commits into from
Feb 9, 2018

Conversation

tossmilestone
Copy link
Member

@tossmilestone tossmilestone commented Jan 18, 2018

What this PR does / why we need it:
Enable golinting for scheduler packages

Which issue(s) this PR fixes:
Fixes #58234

Special notes for your reviewer:

  • pkg/scheduler/api and pkg/scheduler/api/v1 are not removed from hack/.golint_failures, because there are auto-generated go files by deepcopy-gen in the package, which have golint errors and are not suggested manually edited.
  • Please help to refine the comments if there are error or inaccurate descriptions. Thanks!

Release note:

Enable golint for `pkg/scheduler` and fix the golint errors in it.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 18, 2018
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 18, 2018
@resouer
Copy link
Contributor

resouer commented Jan 18, 2018

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 18, 2018
@resouer
Copy link
Contributor

resouer commented Jan 18, 2018

@tossmilestone Could you rebase your commits into two?

Commit 1. Enable golint for pkg/scheduler
Commit 2. Fix golint errors in pkg/scheduler based on golint check

@tossmilestone
Copy link
Member Author

tossmilestone commented Jan 18, 2018

@resouer updated, PTAL!
/cc @k82cn @ravisantoshgudimetla

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jan 18, 2018
@tossmilestone tossmilestone force-pushed the scheduler-golint branch 2 times, most recently from ab7065f to 2751ccf Compare January 19, 2018 06:20
@@ -53,9 +53,9 @@ func TestMakeTransportValid(t *testing.T) {
EnableHttps: true,
TLSClientConfig: restclient.TLSClientConfig{
CertFile: "../../client/testdata/mycertvalid.cer",
// TLS Configuration, only applies if EnableHttps is true.
// TLS Configuration, only applies if EnableHTTPs is true.
Copy link
Contributor

Choose a reason for hiding this comment

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

EnableHttps is the flag here at 2751ccf#diff-00db4807093c02bb99fd7c3c4d9f5bc5L53, so need for this change I think.

Copy link
Member Author

@tossmilestone tossmilestone Jan 20, 2018

Choose a reason for hiding this comment

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

Yes, it should be not changed.

// TaintNodeNotReady would be automatically added by node controller
// when node is not ready, and removed when node becomes ready.
// TaintNodeNotReady would be automatically added by node controller,
// when feature-gate for TaintBasedEvictions=true flag is enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably TaintBasedEvictions flag is enabled

// TaintNodeUnreachable would be automatically added by node controller
// when node becomes unreachable (corresponding to NodeReady status ConditionUnknown)
// when feature-gate for TaintBasedEvictions=true flag is enabled and
Copy link
Contributor

Choose a reason for hiding this comment

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

I think for sake of consistency we can start with TaintNodeUnreachable will be added when node becomes..

@@ -25,11 +25,11 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
corelisters "k8s.io/client-go/listers/core/v1"
. "k8s.io/kubernetes/pkg/scheduler/algorithm"
algo "k8s.io/kubernetes/pkg/scheduler/algorithm"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Probably algorithm may be a better name.

@ravisantoshgudimetla
Copy link
Contributor

Thanks @tossmilestone for working on this!! Just some minor nits, rest look good to me. I will let @k82cn and @resouer to provide their feedback before merge.

@tossmilestone
Copy link
Member Author

tossmilestone commented Jan 20, 2018

@ravisantoshgudimetla Thanks a lot for your review on so many changes! I will fix the errors soon.
Updated, PTAL!

@tossmilestone
Copy link
Member Author

tossmilestone commented Jan 22, 2018

/test pull-kubernetes-e2e-kops-aws

@@ -451,7 +456,7 @@ func podFitsOnNode(
// TODO(bsalamat): consider using eCache and adding proper eCache invalidations
// when pods are nominated or their nominations change.
eCacheAvailable = eCacheAvailable && !podsAdded
for _, predicateKey := range predicates.PredicatesOrdering() {
for _, predicateKey := range predicates.Ordering() {
Copy link
Member

Choose a reason for hiding this comment

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

Why change this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because PredicatesOrdering caused the error:
pkg/scheduler/algorithm/predicates/predicates.go:152:6: func name will be used as predicates.PredicatesOrdering by other packages, and that stutters; consider calling this Ordering

Copy link
Member

Choose a reason for hiding this comment

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

Do we touch any code about PredicatesOrdering ? Not sure why it works before but failed in this PR :(.

Copy link
Member

Choose a reason for hiding this comment

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

Found the code about renaming.

@ravisantoshgudimetla
Copy link
Contributor

/lgtm

/assign @k82cn

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 22, 2018
@tossmilestone tossmilestone force-pushed the scheduler-golint branch 2 times, most recently from ffa8882 to 72e0be5 Compare January 26, 2018 09:44
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 27, 2018
@tossmilestone
Copy link
Member Author

/unassign @pwittrock

@tossmilestone
Copy link
Member Author

/assign @liggitt

@tossmilestone tossmilestone force-pushed the scheduler-golint branch 2 times, most recently from 00cf4e3 to 86effd7 Compare February 3, 2018 08:37
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 7, 2018
@tossmilestone
Copy link
Member Author

@liggitt please help to review the PR if you are free, thanks! 😄

@liggitt
Copy link
Member

liggitt commented Feb 8, 2018

looks like the only thing that still requires approval is the hack dir change enabling linting on those folders. that looks fine, but the PR needs a squash before merge (still has several merge commits present)

@tossmilestone
Copy link
Member Author

@liggitt commits have been squashed, please take a look 😄

@tossmilestone
Copy link
Member Author

/retest

@liggitt
Copy link
Member

liggitt commented Feb 9, 2018

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 9, 2018
@tossmilestone
Copy link
Member Author

@ravisantoshgudimetla needs your lgtm to merge the PR 😄

@ravisantoshgudimetla
Copy link
Contributor

/lgtm

Thanks again @tossmilestone for working on this issue.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 9, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: k82cn, liggitt, ravisantoshgudimetla, tossmilestone

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 OWNERS Files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit c179b8a into kubernetes:master Feb 9, 2018
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable golinting for scheduler packages
9 participants