Skip to content

Commit

Permalink
PR comments 1
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>
  • Loading branch information
ahmelsayed committed Jul 28, 2020
1 parent 7381c42 commit e36733c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions content/docs/2.0/concepts/external-scalers.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ type PushScaler interface {
```

The `Scaler` interface defines 4 methods:
- `GetMetrics` and `GetMetricsSpecForScaling` that are used to build the HPA definition for that particular scaler.
- `IsActive` is called on `pollingInterval` defined in the ScaledObject/ScaledJob CRDs and scaling to 1 happens if this returns true
- `Close` is called to allow the scaler to clean up connections or other resources.
- `GetMetricSpec` returns the target value for the HPA definition for the scaler. For more details refer to [Implementing `GetMetricSpec`](#5-implementing-getmetricspec)
- `GetMetrics` returns the value of the metric refered to from `GetMetricSpec`. For more details refer to [Implementing `GetMetrics`](#6-implementing-getmetrics)

> Refer to the [HPA docs](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/) for how HPA calculates replicaCount based on metric value and target value.
The `PushScaler` interface adds `Run` method. The `Run` method receives a push channel (`active`), that the scaler can push `true` to any time to force scaling action independently from `pollingInterval`.

Expand Down Expand Up @@ -498,7 +501,7 @@ server.addService(externalScalerProto.externalscaler.ExternalScaler.service, {

#### 6. Implementing `GetMetrics`

`GetMetrics` returns the value of the metric refered to from `GetMetricSpec`, in this example it's `earthquakeThreshold`. Refer to the [HPA docs](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/) for how HPA calculates replicaCount based on metric value and target value.
`GetMetrics` returns the value of the metric refered to from `GetMetricSpec`, in this example it's `earthquakeThreshold`.

{{< collapsible "Golang" >}}
```golang
Expand Down

0 comments on commit e36733c

Please sign in to comment.