From f697f7341ea258557d15480e1f85eb7b7bd9c551 Mon Sep 17 00:00:00 2001 From: Tomek Urbaszek Date: Thu, 10 Sep 2020 18:10:29 +0200 Subject: [PATCH] Consolidate apiHost & host for RabbitMQ scaler Signed-off-by: Tomek Urbaszek --- content/docs/1.5/scalers/rabbitmq-queue.md | 26 +++++++++---------- content/docs/2.0/migration.md | 30 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/content/docs/1.5/scalers/rabbitmq-queue.md b/content/docs/1.5/scalers/rabbitmq-queue.md index 2ae80298b..3ab30549a 100644 --- a/content/docs/1.5/scalers/rabbitmq-queue.md +++ b/content/docs/1.5/scalers/rabbitmq-queue.md @@ -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 @@ -89,7 +89,7 @@ kind: Secret metadata: name: keda-rabbitmq-secret data: - apiHost: # base64 encoded value of format https://guest:password@localhost:443/vhostname + host: # base64 encoded value of format https://guest:password@localhost:443/vhostname --- apiVersion: keda.k8s.io/v1alpha1 kind: TriggerAuthentication @@ -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 @@ -113,7 +113,7 @@ spec: triggers: - type: rabbitmq metadata: - includeUnacked: "true" + protocol: http queueName: testqueue queueLength: "20" authenticationRef: diff --git a/content/docs/2.0/migration.md b/content/docs/2.0/migration.md index 26fc76139..1cc16d1d0 100644 --- a/content/docs/2.0/migration.md +++ b/content/docs/2.0/migration.md @@ -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. \ No newline at end of file + - `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' +```