Skip to content

Commit

Permalink
Add documentation for Cassandra scaler (kedacore#560)
Browse files Browse the repository at this point in the history
Signed-off-by: nilayasiktoprak <nilayasiktoprak@gmail.com>
  • Loading branch information
nilayasiktoprak committed Oct 27, 2021
1 parent 9b5e603 commit 8aeffdd
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions content/docs/2.5/scalers/cassandra.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
+++
title = "Cassandra"
availability = "v2.5+"
maintainer = "Community"
description = "Scale applications based on Cassandra query results."
layout = "scaler"
go_file = "cassandra_scaler"
+++

### Trigger Specification

This specification describes the `cassandra` trigger that scales based on the outputs of a Cassandra query.

```yaml
triggers:
- type: cassandra
metadata:
username: "cassandra"
port: "9042"
clusterIPAddress: "cassandra.default"
consistency: "Quorum"
protocolVersion: "4"
keyspace: "test_keyspace"
query: "SELECT COUNT(*) FROM test_keyspace.test_table;"
targetQueryValue: "1"
metricName: "test_keyspace"
```
**Parameter list:**
- `username` - The username credential for connecting to the Cassandra instance.
- `port` - The port number of the Cassandra instance. (Optional, Can be set either here or in `clusterIPAddress`)
- `clusterIPAddress` - The IP address or the host name of the Cassandra instance.
- `consistency` - Configuration for a session or per individual read operation. (Values: `LOCAL_ONE`, `LOCAL_QUORUM`, `EACH_QUORUM`, `LOCAL_SERIAL`, `ONE`, `TWO`, `THREE`, `QUORUM`, `SERIAL`, `ALL`, Default: `ONE`, Optional)
- `protocolVersion` - CQL Binary Protocol. (Default: `4`, Optional)
- `keyspace` - The name of the keyspace used in Cassandra.
- `query` - A Cassandra query that should return single numeric value.
- `targetQueryValue` - The threshold value that is provided by the user and used as `targetAverageValue` in the Horizontal Pod Autoscaler (HPA).
- `metricName` - Name to assign to the metric. (Default: `s<X>-cassandra-<KEYSPACE>`, Optional, In case of `metricName` is specified, it will be used to generate the `metricName` like this: `s<X>-cassandra-<METRICNAME>`, where `<X>` is the index of the trigger in a ScaledObject)

### Authentication Parameters

You can authenticate by using a password via `TriggerAuthentication` configuration.

**Password Authentication:**

- `password` - Password for configured user to login to the Cassandra instance.

### Example

```yaml
apiVersion: v1
kind: Secret
metadata:
name: cassandra-secrets
type: Opaque
data:
cassandra_password: CASSANDRA_PASSWORD
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-trigger-auth-cassandra-secret
spec:
secretTargetRef:
- parameter: password
name: cassandra-secrets
key: cassandra_password
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: cassandra-scaledobject
spec:
scaleTargetRef:
name: nginx-deployment
triggers:
- type: cassandra
metadata:
username: "cassandra"
port: "9042"
clusterIPAddress: "cassandra.default"
consistency: "Quorum"
protocolVersion: "4"
query: "SELECT COUNT(*) FROM test_keyspace.test_table;"
targetQueryValue: "1"
metricName: "test_keyspace"
authenticationRef:
name: keda-trigger-auth-cassandra-secret
```

0 comments on commit 8aeffdd

Please sign in to comment.