Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds CouchDB scaler docs #967

Merged
merged 3 commits into from
Dec 8, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions content/docs/2.9/scalers/couchdb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
+++
title = "CouchDB"
availability = "v2.9+"
maintainer = "Community"
description = "Scale applications based on CouchDB query results."
go_file = "couchdb_scaler"
+++

### Trigger Specification

This specification describes the `couchdb` trigger that scales based on the outputs of a CouchDB query.

```yaml
triggers:
- type: couchdb
metadata:
hostname: "test-release-svc-couchdb.couchdb-test-ns.svc.cluster.local"
zroubalik marked this conversation as resolved.
Show resolved Hide resolved
port: "5984"
dbName: "animals"
queryValue: "1"
query: '{ "selector": { "feet": { "$gt": 0 } }, "fields": ["_id", "feet", "greeting"] }'
activationQueryValue: "1"
metricName: "global-metric"
zroubalik marked this conversation as resolved.
Show resolved Hide resolved
```

**Parameter list:**

- `host` - The hostname for connecting to the CouchDB service.
- `dbName` - Name of the database.
- `queryValue` - A threshold that will define when scaling should occur.
- `port` - The port number of the CouchDB service.
- `query` - A CouchDB query that should return single numeric value.
- `activationQueryValue` - Target value for activating the scaler. Learn more about activation [here](./../concepts/scaling-deployments.md#activating-and-scaling-thresholds).(Default: `0`, Optional)
- `metricName` - Name to assign to the metric. (Default: `s<X>-couchdb-<KEYSPACE>`, Optional, In case of `metricName` is specified, it will be used to generate the `metricName` like this: `s<X>-couchdb-<METRICNAME>`, where `<X>` is the index of the trigger in a ScaledObject)
zroubalik marked this conversation as resolved.
Show resolved Hide resolved

### Authentication Parameters

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

**Password Authentication:**

- `password` - Password for configured user to login to the Couchdb instance.
- `username` - Username for configured user to login to the Couchdb instance.

### Example

Here is an example of a couchdb scaler with Basic Authentication, where the `Secret` and `TriggerAuthentication` are defined as follows:

```yaml
apiVersion: v1
kind: Secret
metadata:
name: couchdb-secrets
data:
username: COUCHDB_USERNAME
password: COUCHDB_PASSWORD
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-trigger-auth-couchdb-secret
spec:
secretTargetRef:
- parameter: password
name: couchdb-secrets
key: password
- parameter: username
name: couchdb-secrets
key: username
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: couchdb-scaledobject
spec:
scaleTargetRef:
name: nginx-deployment
triggers:
- type: couchdb
metadata:
hostname: "test-release-svc-couchdb.couchdb-test-ns.svc.cluster.local"
port: "5984"
dbName: "animals"
queryValue: "1"
query: '{ "selector": { "feet": { "$gt": 0 } }, "fields": ["_id", "feet", "greeting"] }'
activationQueryValue: "1"
metricName: "global-metric"
authenticationRef:
name: keda-trigger-auth-couchdb-secret
```