Skip to content

Commit

Permalink
Update RabbitMQ Scaler documentation to include the option of use reg…
Browse files Browse the repository at this point in the history
…ex (#489)

* Update RabbitMQ Scaler documentation to include the option of use regex in case of http queue

Signed-off-by: jorturfer <[email protected]>

* Update the documentation with the suggestions

Signed-off-by: jorturfer <[email protected]>

Co-authored-by: Tom Kerkhove <[email protected]>
Signed-off-by: Jorge Turrado <[email protected]>

* Improve documentation

Co-authored-by: Zbynek Roubalik <[email protected]>
Signed-off-by: jorturfer <[email protected]>

* Remove whitespaces

Signed-off-by: jorturfer <[email protected]>

* Clarify possible values to useRegex

Signed-off-by: jorturfer <[email protected]>

* Update documentation to allow regex + messageRate

Signed-off-by: Jorge Turrado <[email protected]>

Co-authored-by: Tom Kerkhove <[email protected]>
Co-authored-by: Zbynek Roubalik <[email protected]>
  • Loading branch information
3 people authored Jul 27, 2021
1 parent 2d38805 commit 24d347f
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions content/docs/2.4/scalers/rabbitmq-queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ triggers:
- `protocol`: Protocol to be used for communication. Either `auto`, `http`, or `amqp`. It should correspond with the `host` value. Optional, will autodetect based on the `host` URL if possible.
- `vhostName`: Vhost to use for the connection, overrides any vhost set in the connection string from `host`/`hostFromEnv`.
- `queueLength`: DEPRECATED! Use `mode: QueueLength` and `value: ##` instead. Target value for queue length passed to the scaler. Example: if one pod can handle 10 messages, set the queue length target to 10. If the actual number of messages in the queue is 30, the scaler scales to 3 pods. Default is 20 unless `publishRate` is specified, in which case `queueLength` is disabled for this trigger.
- `useRegex`: In case of `http` protocol, this parameter allows to use regex (in `queueName` parameter) to select queue instead of full name, the valid values are: `"true"` and `"false"`. Optional.
- `operation`: Operation that will be applied to compute the number of messages in case of `useRegex` enabled. Either `sum` (default),`max`, or `avg`. Optional.

Some parameters could be provided using environmental variables, instead of setting them directly in metadata. Here is a list of parameters you can use to retrieve values from environment variables:

Expand All @@ -46,6 +48,8 @@ Some parameters could be provided using environmental variables, instead of sett

> 💡 **Note:** `mode: MessageRate` requires protocol `http`.

> 💡 **Note:** `useRegex: "true"` requires protocol `http` and ignores unacknowledged messages.

> ⚠ **Important:** if you have unacknowledged messages and want to have these counted for the scaling to happen, make sure to utilize the `http` REST API interface which allows for these to be counted.

> ⚠ **Important:** If scaling against both is desired then the `ScaledObject` should have two triggers, one for `mode: QueueLength` and the other for `mode: MessageRate`. HPA will scale based on the largest result considering each of the two triggers independently.
Expand Down Expand Up @@ -188,3 +192,45 @@ spec:
authenticationRef:
name: keda-trigger-auth-rabbitmq-conn
```

#### HTTP protocol (`QueueLength`) and using regex (`useRegex`):

```yaml
apiVersion: v1
kind: Secret
metadata:
name: keda-rabbitmq-secret
data:
host: <HTTP API endpoint> # base64 encoded value of format http://guest:password@localhost:15672/vhost
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-trigger-auth-rabbitmq-conn
namespace: default
spec:
secretTargetRef:
- parameter: host
name: keda-rabbitmq-secret
key: host
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: rabbitmq-scaledobject
namespace: default
spec:
scaleTargetRef:
name: rabbitmq-deployment
triggers:
- type: rabbitmq
metadata:
protocol: http
queueName: ^.*incoming$
mode: QueueLength
value: "20"
useRegex: "true"
operation: max
authenticationRef:
name: keda-trigger-auth-rabbitmq-conn
```

0 comments on commit 24d347f

Please sign in to comment.