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

feat: update formula documentation to include new fields #1230

Merged
merged 4 commits into from
Sep 26, 2023
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
32 changes: 26 additions & 6 deletions content/docs/2.12/concepts/scaling-deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ Starting from Kubernetes v1.18 the autoscaling API allows scaling behavior to be

```yaml
advanced:
scalingModifiers: # Optional. Section to specify scaling modifiers
target: {target-value-to-scale-on} # Mandatory. New target if metrics are anyhow composed together
formula: {formula-for-fetched-metrics} # Mandatory. Formula for calculation
scalingModifiers: # Optional. Section to specify scaling modifiers
target: {target-value-to-scale-on} # Mandatory. New target if metrics are anyhow composed together
activationTarget: {activation-target-value-to-scale-on} # Optional. New activation target if metrics are anyhow composed together
metricType: {metric-tipe-for-the-modifier} # Optional. Metric type to be used if metrics are anyhow composed together
formula: {formula-for-fetched-metrics} # Mandatory. Formula for calculation
```

**`scalingModifiers`**
Expand All @@ -217,7 +219,15 @@ The `scalingModifiers` is optional and **experimental**. If defined, both `targe

**`scalingModifiers.target`**

`target` defines new target value to scale on for the composed metric. All scaler metrics must be of the same type in order for ScaledObject to be successfully validated.
`target` defines new target value to scale on for the composed metric.

**`scalingModifiers.activationTarget`**

`activationTarget` defines new [activation target value](./scaling-deployments.md#activating-and-scaling-thresholds) to scale on for the composed metric. (Default: `0`, Optional)

**`scalingModifiers.metricType`**

`metricType` defines metric type used for this new `composite-metric`. (Values: `AverageValue`, `Value`, Default: `AverageValue`, Optional)

**`scalingModifiers.formula`**

Expand Down Expand Up @@ -286,23 +296,33 @@ advanced:
scalingModifiers:
formula: "(trig_one + trig_two)/2"
target: "2"
activationTarget: "2"
zroubalik marked this conversation as resolved.
Show resolved Hide resolved
metricType: "AverageValue"
...
triggers:
- type: kubernetes-workload
name: trig_one
metadata:
podSelector: 'pod=workload-test'
value: '1'
- type: metrics-api
name: trig_two
metadata:
targetValue: "2"
url: "https://mockbin.org/bin/336a8d99-9e09-4f1f-979d-851a6d1b1423"
valueLocation: "tasks"
```

Formula composes 2 given metrics from 2 triggers `kubernetes-workload` named `trig_one` and `metrics-api` named `trig_two` together as an average value and returns one final metric which is used to make autoscaling decisions on.

**Example: activationTarget**

```yaml
advanced:
scalingModifiers:
activationTarget: "2"
```

If the calculated value is <=2, the ScaledObject is not `Active` and it'll scale to 0 if it's allowed.

**Example: ternary operator**

```yaml
Expand Down