@@ -330,7 +330,7 @@ func podMetricDeployment(name string, replicas int32, containers []CustomMetricC
330
330
func podContainerSpec (name string ) corev1.Container {
331
331
return corev1.Container {
332
332
Name : name ,
333
- Image : "container-registry.zalando.net/teapot/sample-custom-metrics-autoscaling:master-15 " ,
333
+ Image : "container-registry.zalando.net/teapot/sample-custom-metrics-autoscaling:main-5 " ,
334
334
Ports : []corev1.ContainerPort {{ContainerPort : 8000 , Protocol : "TCP" }},
335
335
Resources : corev1.ResourceRequirements {
336
336
Limits : map [corev1.ResourceName ]resource.Quantity {
@@ -347,7 +347,7 @@ func podContainerSpec(name string) corev1.Container {
347
347
func podMetricContainerSpec (container CustomMetricContainerSpec ) corev1.Container {
348
348
return corev1.Container {
349
349
Name : container .Name ,
350
- Image : "container-registry.zalando.net/teapot/sample-custom-metrics-autoscaling:master-15 " ,
350
+ Image : "container-registry.zalando.net/teapot/sample-custom-metrics-autoscaling:main-5 " ,
351
351
Ports : []corev1.ContainerPort {{ContainerPort : 8000 , Protocol : "TCP" }},
352
352
Resources : corev1.ResourceRequirements {
353
353
Limits : map [corev1.ResourceName ]resource.Quantity {
@@ -358,22 +358,12 @@ func podMetricContainerSpec(container CustomMetricContainerSpec) corev1.Containe
358
358
corev1 .ResourceMemory : resource .MustParse ("300Mi" ),
359
359
},
360
360
},
361
- Env : []corev1.EnvVar {
362
- {
363
- Name : metricNameToEnv (container .MetricName ),
364
- Value : strconv .FormatInt (container .MetricValue , 10 ),
365
- },
361
+ Args : []string {
362
+ "-fake-queue-length" , strconv .FormatInt (container .MetricValue , 10 ),
366
363
},
367
364
}
368
365
}
369
366
370
- // metricNameToEnv converts a metric name like "queue-count" to an env var like "QUEUE_COUNT"
371
- func metricNameToEnv (metric string ) string {
372
- nodashes := strings .Replace (metric , "-" , "_" , 1 )
373
- allcaps := strings .ToUpper (nodashes )
374
- return allcaps
375
- }
376
-
377
367
func simplePodMetricHPA (deploymentName string , metricName string , metricTarget int64 ) * autoscaling.HorizontalPodAutoscaler {
378
368
return podMetricHPA (deploymentName , map [string ]int64 {metricName : metricTarget })
379
369
}
@@ -401,7 +391,7 @@ func podMetricHPA(deploymentName string, metricTargets map[string]int64) *autosc
401
391
ObjectMeta : metav1.ObjectMeta {
402
392
Name : "custom-metrics-pods-hpa" ,
403
393
Annotations : map [string ]string {
404
- strings .Join ([]string {"metric-config.pods" , metricName , "json-path/json-key" }, "." ): "$.queue_count " ,
394
+ strings .Join ([]string {"metric-config.pods" , metricName , "json-path/json-key" }, "." ): "$.queue.length " ,
405
395
strings .Join ([]string {"metric-config.pods" , metricName , "json-path/path" }, "." ): "/metrics" ,
406
396
strings .Join ([]string {"metric-config.pods" , metricName , "json-path/port" }, "." ): "8000" ,
407
397
},
0 commit comments