@@ -21,7 +21,7 @@ import (
21
21
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22
22
"k8s.io/apimachinery/pkg/runtime"
23
23
"k8s.io/apimachinery/pkg/watch"
24
- vpav1beta2 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2 "
24
+ vpav1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1 "
25
25
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned"
26
26
"k8s.io/client-go/rest"
27
27
"k8s.io/client-go/tools/cache"
@@ -69,7 +69,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
69
69
metric .Gauge ,
70
70
basemetrics .ALPHA ,
71
71
"" ,
72
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
72
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
73
73
annotationKeys , annotationValues := kubeMapToPrometheusLabels ("annotation" , a .Annotations )
74
74
return & metric.Family {
75
75
Metrics : []* metric.Metric {
@@ -88,7 +88,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
88
88
metric .Gauge ,
89
89
basemetrics .ALPHA ,
90
90
"" ,
91
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
91
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
92
92
labelKeys , labelValues := kubeMapToPrometheusLabels ("label" , a .Labels )
93
93
return & metric.Family {
94
94
Metrics : []* metric.Metric {
@@ -107,7 +107,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
107
107
metric .Gauge ,
108
108
basemetrics .ALPHA ,
109
109
"" ,
110
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
110
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
111
111
ms := []* metric.Metric {}
112
112
113
113
if a .Spec .UpdatePolicy == nil || a .Spec .UpdatePolicy .UpdateMode == nil {
@@ -116,11 +116,11 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
116
116
}
117
117
}
118
118
119
- for _ , mode := range []vpav1beta2 .UpdateMode {
120
- vpav1beta2 .UpdateModeOff ,
121
- vpav1beta2 .UpdateModeInitial ,
122
- vpav1beta2 .UpdateModeRecreate ,
123
- vpav1beta2 .UpdateModeAuto ,
119
+ for _ , mode := range []vpav1 .UpdateMode {
120
+ vpav1 .UpdateModeOff ,
121
+ vpav1 .UpdateModeInitial ,
122
+ vpav1 .UpdateModeRecreate ,
123
+ vpav1 .UpdateModeAuto ,
124
124
} {
125
125
var v float64
126
126
if * a .Spec .UpdatePolicy .UpdateMode == mode {
@@ -146,7 +146,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
146
146
metric .Gauge ,
147
147
basemetrics .ALPHA ,
148
148
"" ,
149
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
149
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
150
150
ms := []* metric.Metric {}
151
151
if a .Spec .ResourcePolicy == nil || a .Spec .ResourcePolicy .ContainerPolicies == nil {
152
152
return & metric.Family {
@@ -169,7 +169,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
169
169
metric .Gauge ,
170
170
basemetrics .ALPHA ,
171
171
"" ,
172
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
172
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
173
173
ms := []* metric.Metric {}
174
174
if a .Spec .ResourcePolicy == nil || a .Spec .ResourcePolicy .ContainerPolicies == nil {
175
175
return & metric.Family {
@@ -191,7 +191,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
191
191
metric .Gauge ,
192
192
basemetrics .ALPHA ,
193
193
"" ,
194
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
194
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
195
195
ms := []* metric.Metric {}
196
196
if a .Status .Recommendation == nil || a .Status .Recommendation .ContainerRecommendations == nil {
197
197
return & metric.Family {
@@ -213,7 +213,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
213
213
metric .Gauge ,
214
214
basemetrics .ALPHA ,
215
215
"" ,
216
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
216
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
217
217
ms := []* metric.Metric {}
218
218
if a .Status .Recommendation == nil || a .Status .Recommendation .ContainerRecommendations == nil {
219
219
return & metric.Family {
@@ -235,7 +235,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
235
235
metric .Gauge ,
236
236
basemetrics .ALPHA ,
237
237
"" ,
238
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
238
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
239
239
ms := []* metric.Metric {}
240
240
if a .Status .Recommendation == nil || a .Status .Recommendation .ContainerRecommendations == nil {
241
241
return & metric.Family {
@@ -256,7 +256,7 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
256
256
metric .Gauge ,
257
257
basemetrics .ALPHA ,
258
258
"" ,
259
- wrapVPAFunc (func (a * vpav1beta2 .VerticalPodAutoscaler ) * metric.Family {
259
+ wrapVPAFunc (func (a * vpav1 .VerticalPodAutoscaler ) * metric.Family {
260
260
ms := []* metric.Metric {}
261
261
if a .Status .Recommendation == nil || a .Status .Recommendation .ContainerRecommendations == nil {
262
262
return & metric.Family {
@@ -275,10 +275,10 @@ func (f *vpaFactory) MetricFamilyGenerators() []generator.FamilyGenerator {
275
275
}
276
276
277
277
func (f * vpaFactory ) ExpectedType () interface {} {
278
- return & vpav1beta2 .VerticalPodAutoscaler {
278
+ return & vpav1 .VerticalPodAutoscaler {
279
279
TypeMeta : metav1.TypeMeta {
280
280
Kind : "VerticalPodAutoscaler" ,
281
- APIVersion : vpav1beta2 .SchemeGroupVersion .String (),
281
+ APIVersion : vpav1 .SchemeGroupVersion .String (),
282
282
},
283
283
}
284
284
}
@@ -309,9 +309,9 @@ func vpaResourcesToMetrics(containerName string, resources corev1.ResourceList)
309
309
return ms
310
310
}
311
311
312
- func wrapVPAFunc (f func (* vpav1beta2 .VerticalPodAutoscaler ) * metric.Family ) func (interface {}) * metric.Family {
312
+ func wrapVPAFunc (f func (* vpav1 .VerticalPodAutoscaler ) * metric.Family ) func (interface {}) * metric.Family {
313
313
return func (obj interface {}) * metric.Family {
314
- vpa := obj .(* vpav1beta2 .VerticalPodAutoscaler )
314
+ vpa := obj .(* vpav1 .VerticalPodAutoscaler )
315
315
316
316
metricFamily := f (vpa )
317
317
targetRef := vpa .Spec .TargetRef
@@ -338,11 +338,11 @@ func (f *vpaFactory) ListWatch(customResourceClient interface{}, ns string, fiel
338
338
return & cache.ListWatch {
339
339
ListFunc : func (opts metav1.ListOptions ) (runtime.Object , error ) {
340
340
opts .FieldSelector = fieldSelector
341
- return vpaClient .AutoscalingV1beta2 ().VerticalPodAutoscalers (ns ).List (ctx , opts )
341
+ return vpaClient .AutoscalingV1 ().VerticalPodAutoscalers (ns ).List (ctx , opts )
342
342
},
343
343
WatchFunc : func (opts metav1.ListOptions ) (watch.Interface , error ) {
344
344
opts .FieldSelector = fieldSelector
345
- return vpaClient .AutoscalingV1beta2 ().VerticalPodAutoscalers (ns ).Watch (ctx , opts )
345
+ return vpaClient .AutoscalingV1 ().VerticalPodAutoscalers (ns ).Watch (ctx , opts )
346
346
},
347
347
}
348
348
}
0 commit comments