diff --git a/vertical-pod-autoscaler/e2e/v1/full_vpa.go b/vertical-pod-autoscaler/e2e/v1/full_vpa.go index 230a3e9b1d32..7ced7c0a49d7 100644 --- a/vertical-pod-autoscaler/e2e/v1/full_vpa.go +++ b/vertical-pod-autoscaler/e2e/v1/full_vpa.go @@ -238,6 +238,7 @@ var _ = FullVpaE2eDescribe("Pods under VPA with non-recognized recommender expli containerName := GetHamsterContainerNameByIndex(0) vpaCRD := test.VerticalPodAutoscaler(). WithName("hamster-vpa"). + WithRecommender("non-recognized"). WithNamespace(f.Namespace.Name). WithTargetRef(targetRef). WithContainer(containerName). diff --git a/vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go b/vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go index cd3eba2ea125..5e9b6adb739a 100644 --- a/vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go +++ b/vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go @@ -126,7 +126,7 @@ type EvictionRequirement struct { // Resources is a list of one or more resources that the condition applies // to. If more than one resource is given, the EvictionRequirement is fulfilled // if at least one resource meets `changeRequirement`. - Resources []v1.ResourceName `json:"resource" protobuf:"bytes,1,name=resources"` + Resources []v1.ResourceName `json:"resources" protobuf:"bytes,1,name=resources"` ChangeRequirement EvictionChangeRequirement `json:"changeRequirement" protobuf:"bytes,2,name=changeRequirement"` } diff --git a/vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go b/vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go index 3767e0685853..459aed757bdd 100644 --- a/vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go +++ b/vertical-pod-autoscaler/e2e/vendor/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go @@ -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() + if r.ContainerRecommendations[0].Target != nil { + recommendation = r + } + recommendation.ContainerRecommendations = append(recommendation.ContainerRecommendations, b.appendedRecommendations...) return &vpa_types.VerticalPodAutoscaler{ diff --git a/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go b/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go index 3767e0685853..459aed757bdd 100644 --- a/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go +++ b/vertical-pod-autoscaler/pkg/utils/test/test_vpa.go @@ -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() + if r.ContainerRecommendations[0].Target != nil { + recommendation = r + } + recommendation.ContainerRecommendations = append(recommendation.ContainerRecommendations, b.appendedRecommendations...) return &vpa_types.VerticalPodAutoscaler{