From 7f11dd0812e3788bb808fb1ab76529ae886e9df9 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 26 Sep 2023 01:09:19 +0200 Subject: [PATCH 1/4] feat: update formula documentation to include new fields Signed-off-by: Jorge Turrado --- .../docs/2.12/concepts/scaling-deployments.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/content/docs/2.12/concepts/scaling-deployments.md b/content/docs/2.12/concepts/scaling-deployments.md index ef4821333..160f5d1e2 100644 --- a/content/docs/2.12/concepts/scaling-deployments.md +++ b/content/docs/2.12/concepts/scaling-deployments.md @@ -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`** @@ -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`** From 431f861229759cfb574e77d36e24453c6e4117c6 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 26 Sep 2023 01:14:01 +0200 Subject: [PATCH 2/4] update docs to remove thresholds Signed-off-by: Jorge Turrado --- content/docs/2.12/concepts/scaling-deployments.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/content/docs/2.12/concepts/scaling-deployments.md b/content/docs/2.12/concepts/scaling-deployments.md index 160f5d1e2..fc9a9da43 100644 --- a/content/docs/2.12/concepts/scaling-deployments.md +++ b/content/docs/2.12/concepts/scaling-deployments.md @@ -302,11 +302,9 @@ triggers: 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" ``` From a775ce2ed5b30e25cb55f26e608c1d956eb2555d Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 26 Sep 2023 08:30:26 +0200 Subject: [PATCH 3/4] update docs Signed-off-by: Jorge Turrado --- content/docs/2.12/concepts/scaling-deployments.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/docs/2.12/concepts/scaling-deployments.md b/content/docs/2.12/concepts/scaling-deployments.md index fc9a9da43..de753cfe3 100644 --- a/content/docs/2.12/concepts/scaling-deployments.md +++ b/content/docs/2.12/concepts/scaling-deployments.md @@ -296,6 +296,8 @@ advanced: scalingModifiers: formula: "(trig_one + trig_two)/2" target: "2" + activationTarget: "2" + metricType: "AverageValue" ... triggers: - type: kubernetes-workload From b42c471dbb22167901b77099ea28bca8c3d97d32 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Tue, 26 Sep 2023 12:53:36 +0200 Subject: [PATCH 4/4] add example Signed-off-by: Jorge Turrado --- content/docs/2.12/concepts/scaling-deployments.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/docs/2.12/concepts/scaling-deployments.md b/content/docs/2.12/concepts/scaling-deployments.md index de753cfe3..4b62a87f8 100644 --- a/content/docs/2.12/concepts/scaling-deployments.md +++ b/content/docs/2.12/concepts/scaling-deployments.md @@ -313,6 +313,16 @@ triggers: 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