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

Fix VPA e2e test failures #6391

Merged
merged 3 commits into from
Jan 22, 2024
Merged

Conversation

voelzmo
Copy link
Contributor

@voelzmo voelzmo commented Dec 20, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fixes failing e2e tests for VPA. After the refactorings done in #5599, the tests started failing – but nobody realized this until now: #6389

This PR fixes the tests by doing two things:

  • The way the new builder pattern for VPA test objects was introduced in the e2e tests had a problem with how recommendations are created. For the first container, a recommendation is created implicitly when you call Build() on the VPA object. This interferes with the pattern of AppendRecommendation(), which lead to a second entry in the containerRecommendations section, where one of those entries was empty.
  • During the refactorings mentioned above, the test for the named recommender were broken and we didn't realize it. This PR brings back the recommender name for the VPA object created in the test, such that it can succeed again.

Which issue(s) this PR fixes:

Fixes #6389

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. area/vertical-pod-autoscaler labels Dec 20, 2023
@voelzmo
Copy link
Contributor Author

voelzmo commented Dec 20, 2023

ping @laoj2 this fixes the tests and should enable us to cut a new release soon

@@ -248,7 +248,12 @@ func (b *verticalPodAutoscalerBuilder) Get() *vpa_types.VerticalPodAutoscaler {
Mode: b.scalingMode[containerName],
})
}
recommendation = b.recommendation.WithContainer(b.containerNames[0]).Get()
// VPAs with a single container may still use the old/implicit way of adding recommendations
Copy link
Contributor

Choose a reason for hiding this comment

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

As a newbie to this code, I found this a bit confusing. Can you add more details to this comment? (i.e., describe that there are two ways of adding recommendations, (1) setting recommendations field via some builders, (2) another one setting appendedRecommendations, through AppendRecommendation(...))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this weird split was introduced a long time ago when the option was added to provide more than one recommendation to the test VPA object: https://github.com/kubernetes/autoscaler/pull/2866/files#diff-294b6f5855b82faa084f2866e8d3542c0c129776ecbbfd44f8d921f210706490

You're right, ideally this should be simplified to work with a single way to set the recommendations. We probably should do this in a follow-up PR to get the tests green again first?

@@ -248,7 +248,12 @@ func (b *verticalPodAutoscalerBuilder) Get() *vpa_types.VerticalPodAutoscaler {
Mode: b.scalingMode[containerName],
})
}
recommendation = b.recommendation.WithContainer(b.containerNames[0]).Get()
// VPAs with a single container may still use the old/implicit way of adding recommendations
r := b.recommendation.WithContainer(b.containerNames[0]).Get()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we hardcode the container name index here and append to recommendation.ContainerRecommendations instead of doing this logic for all containers in the loop above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment above, probably the same issue/root cause?

@voelzmo
Copy link
Contributor Author

voelzmo commented Jan 8, 2024

Hey @laoj2 thanks for the review! I agree that this part is a mess in the test code and we should clean it up. I'd rather do this in a follow-up PR and get the tests green as soon as possible, does that sound good?

@voelzmo
Copy link
Contributor Author

voelzmo commented Jan 19, 2024

ping @laoj2 can we merge this and get the tests back to green again, so we can cut a new release, or do you want me to do any additional changes on this PR?

@laoj2
Copy link
Contributor

laoj2 commented Jan 22, 2024

Yes, sounds good @voelzmo. Thanks for the fix!

/lgtm

cc @kwiesmueller

@k8s-ci-robot
Copy link
Contributor

@laoj2: changing LGTM is restricted to collaborators

In response to this:

Yes, sounds good @voelzmo. Thanks for the fix!

/lgtm

cc @kwiesmueller

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.

@kwiesmueller
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 22, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kwiesmueller, voelzmo

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 Jan 22, 2024
@k8s-ci-robot k8s-ci-robot merged commit ed25db1 into kubernetes:master Jan 22, 2024
6 checks passed
This was referenced Feb 7, 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/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VPA E2E tests are broken
4 participants