Skip to content

Commit b077696

Browse files
authored
Merge pull request #8541 from zalando-incubator/update-custom-autoscaler-e2e
Update custom metrics image to work with ipv6
2 parents 2649d9d + 27dcc32 commit b077696

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

test/e2e/kube_metrics_adapter_test.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ func podMetricDeployment(name string, replicas int32, containers []CustomMetricC
330330
func podContainerSpec(name string) corev1.Container {
331331
return corev1.Container{
332332
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",
334334
Ports: []corev1.ContainerPort{{ContainerPort: 8000, Protocol: "TCP"}},
335335
Resources: corev1.ResourceRequirements{
336336
Limits: map[corev1.ResourceName]resource.Quantity{
@@ -347,7 +347,7 @@ func podContainerSpec(name string) corev1.Container {
347347
func podMetricContainerSpec(container CustomMetricContainerSpec) corev1.Container {
348348
return corev1.Container{
349349
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",
351351
Ports: []corev1.ContainerPort{{ContainerPort: 8000, Protocol: "TCP"}},
352352
Resources: corev1.ResourceRequirements{
353353
Limits: map[corev1.ResourceName]resource.Quantity{
@@ -358,22 +358,12 @@ func podMetricContainerSpec(container CustomMetricContainerSpec) corev1.Containe
358358
corev1.ResourceMemory: resource.MustParse("300Mi"),
359359
},
360360
},
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),
366363
},
367364
}
368365
}
369366

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-
377367
func simplePodMetricHPA(deploymentName string, metricName string, metricTarget int64) *autoscaling.HorizontalPodAutoscaler {
378368
return podMetricHPA(deploymentName, map[string]int64{metricName: metricTarget})
379369
}
@@ -401,7 +391,7 @@ func podMetricHPA(deploymentName string, metricTargets map[string]int64) *autosc
401391
ObjectMeta: metav1.ObjectMeta{
402392
Name: "custom-metrics-pods-hpa",
403393
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",
405395
strings.Join([]string{"metric-config.pods", metricName, "json-path/path"}, "."): "/metrics",
406396
strings.Join([]string{"metric-config.pods", metricName, "json-path/port"}, "."): "8000",
407397
},

0 commit comments

Comments
 (0)