Skip to content

Commit

Permalink
Remove deprecated cortexOrgId in prometheus scaler (#5990)
Browse files Browse the repository at this point in the history
* Remove deprecated cortexOrgId in prometheus scaler

Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>

* Move to breaking changes

Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>

---------

Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
  • Loading branch information
dttung2905 authored Jul 31, 2024
1 parent 5b6905e commit 352665f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 0 additions & 4 deletions pkg/scalers/prometheus_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const (
promThreshold = "threshold"
promActivationThreshold = "activationThreshold"
promNamespace = "namespace"
promCortexScopeOrgID = "cortexOrgID"
promCustomHeaders = "customHeaders"
ignoreNullValues = "ignoreNullValues"
unsafeSsl = "unsafeSsl"
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 4 additions & 6 deletions pkg/scalers/prometheus_scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -174,7 +172,7 @@ func TestPrometheusScalerAuthParams(t *testing.T) {
}
}

type prometheusQromQueryResultTestData struct {
type prometheusPromQueryResultTestData struct {
name string
bodyStr string
responseStatus int
Expand All @@ -184,7 +182,7 @@ type prometheusQromQueryResultTestData struct {
unsafeSsl bool
}

var testPromQueryResult = []prometheusQromQueryResultTestData{
var testPromQueryResult = []prometheusPromQueryResultTestData{
{
name: "no results",
bodyStr: `{}`,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 352665f

Please sign in to comment.