-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Even Pods Spread - 6. Integration Test #80011
Conversation
/retest |
/retest |
Need to revise ApplyFeaturegate() which is leaking changes to global state of pred/prio map. I will find time to resolve that and come back. |
4b89f08
to
95eba90
Compare
Can you please rebase? |
/retest |
@@ -152,6 +156,27 @@ func (p *PodWrapper) Namespace(s string) *PodWrapper { | |||
return p | |||
} | |||
|
|||
// Container appends a container into PodSpec of the inner pod | |||
func (p *PodWrapper) Container(s string) *PodWrapper { |
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.
s
-> image
to avoid misunderstanding of s being the container name.
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.
It's usually a pattern to make the variable short within a clear context. But if the context contains both namespace/name and image, yes, making the name more descriptive weighs simplicity.
pkg/scheduler/testing/wrappers.go
Outdated
@@ -152,6 +156,27 @@ func (p *PodWrapper) Namespace(s string) *PodWrapper { | |||
return p | |||
} | |||
|
|||
// Container appends a container into PodSpec of the inner 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.
nit: add period at the end of the comment.
pkg/scheduler/testing/wrappers.go
Outdated
} | ||
|
||
// Zero sets the TerminationGracePeriodSeconds of the inner pod to zero. | ||
func (p *PodWrapper) Zero() *PodWrapper { |
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 prefer to explicitly name it something like ZeroTerminationGracePeriod
or NoTerminationGrace
. Zero
doesn't communicate clearly.
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
} | ||
if err != nil { | ||
// This could be a connection error so we want to retry. | ||
return false, nil |
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 checking errors.IsNotFound(err)
and err != nil
separately? The return values are identical.
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.
Good catch. Only if err != nil
should be kept. I updated all the occurrences.
// This could be a connection error so we want to retry. | ||
return false, nil | ||
} | ||
if pod.Spec.NodeName == "" { |
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 seems unnecessary if the passed in nodeNames are not empty. But feel free to disregard if the purpose is to short-circuit.
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.
Yes, sort of short-circuit.
name string | ||
pod *v1.Pod | ||
pods []*v1.Pod | ||
fits bool |
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.
nit: add a comment on what does fits
mean. success
is probably a better name.
pause := imageutils.GetPauseImageName() | ||
tests := []struct { | ||
name string | ||
pod *v1.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.
nit: same as above, more specific naming
want []string // nodes expected to schedule onto | ||
}{ | ||
// note: naming starts at index 0 | ||
// the symbol ~X~ means that node is infeasible |
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.
To make it easy to follow, why not use a list where list[i]=N means i
th node has N pods on it. E.g., [3,1,1,1] means there are 3 pods on node 0 and node 0 is infeasible.
t.Run(tt.name, func(t *testing.T) { | ||
allPods := append(tt.pods, tt.pod) | ||
defer cleanupPods(cs, t, allPods) | ||
for _, pod := range tt.pods { |
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 pod creation can go to a helper function that can be reused in predicates_test
want: []string{"node-1", "node-2", "node-3"}, | ||
}, | ||
{ | ||
name: "pod is required to be placed on zone0, so only node-1 fits", |
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.
Both node 0 and 1 are labeled "zone 0", so why does only node-1 fit?
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.
Because node 0 has one pod already (L1001).
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.
Thanks for explaining it to me.
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.
minor stuff, looks great, I will lgtm once you address the other reviewer's comments.
pkg/scheduler/testing/wrappers.go
Outdated
} | ||
|
||
// Zero sets the TerminationGracePeriodSeconds of the inner pod to zero. | ||
func (p *PodWrapper) Zero() *PodWrapper { |
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
pause := imageutils.GetPauseImageName() | ||
tests := []struct { | ||
name string | ||
pod *v1.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.
+1
pod *v1.Pod | ||
pods []*v1.Pod | ||
fits bool | ||
want []string // nodes expected to schedule onto |
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.
s/want/candidateNodes?
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.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Huang-Wei 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 |
/lgtm Thanks @Huang-Wei! |
/hold cancel |
/lgtm |
@liu-cong: changing LGTM is restricted to collaborators In response to this:
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. |
/retest |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/retest |
1 similar comment
/retest |
TestVolumeProvision keeps failing. /retest |
/retest |
/lgtm |
@Huang-Wei: The following tests 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?
/sig scheduling
/kind feature
/priority important-soon
/hold
/assign @bsalamat @ahg-g
/cc @krmayankk
What this PR does / why we need it:
This is the 6th PR of the "Even Pods Spread" KEP implementation. It focuses on integration tests.
Which issue(s) this PR fixes:
Part of #77284.
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
(will document all the changes in one place)