-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Moved qos to api.helpers. #44906
Conversation
xref: #44851 |
@k8s-bot unit test this |
ping :). |
ping @jayunit100 / @dchen1107 :). |
/cc @lavalamp , @deads2k , @caesarxuchao Another example that, the util func |
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. |
pkg/api/v1/helper/helpers_test.go
Outdated
@@ -499,3 +500,155 @@ func TestGetAffinityFromPodAnnotations(t *testing.T) { | |||
} | |||
} | |||
} | |||
|
|||
func TestGetPodQOS(t *testing.T) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
I'd like a test to make sure that the implementations stay in sync, but after that, this lgtm. |
733ae2e
to
b51e41b
Compare
@deads2k , added a conversion within one test case. |
b51e41b
to
d3281c3
Compare
/lgtm |
@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. |
Can you add a deprecation notice in client-go saying that pkg/api is going to disappear? |
@caesarxuchao , this PRs just focus on moving common funcs to helpers. I'd like to follow the way how |
@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. |
@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 |
d43cbf0
to
e9c3643
Compare
ping @caesarxuchao for lgtm :). |
go_library( | ||
name = "go_default_library", | ||
srcs = ["qos.go"], | ||
tags = ["automanaged"], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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"], |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"], |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/api/v1/helper/qos/qos_test.go
Outdated
@@ -1,5 +1,5 @@ | |||
/* | |||
Copyright 2016 The Kubernetes Authors. | |||
Copyright 2017 The Kubernetes Authors. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, got it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/api/helper/helpers.go
Outdated
@@ -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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
e9c3643
to
aa7912a
Compare
@k8s-bot kops aws e2e test this |
fcf3a9f
to
fd0190f
Compare
@k8s-bot pull-kubernetes-federation-e2e-gce test this |
/lgtm |
[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 |
@k82cn Thanks for bearing with me :) |
@k82cn: The following test(s) failed:
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. |
Automatic merge from submit-queue |
my pleasure :). |
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/ARelease note: