Skip to content

Commit

Permalink
use vhostName from authParams when declared
Browse files Browse the repository at this point in the history
Signed-off-by: Michi U. <[email protected]>
  • Loading branch information
michemache committed Nov 28, 2024
1 parent 2adbc81 commit 977de43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/scalers/rabbitmq_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type rabbitMQMetadata struct {
// either http or amqp protocol
Protocol string `keda:"name=protocol, order=triggerMetadata;authParams, optional, default=auto"`
// override the vhost from the connection info
VhostName string `keda:"name=vhostName, order=triggerMetadata, optional"`
VhostName string `keda:"name=vhostName, order=triggerMetadata;authParams, optional"`
// specify if the queueName contains a rexeg
UseRegex bool `keda:"name=useRegex, order=triggerMetadata, optional"`
// specify if the QueueLength value should exclude Unacknowledged messages (Ready messages only)
Expand Down
4 changes: 4 additions & 0 deletions pkg/scalers/rabbitmq_scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ var testRabbitMQAuthParamData = []parseRabbitMQAuthParamTestData{
{map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"username": "user"}, true, rmqTLSDisable, false},
// failure, password but no username
{map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"password": "PASSWORD"}, true, rmqTLSDisable, false},
// success, vhostName
{map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"vhostName": "myVhost"}, false, rmqTLSDisable, false},
// success, vhostName but empty
{map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"vhostName": ""}, false, rmqTLSDisable, false},
// success, username and password from env
{map[string]string{"queueName": "sample", "hostFromEnv": host, "usernameFromEnv": rabbitMQUsername, "passwordFromEnv": rabbitMQPassword}, v1alpha1.AuthPodIdentity{}, map[string]string{}, false, rmqTLSDisable, false},
// failure, username from env but not password
Expand Down

0 comments on commit 977de43

Please sign in to comment.