From 352665f0a16a106b1947b832096ca20899735aba Mon Sep 17 00:00:00 2001 From: Dao Thanh Tung Date: Wed, 31 Jul 2024 21:34:42 +0100 Subject: [PATCH] Remove deprecated cortexOrgId in prometheus scaler (#5990) * Remove deprecated cortexOrgId in prometheus scaler Signed-off-by: dttung2905 * Move to breaking changes Signed-off-by: dttung2905 --------- Signed-off-by: dttung2905 --- CHANGELOG.md | 6 ++++-- pkg/scalers/prometheus_scaler.go | 4 ---- pkg/scalers/prometheus_scaler_test.go | 10 ++++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5df58c495d9..39a1dca9031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,12 +94,14 @@ Here is an overview of all new **experimental** features: ### Deprecations -You can find all deprecations in [this overview](https://github.com/kedacore/keda/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abreaking-change) and [join the discussion here](https://github.com/kedacore/keda/discussions/categories/deprecations). - New deprecation(s): - TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX)) +### Breaking Changes + +- **Prometheus Scaler**: Remove deprecated field `cortexOrgID` from Prometheus scaler ([#5538](https://github.com/kedacore/keda/issues/5538)) + ### Other - **General**: Added Pre Regex check before building image in e2e test ([#5783](https://github.com/kedacore/keda/issues/5783)) diff --git a/pkg/scalers/prometheus_scaler.go b/pkg/scalers/prometheus_scaler.go index 99fc6f9f5ea..5a0516f42a0 100644 --- a/pkg/scalers/prometheus_scaler.go +++ b/pkg/scalers/prometheus_scaler.go @@ -32,7 +32,6 @@ const ( promThreshold = "threshold" promActivationThreshold = "activationThreshold" promNamespace = "namespace" - promCortexScopeOrgID = "cortexOrgID" promCustomHeaders = "customHeaders" ignoreNullValues = "ignoreNullValues" unsafeSsl = "unsafeSsl" @@ -62,9 +61,6 @@ type prometheusMetadata struct { CustomHeaders map[string]string `keda:"name=customHeaders, order=triggerMetadata, optional"` IgnoreNullValues bool `keda:"name=ignoreNullValues, order=triggerMetadata, optional, default=true"` UnsafeSSL bool `keda:"name=unsafeSsl, order=triggerMetadata, optional"` - - // deprecated - CortexOrgID string `keda:"name=cortexOrgID, order=triggerMetadata, optional, deprecated=use customHeaders instead"` } type promQueryResult struct { diff --git a/pkg/scalers/prometheus_scaler_test.go b/pkg/scalers/prometheus_scaler_test.go index 694a6a7c624..b6eb46cfd0c 100644 --- a/pkg/scalers/prometheus_scaler_test.go +++ b/pkg/scalers/prometheus_scaler_test.go @@ -60,8 +60,6 @@ var testPromMetadata = []parsePrometheusMetadataTestData{ {map[string]string{"serverAddress": "http://localhost:9090", "metricName": "http_requests_total", "threshold": "100", "query": "up", "customHeaders": "key1=value1,key2=value2"}, false}, // customHeaders with wrong format {map[string]string{"serverAddress": "http://localhost:9090", "metricName": "http_requests_total", "threshold": "100", "query": "up", "customHeaders": "key1=value1,key2"}, true}, - // deprecated cortexOrgID - {map[string]string{"serverAddress": "http://localhost:9090", "metricName": "http_requests_total", "threshold": "100", "query": "up", "cortexOrgID": "my-org"}, true}, // queryParameters {map[string]string{"serverAddress": "http://localhost:9090", "metricName": "http_requests_total", "threshold": "100", "query": "up", "queryParameters": "key1=value1,key2=value2"}, false}, // queryParameters with wrong format @@ -174,7 +172,7 @@ func TestPrometheusScalerAuthParams(t *testing.T) { } } -type prometheusQromQueryResultTestData struct { +type prometheusPromQueryResultTestData struct { name string bodyStr string responseStatus int @@ -184,7 +182,7 @@ type prometheusQromQueryResultTestData struct { unsafeSsl bool } -var testPromQueryResult = []prometheusQromQueryResultTestData{ +var testPromQueryResult = []prometheusPromQueryResultTestData{ { name: "no results", bodyStr: `{}`, @@ -339,7 +337,7 @@ func TestPrometheusScalerExecutePromQuery(t *testing.T) { } func TestPrometheusScalerCustomHeaders(t *testing.T) { - testData := prometheusQromQueryResultTestData{ + testData := prometheusPromQueryResultTestData{ name: "no values", bodyStr: `{"data":{"result":[]}}`, responseStatus: http.StatusOK, @@ -379,7 +377,7 @@ func TestPrometheusScalerCustomHeaders(t *testing.T) { } func TestPrometheusScalerExecutePromQueryParameters(t *testing.T) { - testData := prometheusQromQueryResultTestData{ + testData := prometheusPromQueryResultTestData{ name: "no values", bodyStr: `{"data":{"result":[]}}`, responseStatus: http.StatusOK,