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

Add documentation for Elasticsearch scaler #586

Merged
merged 7 commits into from
Nov 23, 2021
Merged
Changes from 4 commits
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
92 changes: 92 additions & 0 deletions content/docs/2.5/scalers/elasticsearch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
+++
title = "Elasticsearch"
availability = "v2.5+"
maintainer = "Community"
description = "Scale applications based on elasticsearch search template query result."
layout = "scaler"
orphaner marked this conversation as resolved.
Show resolved Hide resolved
+++

### Trigger Specification

This specification describes the `elasticsearch` trigger that scales based on result of an [elasticsearch search template](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) query.

The trigger always requires the following information:

```yaml
triggers:
- type: elasticsearch
metadata:
addresses: "http://localhost:9200"
username: "elastic"
passwordFromEnv: "ELASTIC_PASSWORD"
index: "my-index"
searchTemplateName: "my-search-template-name"
params: "param1:value1;param2:value2"
valueLocation: "hits.total.value"
targetValue: "1"
```

**Parameter list:**

- `addresses` - Comma separated list of hosts and ports of the Elasticsearch cluster client nodes.
- `username` - Username to authenticate with to Elasticsearch cluster.
- `passwordFromEnv` - Environment variable to read the authentication password from to authenticate with the Elasticsearch cluster.
- `index` - Comma separated list of indexes to run the search template query on.
- `searchTemplateName` - The search template name to run.
- `targetValue` - Target value to scale on. When the metric provided by the API is equal or higher to this value, KEDA will start scaling out. When the metric is 0 or less, KEDA will scale down to 0.
- `parameters` - Parameters that will be used by the search template. It supports multiples params separated by a semicolon character ( `;` )
orphaner marked this conversation as resolved.
Show resolved Hide resolved
- `valueLocation` - [GJSON path notation](https://github.com/tidwall/gjson#path-syntax) to refer to the field in the payload containing the metric value.
- `unsafeSsl` - Skip certificate validation when connecting over HTTPS. (Values: `true`, `false`, Default: `false`, Optional).
orphaner marked this conversation as resolved.
Show resolved Hide resolved

### Authentication Parameters

You can authenticate by using a username/password authentication.

**Password Authentication:**

- `username` - Username to authenticate with to Elasticsearch cluster.
- `password` - Password for configured user to login to Elasticsearch cluster.

### Example

Here is an example of how to deploy a scaled object with the `elasticsearch` scale trigger which uses `TriggerAuthentication`.

```yaml
apiVersion: v1
kind: Secret
metadata:
name: elasticsearch-secrets
type: Opaque
data:
password: cGFzc3cwcmQh
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-trigger-auth-elasticsearch-secret
spec:
secretTargetRef:
- parameter: password
name: elasticsearch-secrets
key: password
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: elasticsearch-scaledobject
spec:
scaleTargetRef:
name: "deployment-name"
triggers:
- type: elasticsearch
metadata:
addresses: "http://localhost:9200"
username: "elastic"
index: "my-index"
searchTemplateName: "my-search-template"
valueLocation: "hits.total.value"
targetValue: "10"
params: "dummy_value:1"
authenticationRef:
name: keda-trigger-auth-elasticsearch-secret
```