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 documetation about Bearer Auth for Metrics API scaler #513

Merged
merged 3 commits into from
Aug 19, 2021
Merged
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
54 changes: 51 additions & 3 deletions content/docs/2.5/scalers/metrics-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ because many applications implement basic auth with a username as apikey and pas
- `cert`: Certificate for client authentication. This is a required field.
- `key`: Key for client authentication. Optional. This is a required field.

**Bearer authentication:**
- `authMode`: It must be set to `bearer` in case of Bearer Authentication. Specify this in trigger configuration.
- `token`: Token that should be placed in the `Authorization` header. The header will be `Authorization: Bearer {token}`.

### Example

Here is a full example of scaled object definition using Metric API trigger:
Expand Down Expand Up @@ -105,7 +109,7 @@ Assuming such response, Metrics API trigger will figure out that current metric

> 💡 **NOTE:**The value of the metric can either be an integral unquoted json number type (e.g. 123). Or a quantity (e.g. "123", "1.23", "10Mi").

Here is an example of a metric scaler with API Key based authentication,
Here is an example of a metric scaler with API Key based authentication,

```yaml
apiVersion: v1
Expand Down Expand Up @@ -151,7 +155,51 @@ spec:
name: keda-metric-api-creds
```

Here is an example of a metric scaler with Basic Authentication, define the `Secret` and `TriggerAuthentication` as follows
Here is an example of a metric scaler with Bearer Authentication, define the `Secret` and `TriggerAuthentication` as follows

```yaml
apiVersion: v1
kind: Secret
metadata:
name: keda-metric-api-secret
namespace: default
data:
token: "PlaceYourTokenHere"
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-metric-api-creds
namespace: default
spec:
secretTargetRef:
- parameter: token
name: keda-metric-api-secret
key: token
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: http-scaledobject
namespace: keda
labels:
deploymentName: dummy
spec:
maxReplicaCount: 12
scaleTargetRef:
name: dummy
triggers:
- type: metrics-api
metadata:
targetValue: "7"
url: "http://api:3232/components/stats"
valueLocation: 'components.worker.tasks'
authMode: "bearer"
authenticationRef:
name: keda-metric-api-creds
```

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

```yaml
apiVersion: v1
Expand Down Expand Up @@ -200,7 +248,7 @@ spec:
```


Here is an example of a metric scaler with TLS Authentication, define the `Secret` and `TriggerAuthentication` as follows
Here is an example of a metric scaler with TLS Authentication, define the `Secret` and `TriggerAuthentication` as follows

```yaml
apiVersion: v1
Expand Down