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
move Get*(v1.Pod) into a new podinfo package #82212
Conversation
Hi @hprateek43. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
@misterikkit @alculquicondor Can you review the changes in reference to PR #76990 |
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-to-test
@@ -842,3 +844,14 @@ func multiplePodIPsInUse(podStatus *api.PodStatus) bool { | |||
} | |||
return false | |||
} | |||
|
|||
// GetPodPriority returns priority of the given pod. | |||
func GetPodPriority(pod *v1.Pod) int32 { |
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 are we moving this function here?
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.
The podinfo package has exactly the same 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.
Should I keep it here or in podinfo?
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.
Should I keep it here or in podinfo?
We should keep it in podinfo if it works well in this PR.
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.
+1
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.
wait, this is what the kubelet uses. But, this should actually go to pkg/api/v1/pod
.
You could consider open a separate PR just for moving this function, as it involves a different set of reviewers.
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.
Closing this PR and opening separate PR
pkg/kubelet/eviction/helpers.go
Outdated
volumeutils "k8s.io/kubernetes/pkg/volume/util" | ||
podinfo "k8s.io/kubernetes/pkg/api/pod" |
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.
this is weird and confusing, podutil could be a better same as other packages import this with podutil
"k8s.io/kubernetes/pkg/scheduler/volumebinder" | ||
volumeutil "k8s.io/kubernetes/pkg/volume/util" | ||
podinfo "k8s.io/kubernetes/pkg/scheduler/internal/podinfo" | ||
|
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.
extra line
pkg/scheduler/core/extender_test.go
Outdated
@@ -37,6 +37,7 @@ import ( | |||
schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo" | |||
schedulertesting "k8s.io/kubernetes/pkg/scheduler/testing" | |||
"k8s.io/kubernetes/pkg/scheduler/util" | |||
podinfo "k8s.io/kubernetes/pkg/api/pod" |
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.
ditto
@@ -36,6 +36,7 @@ import ( | |||
"k8s.io/apimachinery/pkg/util/errors" | |||
corelisters "k8s.io/client-go/listers/core/v1" | |||
"k8s.io/client-go/util/workqueue" | |||
podinfo "k8s.io/kubernetes/pkg/api/pod" |
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.
ditto
pkg/scheduler/util/heap.go
Outdated
@@ -240,12 +241,12 @@ func (h *Heap) Len() int { | |||
} | |||
|
|||
// NewHeap returns a Heap which can be used to queue up items to process. | |||
func NewHeap(keyFn KeyFunc, lessFn LessFunc) *Heap { | |||
func NewHeap(keyFn KeyFunc, lessFn podinfo.LessFunc) *Heap { |
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 should move LessFunc to this file IMO.
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.
@draveness Can you confirm the changes?
@@ -842,3 +844,14 @@ func multiplePodIPsInUse(podStatus *api.PodStatus) bool { | |||
} | |||
return false | |||
} | |||
|
|||
// GetPodPriority returns priority of the given pod. | |||
func GetPodPriority(pod *v1.Pod) int32 { |
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.
The podinfo package has exactly the same function.
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and | |||
limitations under the License. | |||
*/ | |||
|
|||
package util | |||
package podinfo |
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 are we going to move this into internal util pkg? It maybe useful for customized scheduler by framework.
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.
PR #76990 has discussion regarding moving this into an internal package
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.
@k82cn Can you confirm if we can move it into an internal package?
21d7703
to
e05cdbb
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: hprateek43 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
e05cdbb
to
495d109
Compare
495d109
to
8fd998a
Compare
/test pull-kubernetes-verify |
/test pull-kubernetes-kubemark-e2e-gce-big |
@hprateek43: The following test failed, say
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. |
What type of PR is this?
What this PR does / why we need it:
This is in reference to PR #76990 referencing to the issue #71863. The previous PR was large so is being refactored into smaller PRs as per recommendation.
Which issue(s) this PR fixes:
Fixes #71863
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: