From da1675082c2c9460aa8f6b2c434f905ba4013664 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 23 Nov 2021 14:38:35 +0100 Subject: [PATCH 1/4] Fix influx code scanning issue Signed-off-by: Jorge Turrado --- pkg/scalers/influxdb_scaler.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkg/scalers/influxdb_scaler.go b/pkg/scalers/influxdb_scaler.go index 7da547fa3ba..4fdf2c90e83 100644 --- a/pkg/scalers/influxdb_scaler.go +++ b/pkg/scalers/influxdb_scaler.go @@ -43,15 +43,9 @@ func NewInfluxDBScaler(config *ScalerConfig) (Scaler, error) { } influxDBLog.Info("starting up influxdb client") - // In case unsafeSsl is enabled. - if meta.unsafeSsl { - return &influxDBScaler{ - client: influxdb2.NewClientWithOptions(meta.serverURL, meta.authToken, influxdb2.DefaultOptions().SetTLSConfig(&tls.Config{InsecureSkipVerify: true})), - metadata: meta, - }, nil - } + client := influxdb2.NewClientWithOptions(meta.serverURL, meta.authToken, influxdb2.DefaultOptions().SetTLSConfig(&tls.Config{InsecureSkipVerify: meta.unsafeSsl})) return &influxDBScaler{ - client: influxdb2.NewClient(meta.serverURL, meta.authToken), + client: client, metadata: meta, }, nil } From c1004bc6a539a14744983706631042ead7a0100b Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 23 Nov 2021 14:40:55 +0100 Subject: [PATCH 2/4] Update changelog Signed-off-by: Jorge Turrado --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b19f08b6776..8dde4f28e3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ - MySQL Scaler: don't expose connection string in `metricName` ([#2171](https://github.com/kedacore/keda/pull/2171)) - Provide support for configuring authentication through TriggerAuthentication for Stan scaler ([#2167](https://github.com/kedacore/keda/pull/2167)) - Add `pageSize` (using regex) in RabbitMQ Scaler ([#2162](https://github.com/kedacore/keda/pull/2162)|[#2319](https://github.com/kedacore/keda/pull/2319)) -- Add `unsafeSsl` parameter in InfluxDB scaler ([#2157](https://github.com/kedacore/keda/pull/2157)) +- Add `unsafeSsl` parameter in InfluxDB scaler ([#2157](https://github.com/kedacore/keda/pull/2157))|[#2320](https://github.com/kedacore/keda/pull/2320) - Improve metric name creation to be unique using scaler index inside the scaler ([#2161](https://github.com/kedacore/keda/pull/2161)) - Improve error message if `IdleReplicaCount` are equal to `MinReplicaCount` to be the same as the check ([#2212](https://github.com/kedacore/keda/pull/2212)) - Improve Cloudwatch Scaler metric exporting logic ([#2243](https://github.com/kedacore/keda/pull/2243)) From a9f0ffe3140409475e00a708d92d8949783bcc30 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 23 Nov 2021 14:43:27 +0100 Subject: [PATCH 3/4] Refactor client creation Signed-off-by: Jorge Turrado --- pkg/scalers/influxdb_scaler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/scalers/influxdb_scaler.go b/pkg/scalers/influxdb_scaler.go index 4fdf2c90e83..a447408ed7b 100644 --- a/pkg/scalers/influxdb_scaler.go +++ b/pkg/scalers/influxdb_scaler.go @@ -43,7 +43,11 @@ func NewInfluxDBScaler(config *ScalerConfig) (Scaler, error) { } influxDBLog.Info("starting up influxdb client") - client := influxdb2.NewClientWithOptions(meta.serverURL, meta.authToken, influxdb2.DefaultOptions().SetTLSConfig(&tls.Config{InsecureSkipVerify: meta.unsafeSsl})) + client := influxdb2.NewClientWithOptions( + meta.serverURL, + meta.authToken, + influxdb2.DefaultOptions().SetTLSConfig(&tls.Config{InsecureSkipVerify: meta.unsafeSsl}) + ) return &influxDBScaler{ client: client, metadata: meta, From ac110a2c87a39992ff3a791b82de2cb0b06e0fba Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 23 Nov 2021 14:46:12 +0100 Subject: [PATCH 4/4] Fix typo Signed-off-by: Jorge Turrado --- pkg/scalers/influxdb_scaler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/scalers/influxdb_scaler.go b/pkg/scalers/influxdb_scaler.go index a447408ed7b..bb7d20fa54d 100644 --- a/pkg/scalers/influxdb_scaler.go +++ b/pkg/scalers/influxdb_scaler.go @@ -46,8 +46,8 @@ func NewInfluxDBScaler(config *ScalerConfig) (Scaler, error) { client := influxdb2.NewClientWithOptions( meta.serverURL, meta.authToken, - influxdb2.DefaultOptions().SetTLSConfig(&tls.Config{InsecureSkipVerify: meta.unsafeSsl}) - ) + influxdb2.DefaultOptions().SetTLSConfig(&tls.Config{InsecureSkipVerify: meta.unsafeSsl})) + return &influxDBScaler{ client: client, metadata: meta,