Skip to content

Commit

Permalink
Consolidate apiHost & host for RabbitMQ scaler
Browse files Browse the repository at this point in the history
Signed-off-by: Tomek Urbaszek <tomasz.urbaszek@polidea.com>
  • Loading branch information
turbaszek committed Sep 10, 2020
1 parent d2620d7 commit f697f73
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
26 changes: 13 additions & 13 deletions content/docs/1.5/scalers/rabbitmq-queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ triggers:
- type: rabbitmq
metadata:
host: RabbitMqHost # Optional. If not specified, it must be done by using TriggerAuthentication.
protocol: amqp # Optional. Specifies protocol to use. Either amqp or http
queueLength: '20' # Optional. Queue length target for HPA. Default: 20 messages
queueName: testqueue
includeUnacked: 'true' # Optional, use unacked + ready messages count
apiHost: RabbitApiHost # Optional. Represents the HTTP management API endpoint. If not specified, it must be done by using TriggerAuthentication.
authenticationRef:
name: keda-trigger-auth-rabbitmq-conn
```
**Parameter list:**
- `host`: Value is the name of the environment variable your deployment uses to get the connection string. This is usually resolved from a `Secret V1` or a `ConfigMap V1` collections. `env` and `envFrom` are both supported. The resolved host should follow a format like `amqp://guest:password@localhost:5672/vhost`
- `host`: Value is the name of the environment variable your deployment uses to get the connection string.
This is usually resolved from a `Secret V1` or a `ConfigMap V1` collections. `env` and `envFrom` are both
supported. The resolved host should either follow a format like `amqp://guest:password@localhost:5672/vhost` or
`https://guest:password@localhost:443/vhostname`.
- `queueName`: Name of the queue to read message from. Required.
- `queueLength`: Queue length target for HPA. Default is 20. Optional.
- `includeUnacked`: By default `includeUnacked` is `false` in this case scaler uses AMQP protocol, requires `host` and only counts messages in the queue and ignores unacked messages. If `includeUnacked` is `true` then `host` is not required but `apiHost` is required in this case scaler uses HTTP management API and counts messages in the queue + unacked messages count. Optional. `host` or `apiHost` value comes from authencation trigger.
- `apiHost`: It has similar format as of `host` but for HTTP API endpoint, like https://guest:password@localhost:443/vhostname.

Note `host` and `apiHost` both have an optional vhost name after the host slash which will be used to scope API request.
- `protocol`: Protocol to be used for communication. Either `http` or `amqp`. It should correspond with the `host` value.


### Authentication Parameters

TriggerAuthentication CRD is used to connect and authenticate to RabbitMQ:

- `host`: AMQP URI connection string, like `amqp://guest:password@localhost:5672/vhost`.
- `apiHost`: HTTP API endpoint, like `https://guest:password@localhost:443/vhostname`.
- `host`: AMQP URI connection string if `protocol=amqp`, like `amqp://guest:password@localhost:5672/vhost` or
`https://guest:password@localhost:443/vhostname` if `protocol=http`.

### Example

Expand Down Expand Up @@ -89,7 +89,7 @@ kind: Secret
metadata:
name: keda-rabbitmq-secret
data:
apiHost: <HTTP API endpoint> # base64 encoded value of format https://guest:password@localhost:443/vhostname
host: <HTTP API endpoint> # base64 encoded value of format https://guest:password@localhost:443/vhostname
---
apiVersion: keda.k8s.io/v1alpha1
kind: TriggerAuthentication
Expand All @@ -98,9 +98,9 @@ metadata:
namespace: default
spec:
secretTargetRef:
- parameter: apiHost
- parameter: host
name: keda-rabbitmq-secret
key: apiHost
key: host
---
apiVersion: keda.k8s.io/v1alpha1
kind: ScaledObject
Expand All @@ -113,7 +113,7 @@ spec:
triggers:
- type: rabbitmq
metadata:
includeUnacked: "true"
protocol: http
queueName: testqueue
queueLength: "20"
authenticationRef:
Expand Down
30 changes: 29 additions & 1 deletion content/docs/2.0/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,32 @@ TODO
### Scalers

**Kafka**
- `authMode` property was replaced with `sasl` and `tls` properties. Please refer [documentation](../scalers/apache-kafka/#authentication-parameters) for Kafka Authentication Parameters details.
- `authMode` property was replaced with `sasl` and `tls` properties. Please refer [documentation](../scalers/apache-kafka/#authentication-parameters) for Kafka Authentication Parameters details.

**RabbitMQ**

In KEDA 2.0 the RabbitMQ scaler has only `host` parameter, and the protocol for communication can be specified by
`protocol` (http or amqp). The default value is `amqp`. The behavior changes only for scalers that were using HTTP
protocol.

Example of RabbitMQ trigger before 2.0:
```yaml
triggers:
- type: rabbitmq
metadata:
queueLength: '20'
queueName: testqueue
includeUnacked: 'true'
apiHost: 'https://guest:password@localhost:443/vhostname'
```
The same trigger in 2.0:
```yaml
triggers:
- type: rabbitmq
metadata:
queueLength: '20'
queueName: testqueue
protocol: 'http'
host: 'https://guest:password@localhost:443/vhostname'
```

0 comments on commit f697f73

Please sign in to comment.