@@ -59,9 +59,12 @@ pub struct KedaOptions {
59
59
/// Max Replicas for the HPA of the ScaledObject
60
60
pub max_replicas : i32 ,
61
61
62
- /// Amqp Host
62
+ /// Amqp Host, without authentication ref
63
63
pub amqp_host : String ,
64
64
65
+ /// Amqp Host, with authentication ref
66
+ pub authentication_ref : Option < String > ,
67
+
65
68
/// Mode
66
69
pub mode : String ,
67
70
@@ -298,9 +301,18 @@ impl KubernetesDriver {
298
301
type_: "rabbitmq" . to_string( ) ,
299
302
use_cached_metrics: Some ( keda. use_cached_metrics) ,
300
303
metric_type: keda. metric_type. clone( ) ,
304
+ authentication_ref: keda
305
+ . authentication_ref
306
+ . clone( )
307
+ . map( |auth_ref| keda:: AuthenticationRef { name: auth_ref } ) ,
301
308
metadata: {
302
309
let mut metadata = HashMap :: new( ) ;
303
- metadata. insert( "host" . to_string( ) , keda. amqp_host. clone( ) ) ;
310
+
311
+ // If there is no authentication reference, we use the amqp host from the KEDA configuration.
312
+ if keda. authentication_ref. is_none( ) {
313
+ metadata. insert( "host" . to_string( ) , keda. amqp_host. clone( ) ) ;
314
+ }
315
+
304
316
metadata. insert( "protocol" . to_string( ) , "auto" . to_string( ) ) ;
305
317
metadata. insert( "mode" . to_string( ) , keda. mode. clone( ) ) ;
306
318
metadata. insert( "value" . to_string( ) , keda. value. clone( ) ) ;
0 commit comments