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

Even Pods Spread - 6. Integration Test #80011

Merged
merged 1 commit into from
Aug 2, 2019

Conversation

Huang-Wei
Copy link
Member

@Huang-Wei Huang-Wei commented Jul 11, 2019

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)

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jul 11, 2019
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. kind/feature Categorizes issue or PR as related to a new feature. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jul 11, 2019
@k8s-ci-robot k8s-ci-robot requested a review from krmayankk July 11, 2019 04:17
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/test kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Jul 11, 2019
@Huang-Wei
Copy link
Member Author

/retest

@Huang-Wei
Copy link
Member Author

/retest

@Huang-Wei
Copy link
Member Author

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.

@Huang-Wei Huang-Wei force-pushed the eps-int-test branch 2 times, most recently from 4b89f08 to 95eba90 Compare July 14, 2019 17:49
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 18, 2019
@ahg-g
Copy link
Member

ahg-g commented Jul 29, 2019

Can you please rebase?

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 29, 2019
@Huang-Wei
Copy link
Member Author

@ahg-g Rebase completed. PTAL.

BTW: this PR is dependent on #80144 (I cherrypicked that PR here).

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 29, 2019
@Huang-Wei
Copy link
Member Author

/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 {
Copy link
Contributor

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.

Copy link
Member Author

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.

@@ -152,6 +156,27 @@ func (p *PodWrapper) Namespace(s string) *PodWrapper {
return p
}

// Container appends a container into PodSpec of the inner pod
Copy link
Contributor

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.

}

// Zero sets the TerminationGracePeriodSeconds of the inner pod to zero.
func (p *PodWrapper) Zero() *PodWrapper {
Copy link
Contributor

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.

Copy link
Member

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
Copy link
Contributor

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.

Copy link
Member Author

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 == "" {
Copy link
Contributor

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.

Copy link
Member Author

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 ith 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 {
Copy link
Contributor

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",
Copy link
Contributor

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?

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 node 0 has one pod already (L1001).

Copy link
Contributor

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.

Copy link
Member

@ahg-g ahg-g left a 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.

}

// Zero sets the TerminationGracePeriodSeconds of the inner pod to zero.
func (p *PodWrapper) Zero() *PodWrapper {
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

s/want/candidateNodes?

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-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 1, 2019
@ahg-g
Copy link
Member

ahg-g commented Aug 1, 2019

/lgtm

Thanks @Huang-Wei!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 1, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 1, 2019
@Huang-Wei
Copy link
Member Author

Thanks @ahg-g and @liu-cong for reviewing!

Just squashed the commits. Will ask for /lgtm later.

@Huang-Wei
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 1, 2019
@liu-cong
Copy link
Contributor

liu-cong commented Aug 1, 2019

/lgtm

@k8s-ci-robot
Copy link
Contributor

@liu-cong: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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.

@Huang-Wei
Copy link
Member Author

/retest

@fejta-bot
Copy link

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.

@Huang-Wei
Copy link
Member Author

/retest

1 similar comment
@Huang-Wei
Copy link
Member Author

/retest

@Huang-Wei
Copy link
Member Author

TestVolumeProvision keeps failing.

/retest

@Huang-Wei
Copy link
Member Author

/retest

@ahg-g
Copy link
Member

ahg-g commented Aug 1, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 1, 2019
@k8s-ci-robot k8s-ci-robot merged commit e857ae0 into kubernetes:master Aug 2, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 2, 2019
@Huang-Wei Huang-Wei deleted the eps-int-test branch August 2, 2019 00:40
@k8s-ci-robot
Copy link
Contributor

@Huang-Wei: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-gce-100-performance caab8b7 link /test pull-kubernetes-e2e-gce-100-performance
pull-kubernetes-e2e-gce caab8b7 link /test pull-kubernetes-e2e-gce
pull-kubernetes-kubemark-e2e-gce-big caab8b7 link /test pull-kubernetes-kubemark-e2e-gce-big

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.

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. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants