@@ -34,6 +34,7 @@ import (
3434 "k8s.io/apimachinery/pkg/runtime"
3535 "k8s.io/client-go/kubernetes/fake"
3636
37+ corev1 "k8s.io/api/core/v1"
3738 vpa_types "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
3839 controllerfetcher "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/target/controller_fetcher"
3940 target_mock "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/target/mock"
@@ -177,12 +178,16 @@ func testRunOnceBase(
177178 Name : rc .Name ,
178179 APIVersion : rc .APIVersion ,
179180 }
181+ // TOD0(jkyros): I added the recommendationProvided condition here because in-place needs to wait for a
182+ // recommendation to scale, causing this test to fail (because in-place checks before eviction, and in-place will
183+ // wait to scale -- and not fall back to eviction -- until the VPA has made a recommendation)
180184 vpaObj := test .VerticalPodAutoscaler ().
181185 WithContainer (containerName ).
182186 WithTarget ("2" , "200M" ).
183187 WithMinAllowed (containerName , "1" , "100M" ).
184188 WithMaxAllowed (containerName , "3" , "1G" ).
185- WithTargetRef (targetRef ).Get ()
189+ WithTargetRef (targetRef ).
190+ AppendCondition (vpa_types .RecommendationProvided , corev1 .ConditionTrue , "reason" , "msg" , time .Unix (0 , 0 )).Get ()
186191
187192 vpaObj .Spec .UpdatePolicy = & vpa_types.PodUpdatePolicy {UpdateMode : & updateMode }
188193 vpaLister .On ("List" ).Return ([]* vpa_types.VerticalPodAutoscaler {vpaObj }, nil ).Once ()
@@ -314,13 +319,18 @@ func TestRunOnceIgnoreNamespaceMatchingPods(t *testing.T) {
314319 Name : rc .Name ,
315320 APIVersion : rc .APIVersion ,
316321 }
322+
323+ // TOD0(jkyros): I added the recommendationProvided condition here because in-place needs to wait for a
324+ // recommendation to scale, causing this test to fail (because in-place checks before eviction, and in-place will
325+ // wait to scale -- and not fall back to eviction -- until the VPA has made a recommendation)
317326 vpaObj := test .VerticalPodAutoscaler ().
318327 WithNamespace ("default" ).
319328 WithContainer (containerName ).
320329 WithTarget ("2" , "200M" ).
321330 WithMinAllowed (containerName , "1" , "100M" ).
322331 WithMaxAllowed (containerName , "3" , "1G" ).
323- WithTargetRef (targetRef ).Get ()
332+ WithTargetRef (targetRef ).
333+ AppendCondition (vpa_types .RecommendationProvided , corev1 .ConditionTrue , "reason" , "msg" , time .Unix (0 , 0 )).Get ()
324334
325335 vpaLister .On ("List" ).Return ([]* vpa_types.VerticalPodAutoscaler {vpaObj }, nil ).Once ()
326336
0 commit comments