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

[Swap][Tests][KEP2400] Add swap serial stress tests, improve NodeConformance tests and adapt NoSwap behavior #123557

Merged

Conversation

iholder101
Copy link
Contributor

@iholder101 iholder101 commented Feb 28, 2024

What type of PR is this?

/kind feature

Fixes #120798

What this PR does / why we need it:

This PR does the following:

  1. Havily refactors and cleans swap node-e2e tests.
  2. Adapt swap NodeConformance test to [KEP-2400] add no swap as the default option for swap #122745 which drops UnlimitedSwap and introduces NoSwap behavior.
  3. Adds serial tests for swap.

To expand on (3), two serial tests are now added which validate the following scenarios:

  1. "should be able over-commit the node memory" - a pod is deployed which stresses memory. The test expects that once the pod uses all of the node's memory some of its memory would be swapped away.
  2. "should be able to use more memory than memory limits" - a pod with memory limits stresses memory. Eventually it goes beyond its memory limits and instead of being OOM killed some of its memory is swapped away keeping it alive.

Special notes for your reviewer:

The original version of this PR was here: #120430

Due to unfortunate situations I had to be out of work for a while, therefore my PR was closed and continued here: #122175

Fortunately I was able to come back to work and therefore the PR is now continued here.

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2400-node-swap/README.md

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 28, 2024
@k8s-ci-robot k8s-ci-robot added area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 28, 2024
@iholder101
Copy link
Contributor Author

/test pull-kubernetes-node-swap-fedora
/test pull-kubernetes-node-swap-fedora-serial
/test pull-kubernetes-node-swap-ubuntu-serial

@iholder101
Copy link
Contributor Author

PR is not ready to review yet.

/uncc @dchen1107 @andrewsykim

@kannon92
Copy link
Contributor

/cc

when it is ready

@iholder101 iholder101 force-pushed the swap/enhance-swap-functests-serial branch 3 times, most recently from 3b43518 to dd4dda6 Compare March 4, 2024 13:33
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 4, 2024
@iholder101 iholder101 force-pushed the swap/enhance-swap-functests-serial branch from dd4dda6 to f21e542 Compare March 4, 2024 13:33
@iholder101
Copy link
Contributor Author

@dchen1107 @kannon92 can you PTAL?

@haircommander
Copy link
Contributor

/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 20, 2024
@@ -67,6 +66,13 @@ func InitFeatureGates(defaults featuregate.FeatureGate, overrides map[string]boo
return nil
}

func IsFeatureGateEnabled(feature featuregate.Feature) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you added documentation? Feature gate testing is one of those areas that have been misunderstood by test authors in the past.

I'll re-add LGTM and approve when done.

/lgtm cancel

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @pohly!
An important comment indeed. I'm also a victim of misunderstanding how it works :)

I've added the following documentation, let me know what you think:

// IsFeatureGateEnabled can be used during e2e tests to figure out if a certain feature gate is enabled.
// This function is dependent on InitFeatureGates under the hood. Therefore, the test must be called with a
// --feature-gates parameter.

Copy link
Contributor

Choose a reason for hiding this comment

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

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 21, 2024
@k8s-ci-robot k8s-ci-robot requested a review from mrunalp May 21, 2024 07:25
@iholder101 iholder101 force-pushed the swap/enhance-swap-functests-serial branch from f17c75d to c3f16c5 Compare May 21, 2024 08:19
Also, Remove wrong documentation about
tempSetCurrentKubeletConfig() returning bool

Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
- Add getSleepingPod() helper function
- Refactor: quantity functions to return resource.quantity instead of int64
- Improve helper functions for memory capacity

Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
- Improve cgroup file read: execute from container instead of host
- Clean unused variables/functions
- BeTrue/BeFalse -> BeTrueBecause/BeFalseBecause
- Use agnhost instread of stress image
- Improve description and fix typo

Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
@iholder101 iholder101 force-pushed the swap/enhance-swap-functests-serial branch from c3f16c5 to e9b1a5e Compare May 21, 2024 08:20
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 21, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 28577892d5393e726a040f7037ea93e709e7e02b

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iholder101, mrunalp, pohly

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 May 21, 2024
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented May 21, 2024

@iholder101: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-node-swap-ubuntu-serial fd26dac link false /test pull-kubernetes-node-swap-ubuntu-serial
pull-kubernetes-node-swap-fedora-serial fd26dac link false /test pull-kubernetes-node-swap-fedora-serial

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-sigs/prow repository. I understand the commands that are listed here.

@iholder101
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit c0f4879 into kubernetes:master May 21, 2024
16 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.31 milestone May 21, 2024
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/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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/node Categorizes an issue or PR as relevant to SIG Node. 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. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

[KEP-2400] [Swap]: SwapConformance e2e testing
9 participants