Skip to content

Commit ed25db1

Browse files
authored
Merge pull request #6391 from voelzmo/fix/vpa-e2e-tests
Fix VPA e2e test failures
2 parents df0ce2d + 1740647 commit ed25db1

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

vertical-pod-autoscaler/e2e/v1/full_vpa.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ var _ = FullVpaE2eDescribe("Pods under VPA with non-recognized recommender expli
238238
containerName := GetHamsterContainerNameByIndex(0)
239239
vpaCRD := test.VerticalPodAutoscaler().
240240
WithName("hamster-vpa").
241+
WithRecommender("non-recognized").
241242
WithNamespace(f.Namespace.Name).
242243
WithTargetRef(targetRef).
243244
WithContainer(containerName).

vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertical-pod-autoscaler/pkg/utils/test/test_vpa.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,12 @@ func (b *verticalPodAutoscalerBuilder) Get() *vpa_types.VerticalPodAutoscaler {
248248
Mode: b.scalingMode[containerName],
249249
})
250250
}
251-
recommendation = b.recommendation.WithContainer(b.containerNames[0]).Get()
251+
// VPAs with a single container may still use the old/implicit way of adding recommendations
252+
r := b.recommendation.WithContainer(b.containerNames[0]).Get()
253+
if r.ContainerRecommendations[0].Target != nil {
254+
recommendation = r
255+
}
256+
252257
recommendation.ContainerRecommendations = append(recommendation.ContainerRecommendations, b.appendedRecommendations...)
253258

254259
return &vpa_types.VerticalPodAutoscaler{

0 commit comments

Comments
 (0)