@@ -131,6 +131,46 @@ func TestVPAStore(t *testing.T) {
131131 "kube_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget" ,
132132 },
133133 },
134+ {
135+ Obj : & autoscaling.VerticalPodAutoscaler {
136+ ObjectMeta : metav1.ObjectMeta {
137+ Generation : 2 ,
138+ Name : "vpa-without-target-ref" ,
139+ Namespace : "ns2" ,
140+ Labels : map [string ]string {
141+ "app" : "foobar" ,
142+ },
143+ },
144+ Spec : autoscaling.VerticalPodAutoscalerSpec {
145+ UpdatePolicy : & autoscaling.PodUpdatePolicy {
146+ UpdateMode : & updateMode ,
147+ },
148+ ResourcePolicy : & autoscaling.PodResourcePolicy {
149+ ContainerPolicies : []autoscaling.ContainerResourcePolicy {
150+ {
151+ ContainerName : "*" ,
152+ MinAllowed : v1Resource ("1" , "4Gi" ),
153+ MaxAllowed : v1Resource ("4" , "8Gi" ),
154+ },
155+ },
156+ },
157+ },
158+ Status : autoscaling.VerticalPodAutoscalerStatus {
159+ Recommendation : & autoscaling.RecommendedPodResources {
160+ ContainerRecommendations : []autoscaling.RecommendedContainerResources {
161+ {
162+ ContainerName : "container1" ,
163+ LowerBound : v1Resource ("1" , "4Gi" ),
164+ UpperBound : v1Resource ("4" , "8Gi" ),
165+ Target : v1Resource ("3" , "7Gi" ),
166+ UncappedTarget : v1Resource ("6" , "10Gi" ),
167+ },
168+ },
169+ },
170+ },
171+ },
172+ Want : metadata ,
173+ },
134174 }
135175 for i , c := range cases {
136176 c .Func = generator .ComposeMetricGenFuncs (vpaMetricFamilies (nil , nil ))
0 commit comments