From dece56aa8ae857f3b1ec5e312c30f514a1921b0d Mon Sep 17 00:00:00 2001 From: wangrushen Date: Sun, 22 Sep 2024 11:19:42 +0800 Subject: [PATCH] docs: rabbitmq provide separate paremeters for user and password Signed-off-by: wangrushen --- content/docs/2.16/scalers/rabbitmq-queue.md | 61 +++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/content/docs/2.16/scalers/rabbitmq-queue.md b/content/docs/2.16/scalers/rabbitmq-queue.md index 1e65d7dd5..e2cc20e20 100644 --- a/content/docs/2.16/scalers/rabbitmq-queue.md +++ b/content/docs/2.16/scalers/rabbitmq-queue.md @@ -25,6 +25,8 @@ triggers: # Alternatively, you can use existing environment variables to read configuration from: # See details in "Parameter list" section hostFromEnv: RABBITMQ_HOST # Optional. You can use this instead of `host` parameter + usernameFromEnv: RABBITMQ_USERNAME # Optional. You can use this instead of TriggerAuthentication + passwordFromEnv: RABBITMQ_PASSWORD # Optional. You can use this instead of TriggerAuthentication unsafeSsl: true ``` @@ -48,6 +50,8 @@ triggers: 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: - `hostFromEnv` - The host and port of the RabbitMQ server, similar to `host`, but reads it from an environment variable on the scale target. +- `usernameFromEnv` - The username to use to connect to the broker's management endpoint. +- `passwordFromEnv` - The password to use to connect to the broker's management endpoint. > 💡 **Note:** `host`/`hostFromEnv` has an optional vhost name after the host slash which will be used to scope API request. @@ -70,6 +74,15 @@ TriggerAuthentication CRD is used to connect and authenticate to RabbitMQ: > See the [RabbitMQ Ports](https://www.rabbitmq.com/networking.html#ports) section for more details on how to configure the ports. +**Username and Password based authentication:** + +This allows sensitive credentials to be stored and managed separately from the connection string. + +- `username` - The username to use to connect to the broker's management endpoint. +- `password` - The password to use to connect to the broker's management endpoint. + +> 💡 **Note:** If username or password are set in TriggerAuthentication or environment variables, they will override any credentials provided in the host. + **TLS authentication:** - `tls` - To enable SSL auth for RabbitMQ, set this to `enable`. If not set, TLS for RabbitMQ is not used. (Values: `enable`, `disable`, Default: `disable`, Optional) @@ -125,6 +138,54 @@ spec: name: keda-trigger-auth-rabbitmq-conn ``` +#### AMQP protocol with user/password auth: + +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: keda-rabbitmq-secret +data: + host: # base64 encoded value of format amqp://localhost:5672/vhost (no username/password) + username: # base64 encoded value of username + password: # base64 encoded value of password +--- +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 + - parameter: username + name: keda-rabbitmq-secret + key: username + - parameter: password + name: keda-rabbitmq-secret + key: password +--- +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: rabbitmq-scaledobject + namespace: default +spec: + scaleTargetRef: + name: rabbitmq-deployment + triggers: + - type: rabbitmq + metadata: + protocol: amqp + queueName: testqueue + mode: QueueLength + value: "20" + authenticationRef: + name: keda-trigger-auth-rabbitmq-conn +``` + #### AMQPS protocol with TLS auth: ```yaml