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

Moved qos to api.helpers. #44906

Merged
merged 2 commits into from
May 22, 2017

Conversation

k82cn
Copy link
Member

@k82cn k82cn commented Apr 25, 2017

What this PR does / why we need it:
The GetPodQoS is also used by other components, e.g. kube-scheduler and it's not bound to kubelet; moved it to api helpers so client-go.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #N/A

Release note:

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 25, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Apr 25, 2017
@k82cn
Copy link
Member Author

k82cn commented Apr 25, 2017

xref: #44851

@k82cn
Copy link
Member Author

k82cn commented Apr 25, 2017

@k8s-bot unit test this

@k82cn
Copy link
Member Author

k82cn commented Apr 26, 2017

ping :).

@k82cn
Copy link
Member Author

k82cn commented Apr 27, 2017

ping @jayunit100 / @dchen1107 :).

@k82cn
Copy link
Member Author

k82cn commented Apr 27, 2017

/cc @lavalamp , @deads2k , @caesarxuchao

Another example that, the util func GetPodQOS is used by several components. I moved it to api.helper; as it's more reasonable to be global helper func instead of kubelet's helper.

@k82cn
Copy link
Member Author

k82cn commented Apr 28, 2017

ping for this PR :). I'd like to move it to api.helper firstly, and then we can handler it with other help funcs together.

@@ -499,3 +500,155 @@ func TestGetAffinityFromPodAnnotations(t *testing.T) {
}
}
}

func TestGetPodQOS(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to have a test (I think this one), that does a conversion to internal and runs the internal version of the function to make sure that it agrees with the external version of the function.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure; I'll add a test for internal one.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure; I'll add a test for internal one.

The key piece bit is that its the same test, not a copy/paste. That way a change in one will cause the test fail. A separate test won't achieve the same goal.

@deads2k
Copy link
Contributor

deads2k commented Apr 28, 2017

I'd like a test to make sure that the implementations stay in sync, but after that, this lgtm.

@k82cn k82cn force-pushed the moved_qos_to_v1helper branch 2 times, most recently from 733ae2e to b51e41b Compare April 30, 2017 01:50
@k82cn
Copy link
Member Author

k82cn commented Apr 30, 2017

@deads2k , added a conversion within one test case.

@deads2k
Copy link
Contributor

deads2k commented May 1, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 1, 2017
@caesarxuchao
Copy link
Member

@k82cn are you going to use the helper functions in client-go/pkg/api? They are going to disappear after we move the external types to k8s.io/api.

@caesarxuchao
Copy link
Member

Can you add a deprecation notice in client-go saying that pkg/api is going to disappear?

@k82cn
Copy link
Member Author

k82cn commented May 2, 2017

@caesarxuchao , this PRs just focus on moving common funcs to helpers. I'd like to follow the way how k8s.io/api handle api.helpers, including this GetPodQOS func.

@caesarxuchao
Copy link
Member

@k82cn k8s/api only have external types (i.e., excluding pkg/api/types.go), so it won't include any helper functions that in pkg/api/.

Also, client-go will import types from k8s/api and stop copying the entire pkg/api and pkg/apis folder, so client-go won't have the helper functions either.

@k82cn
Copy link
Member Author

k82cn commented May 2, 2017

@caesarxuchao , for where to place those helper funcs, I'd suggest to continue the discuss at #44851

In this PRs, it try to avoid introducing package dependency between kubelet & others; after moving to api.helper, we just need to discuss how to handle api.helpers.

@k82cn
Copy link
Member Author

k82cn commented May 16, 2017

ping @caesarxuchao for lgtm :).

go_library(
name = "go_default_library",
srcs = ["qos.go"],
tags = ["automanaged"],
Copy link
Member

Choose a reason for hiding this comment

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

Can you add the visibility rule like this: #46006

Copy link
Member Author

Choose a reason for hiding this comment

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

done :).

@@ -11,7 +11,6 @@ go_library(
name = "go_default_library",
srcs = ["install.go"],
tags = ["automanaged"],
visibility = ["//visibility:private"],
Copy link
Member

Choose a reason for hiding this comment

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

Why removing the visibility rule?

Copy link
Member

Choose a reason for hiding this comment

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

Is it a rebase issue? You removed all the rules.

go_library(
name = "go_default_library",
srcs = ["helpers.go"],
tags = ["automanaged"],
visibility = ["//visibility:private"],
Copy link
Member

Choose a reason for hiding this comment

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

Please keep the visibility rule.

Copy link
Member Author

Choose a reason for hiding this comment

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

hm, just run update-bazel scripts :). let me check it.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -1,5 +1,5 @@
/*
Copyright 2016 The Kubernetes Authors.
Copyright 2017 The Kubernetes Authors.
Copy link
Member

Choose a reason for hiding this comment

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

Please don't change the year.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, got it.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// NOTE: DO NOT use those helper functions through client-go, the
Copy link
Member

@caesarxuchao caesarxuchao May 18, 2017

Choose a reason for hiding this comment

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

We don't need to add the NOTE here now, we restrict the visibility of the package in the BUILD file. (sorry)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2017
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 19, 2017
@k82cn
Copy link
Member Author

k82cn commented May 19, 2017

@k8s-bot kops aws e2e test this

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 20, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 20, 2017
@k82cn
Copy link
Member Author

k82cn commented May 21, 2017

@k8s-bot pull-kubernetes-federation-e2e-gce test this

@caesarxuchao
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 22, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: caesarxuchao, deads2k, k82cn, lavalamp

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@caesarxuchao
Copy link
Member

@k82cn Thanks for bearing with me :)

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented May 22, 2017

@k82cn: The following test(s) failed:

Test name Commit Details Rerun command
pull-kubernetes-federation-e2e-gce fd0190f link @k8s-bot pull-kubernetes-federation-e2e-gce test this

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 91adb3e into kubernetes:master May 22, 2017
@k82cn k82cn deleted the moved_qos_to_v1helper branch May 23, 2017 00:49
@k82cn
Copy link
Member Author

k82cn commented May 23, 2017

my pleasure :).

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.

9 participants