From ca9d48d81517a2448809759b9442125f22956884 Mon Sep 17 00:00:00 2001 From: Zbynek Roubalik Date: Wed, 6 Nov 2024 11:05:55 +0100 Subject: [PATCH] AWS CloudWatch - properly parse multiple values of `dimensionName` & `dimensionValue` lists Signed-off-by: Zbynek Roubalik --- CHANGELOG.md | 1 + pkg/scalers/aws_cloudwatch_scaler.go | 4 ++-- pkg/scalers/aws_cloudwatch_scaler_test.go | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eef43573d9c..aef9680a3ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,6 +97,7 @@ Here is an overview of all new **experimental** features: ### Fixes - **General**: Scalers cache uses a mutex to prevent concurrent actions ([#6273](https://github.com/kedacore/keda/issues/6273)) +- **AWS CloudWatch Scaler**: Properly parse multiple values of `dimensionName` & `dimensionValue` lists ([#6236](https://github.com/kedacore/keda/issues/6236)) - **AWS Secret Manager**: Pod identity overrides are honored ([#6195](https://github.com/kedacore/keda/issues/6195)) - **AWS SQS Scaler**: Improve error handling for SQS queue metrics ([#6178](https://github.com/kedacore/keda/issues/6178)) - **Azure Event Hub Scaler**: Checkpointer errors are correctly handled ([#6084](https://github.com/kedacore/keda/issues/6084)) diff --git a/pkg/scalers/aws_cloudwatch_scaler.go b/pkg/scalers/aws_cloudwatch_scaler.go index a07db246f80..72a8a38c638 100644 --- a/pkg/scalers/aws_cloudwatch_scaler.go +++ b/pkg/scalers/aws_cloudwatch_scaler.go @@ -30,8 +30,8 @@ type awsCloudwatchMetadata struct { triggerIndex int Namespace string `keda:"name=namespace, order=triggerMetadata, optional"` MetricsName string `keda:"name=metricName, order=triggerMetadata, optional"` - DimensionName []string `keda:"name=dimensionName, order=triggerMetadata, optional"` - DimensionValue []string `keda:"name=dimensionValue, order=triggerMetadata, optional"` + DimensionName []string `keda:"name=dimensionName, order=triggerMetadata, optional, separator=;"` + DimensionValue []string `keda:"name=dimensionValue, order=triggerMetadata, optional, separator=;"` Expression string `keda:"name=expression, order=triggerMetadata, optional"` TargetMetricValue float64 `keda:"name=targetMetricValue, order=triggerMetadata"` diff --git a/pkg/scalers/aws_cloudwatch_scaler_test.go b/pkg/scalers/aws_cloudwatch_scaler_test.go index da6e85fc2c7..a996514d62f 100644 --- a/pkg/scalers/aws_cloudwatch_scaler_test.go +++ b/pkg/scalers/aws_cloudwatch_scaler_test.go @@ -478,6 +478,22 @@ var testAWSCloudwatchMetadata = []parseAWSCloudwatchMetadataTestData{ testAWSAuthentication, true, "unsupported value for ignoreNullValues", }, + // test case for multiple dimensions with valid separator + { + map[string]string{ + "namespace": "AWS/SQS", + "dimensionName": "QueueName;Region", + "dimensionValue": "queue1;us-west-2", + "metricName": "ApproximateNumberOfMessagesVisible", + "targetMetricValue": "5", + "minMetricValue": "1", + "metricStat": "Average", + "awsRegion": "us-west-2", + }, + testAWSAuthentication, + false, + "Multiple dimensions with valid separator", + }, } var awsCloudwatchMetricIdentifiers = []awsCloudwatchMetricIdentifier{