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

Graphite scaler docs #524

Merged
merged 4 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
114 changes: 114 additions & 0 deletions content/docs/2.5/scalers/graphite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
+++
title = "Graphite"
layout = "scaler"
availability = "v2.5+"
maintainer = "Community"
description = "Scale applications based on metrics in Graphite."
go_file = "graphite_scaler"
+++

### Trigger Specification

This specification describes the `graphite` trigger that scales based on metrics in Graphite.

```yaml
triggers:
- type: graphite
metadata:
# Required
serverAddress: http://<graphite-host>:81
metricName: request-count # Note: name to identify the metric
query: stats.counters.http.hello-world.request.count.count # Note: query must return a vector/scalar single element response
threshold: '100'
queryTime: '-10Minutes' # Note: Query time in from argv Seconds/Minutes/Hours
```
**Parameter list:**

- `serverAddress` - Address of Graphite
- `metricName` - Name to identify the Metric in the external.metrics.k8s.io API. If using more than one trigger it is required that all `metricName`(s) be unique
- `query` - Query to run
- `threshold` - Value to start scaling for
- `queryTime` - Relative time range to execute query against. Please see the [graphite API docs](https://graphite-api.readthedocs.io/en/latest/api.html#from-until) for more information.

### Authentication Parameters

Graphite Scaler supports one type of authentication - basic authentication

**Basic authentication:**
- `authMode`: It must contain `basic` in case of Basic Authentication. Specify this in trigger configuration.
- `username`: This is a required field. Provide the username to be used for basic authentication.
- `password`: Provide the password to be used for authentication. For convenience, this has been marked optional, because many applications implement basic auth with a username as apikey and password as empty.

### Examples

```yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: graphite-scaledobject
namespace: default
spec:
scaleTargetRef:
name: my-deployment
triggers:
- type: graphite
metadata:
serverAddress: http://<graphite-host>:81
metricName: LagMetric
threshold: '100'
query: maxSeries(keepLastValue(reportd.*.gauge.detect.latest_max_time.value, 1))
queryTime: '-1Minutes'
```

Here is an example of a Graphite Scaler with Basic Authentication, define the `Secret` and `TriggerAuthentication` as follows

```yaml
apiVersion: v1
kind: Secret
metadata:
name: keda-graphite-secret
namespace: default
data:
username: "dXNlcm5hbWUK" # Must be base64
password: "cGFzc3dvcmQK"
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-graphite-creds
namespace: default
spec:
secretTargetRef:
- parameter: username
name: keda-graphite-secret
key: username
- parameter: password
name: keda-graphite-secret
key: password
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: graphite-scaledobject
namespace: default
labels:
deploymentName: php-apache-graphite
spec:
cooldownPeriod: 10
maxReplicaCount: 5
minReplicaCount: 0
pollingInterval: 5
scaleTargetRef:
name: php-apache-graphite
triggers:
- type: graphite
metadata:
authMode: "basic"
metricName: https_metric
query: https_metric
queryTime: -1Hours
serverAddress: http://<graphite server>:81
threshold: "100"
authenticationRef:
name: keda-graphite-creds
```
53 changes: 0 additions & 53 deletions content/docs/2.5/scalers/graphite.md.wip

This file was deleted.

4 changes: 2 additions & 2 deletions content/docs/2.5/scalers/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ metadata:
name: keda-prom-secret
namespace: default
data:
username: "username"
password: "password"
username: "dXNlcm5hbWUK" # Must be base64
password: "cGFzc3dvcmQK"
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
Expand Down