From 08dfc55b287beedd28c7666222fe825b83112b6c Mon Sep 17 00:00:00 2001 From: Nicholas Steicke Date: Wed, 10 Apr 2024 09:15:05 +0930 Subject: [PATCH] Update RabbitMQ HTTP Connections with TLS Config Signed-off-by: Nicholas Steicke --- CHANGELOG.md | 1 + pkg/scalers/rabbitmq_scaler.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aad16f3f023..843289d4f1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ Here is an overview of all new **experimental** features: - **General**: Validate empty array value of triggers in ScaledObject/ScaledJob creation ([#5520](https://github.com/kedacore/keda/issues/5520)) - **GitHub Runner Scaler**: Fixed `in_progress` detection on running jobs instead of just `queued` ([#5604](https://github.com/kedacore/keda/issues/5604)) - **New Relic Scaler**: Consider empty results set from query executer ([#5619](https://github.com/kedacore/keda/pull/5619)) +- **RabbitMQ Scaler**: HTTP Connections respect TLS configuration ([#5668](https://github.com/kedacore/keda/issues/5668)) ### Deprecations diff --git a/pkg/scalers/rabbitmq_scaler.go b/pkg/scalers/rabbitmq_scaler.go index 4e8cf3c2b5e..6037aa45944 100644 --- a/pkg/scalers/rabbitmq_scaler.go +++ b/pkg/scalers/rabbitmq_scaler.go @@ -137,6 +137,14 @@ func NewRabbitMQScaler(config *scalersconfig.ScalerConfig) (Scaler, error) { s.metadata = meta s.httpClient = kedautil.CreateHTTPClient(meta.timeout, meta.unsafeSsl) + if meta.enableTLS { + tlsConfig, tlsErr := kedautil.NewTLSConfigWithPassword(meta.cert, meta.key, meta.keyPassword, meta.ca, meta.unsafeSsl) + if tlsErr != nil { + return nil, tlsErr + } + s.httpClient.Transport = kedautil.CreateHTTPTransportWithTLSConfig(tlsConfig) + } + if meta.protocol == amqpProtocol { // Override vhost if requested. host := meta.host