From 0d4aa55127756a3772445c941094953ac6705516 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Larsen Date: Wed, 27 Nov 2024 13:57:20 +0100 Subject: [PATCH] Update custom metrics image to work with ipv6 Signed-off-by: Mikkel Oscar Lyderik Larsen --- test/e2e/kube_metrics_adapter_test.go | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/test/e2e/kube_metrics_adapter_test.go b/test/e2e/kube_metrics_adapter_test.go index e8374cd6dd..5975c12ff2 100644 --- a/test/e2e/kube_metrics_adapter_test.go +++ b/test/e2e/kube_metrics_adapter_test.go @@ -330,7 +330,7 @@ func podMetricDeployment(name string, replicas int32, containers []CustomMetricC func podContainerSpec(name string) corev1.Container { return corev1.Container{ Name: name, - Image: "container-registry.zalando.net/teapot/sample-custom-metrics-autoscaling:master-15", + Image: "container-registry.zalando.net/teapot/sample-custom-metrics-autoscaling:main-5", Ports: []corev1.ContainerPort{{ContainerPort: 8000, Protocol: "TCP"}}, Resources: corev1.ResourceRequirements{ Limits: map[corev1.ResourceName]resource.Quantity{ @@ -347,7 +347,7 @@ func podContainerSpec(name string) corev1.Container { func podMetricContainerSpec(container CustomMetricContainerSpec) corev1.Container { return corev1.Container{ Name: container.Name, - Image: "container-registry.zalando.net/teapot/sample-custom-metrics-autoscaling:master-15", + Image: "container-registry.zalando.net/teapot/sample-custom-metrics-autoscaling:main-5", Ports: []corev1.ContainerPort{{ContainerPort: 8000, Protocol: "TCP"}}, Resources: corev1.ResourceRequirements{ Limits: map[corev1.ResourceName]resource.Quantity{ @@ -358,22 +358,12 @@ func podMetricContainerSpec(container CustomMetricContainerSpec) corev1.Containe corev1.ResourceMemory: resource.MustParse("300Mi"), }, }, - Env: []corev1.EnvVar{ - { - Name: metricNameToEnv(container.MetricName), - Value: strconv.FormatInt(container.MetricValue, 10), - }, + Args: []string{ + "-fake-queue-length", strconv.FormatInt(container.MetricValue, 10), }, } } -// metricNameToEnv converts a metric name like "queue-count" to an env var like "QUEUE_COUNT" -func metricNameToEnv(metric string) string { - nodashes := strings.Replace(metric, "-", "_", 1) - allcaps := strings.ToUpper(nodashes) - return allcaps -} - func simplePodMetricHPA(deploymentName string, metricName string, metricTarget int64) *autoscaling.HorizontalPodAutoscaler { return podMetricHPA(deploymentName, map[string]int64{metricName: metricTarget}) } @@ -401,7 +391,7 @@ func podMetricHPA(deploymentName string, metricTargets map[string]int64) *autosc ObjectMeta: metav1.ObjectMeta{ Name: "custom-metrics-pods-hpa", Annotations: map[string]string{ - strings.Join([]string{"metric-config.pods", metricName, "json-path/json-key"}, "."): "$.queue_count", + strings.Join([]string{"metric-config.pods", metricName, "json-path/json-key"}, "."): "$.queue.length", strings.Join([]string{"metric-config.pods", metricName, "json-path/path"}, "."): "/metrics", strings.Join([]string{"metric-config.pods", metricName, "json-path/port"}, "."): "8000", },