Skip to content

Conversation

natasha41575
Copy link
Contributor

@natasha41575 natasha41575 commented Sep 25, 2025

What type of PR is this?

/kind cleanup
/area test

What this PR does / why we need it:

This PR is primarily a refactor of the pod resize e2e tests, largely for readability, but also increases coverage to cover a larger combination of things and more error cases.

I was going through them to make sure we don’t have significant gaps in coverage prior to GA, but I found it a little hard to systematically determine what cases we are covering, hence the refactor. I updated them to use nested ginkgo.Tables rather than go native subtests.

It is not practical to cover every possible combination of resize operations imaginable — the dimensions being qos, number of containers, number of init containers, operation (add, remove, increase, decrease), resource requirement (req or lim), and resource type (cpu or memory). This PR may have a slightly different subset of the possible combinations than the current tests have, but coverage of everything is still there and this PR definitely increases coverage. In fact, I think that some of the tests here are redundant and I’d be open to removing some of them for the sake of faster execution of the suite.

Special notes for your reviewer:

Some of the tests here (and some of the modifications I made to the test helpers) should be included in the v1.35 conformance suite, so this needs to merge early to allow for the 2 weeks of required soak time before we promote to conformance.

/sig node
/release-note-none

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XXL Denotes a PR that changes 1000+ 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. area/test sig/node Categorizes an issue or PR as relevant to SIG Node. labels Sep 25, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 25, 2025
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 25, 2025
@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Sep 25, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: natasha41575
Once this PR has been reviewed and has the lgtm label, please assign random-liu for approval. For more information see the Code Review Process.

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

@natasha41575
Copy link
Contributor Author

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 25, 2025
@natasha41575
Copy link
Contributor Author

/priority important-soon
/assign @tallclair

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 25, 2025
@natasha41575 natasha41575 changed the title refactor and increase coverage for pod resize tests [InPlacePodVerticalScaling] refactor and increase coverage for pod resize tests Sep 25, 2025
@natasha41575 natasha41575 moved this from Triage to PRs - Needs Reviewer in SIG Node CI/Test Board Sep 25, 2025
@natasha41575
Copy link
Contributor Author

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 25, 2025
@k8s-ci-robot
Copy link
Contributor

@natasha41575: 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-e2e-kind 43db829 link true /test pull-kubernetes-e2e-kind
pull-kubernetes-e2e-gce 43db829 link true /test pull-kubernetes-e2e-gce

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.

@tallclair
Copy link
Member

Test failures look legit.

@tallclair
Copy link
Member

In fact, I think that some of the tests here are redundant and I’d be open to removing some of them for the sake of faster execution of the suite.

+1 (but not in this PR)

Copy link
Member

@tallclair tallclair left a comment

Choose a reason for hiding this comment

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

Thanks for these changes, it's definitely more readable.

(but not in this PR)

I changed my mind... I left a few suggestions of dimensions to drop.

containers: []podresize.ResizableContainerInfo{
func doGuaranteedPodResizeTests(f *framework.Framework) {
ginkgo.Describe("guaranteed pods with a single regular container", func() {
ginkgo.DescribeTableSubtree("with various policies, init containers, and extended resources", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs, resizeInitCtrs, extendedResources bool) {
Copy link
Member

Choose a reason for hiding this comment

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

We're not resizing extended resources, just verifying that they're correctly copied to the status resources. Let's just add them on every test rather than making it a test dimension.

Copy link
Member

Choose a reason for hiding this comment

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

I feel like we could do something similar with hasInitCtrs.

)
})

ginkgo.DescribeTable("burstable pods - extended", func(ctx context.Context, originalContainers, expectedContainers []podresize.ResizableContainerInfo, doRollback bool) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: can you give this a more descriptive name, or add a comment

Comment on lines +75 to +76
ginkgo.Describe("guaranteed pods with a single regular container", func() {
ginkgo.DescribeTableSubtree("with various policies, init containers, and extended resources", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs, resizeInitCtrs, extendedResources bool) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: test case names are very verbose, e.g.

[sig-node] Pod InPlace Resize Container [FeatureGate:InPlacePodVerticalScaling] [Beta] guaranteed pods with a single regular container with various policies, init containers, and extended resources both cpu and mem restart policy, has initContainers, resize initContainers performing a resize operation increase cpu & decrease mem, then decrease cpu & increase mem

Suggested change
ginkgo.Describe("guaranteed pods with a single regular container", func() {
ginkgo.DescribeTableSubtree("with various policies, init containers, and extended resources", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs, resizeInitCtrs, extendedResources bool) {
ginkgo.DescribeTableSubtree("guaranteed pods, single regular container", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs, resizeInitCtrs, extendedResources bool) {

Comment on lines +218 to +219
ginkgo.Describe("burstable pods with a single regular container specifying all requests & limits", func() {
ginkgo.DescribeTableSubtree("with various policies", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs bool) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need the outer describe?

Suggested change
ginkgo.Describe("burstable pods with a single regular container specifying all requests & limits", func() {
ginkgo.DescribeTableSubtree("with various policies", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs bool) {
ginkgo.DescribeTableSubtree("burstable pods, single regular container with all requests & limits", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs bool) {

func doGuaranteedPodResizeTests(f *framework.Framework) {
ginkgo.Describe("guaranteed pods with a single regular container", func() {
ginkgo.DescribeTableSubtree("with various policies, init containers, and extended resources", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs, resizeInitCtrs, extendedResources bool) {
ginkgo.DescribeTable("performing a resize operation", func(ctx context.Context, desiredCPU, desiredMem string) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: for shorter test names

Suggested change
ginkgo.DescribeTable("performing a resize operation", func(ctx context.Context, desiredCPU, desiredMem string) {
ginkgo.DescribeTable("resize", func(ctx context.Context, desiredCPU, desiredMem string) {


func doBurstablePodResizeTests(f *framework.Framework) {
ginkgo.Describe("burstable pods with a single regular container specifying all requests & limits", func() {
ginkgo.DescribeTableSubtree("with various policies", func(cpuPolicy, memPolicy v1.ResourceResizeRestartPolicy, hasInitCtrs bool) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's drop hasInitCtrs here too. I don't think we even need to add them to these tests - that's already covered by the guaranteed cases.

Comment on lines +156 to +168
ginkgo.By("creating and verifying pod")
newPod := createAndVerifyPod(ctx, f, podClient, originalContainers)

ginkgo.By("patching and verifying pod for resize")
patchAndVerify(ctx, f, podClient, newPod, originalContainers, expectedContainers, "resize")

// Resize has been actuated, test the reverse operation.
rollbackContainers := createRollbackContainers(originalContainers, expectedContainers)
ginkgo.By("patching and verifying pod for rollback")
patchAndVerify(ctx, f, podClient, newPod, expectedContainers, rollbackContainers, "rollback")

ginkgo.By("deleting pod")
podClient.DeleteSync(ctx, newPod.Name, metav1.DeleteOptions{}, f.Timeouts.PodDelete)
Copy link
Member

Choose a reason for hiding this comment

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

Is this logic common among the different tables? If so, extract it to a shared function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: PRs - Needs Reviewer
Development

Successfully merging this pull request may close these issues.

3 participants