feat: add support for the keda-http-add-on

Externally, it is treated the same as any other scaling trigger, but requires that the chart be installed in order for it to be supported.
This commit is contained in:
Jose Diaz-Gonzalez
2024-11-13 03:29:26 -05:00
parent 1751bf30ba
commit b98863b6a7
7 changed files with 227 additions and 16 deletions

View File

@@ -417,6 +417,56 @@ Each value in the `metadata` stanza can use the following interpolated strings:
- `DOKKU_PROCESS_TYPE`: The name of the process being scaled
- `DOKKU_APP_NAME`: The name of the app being scaled
##### HTTP Autoscaling
In addition to the built-in scalers that Keda provides, Dokku also supports Keda's HTTP Add On. This requires that the addon be properly installed and configured. For existing k3s clusters, this can be performed by the `scheduler-k3s:ensure-charts` command:
```shell
dokku scheduler-k3s:ensure-charts
```
> [!NOTE]
> Users who wish to use this functionality on a cluster not managed by Dokku will need to manually install the `keda-http-add-on` into the `keda` namespace. Please consult the `keda-http-add-on` [install documentation](https://kedacore.github.io/http-add-on/install.html) for further details.
> [!WARNING]
> If the `keda-http-add-on` chart is not installed, then this trigger will be ignored.
Once the chart is configured, an `http` trigger can be specified like so:
```json
{
"formation": {
"web": {
"autoscaling": {
"min_quantity": 1,
"max_quantity": 10,
"triggers": [
{
"type": "http",
"metadata": {
"scaledown_period_seconds": "150",
"request_rate_target_value": "50"
}
}
]
}
}
}
}
```
The following metadata properties are supported with the http autoscaler:
- `scale_by`: (default: `request_rate`) whether to scale by `concurrency` or `request_rate`.
- `scaledown_period_seconds`: (default: `300`) period to wait after the last reported active before scaling the resource back to 0.
- `request_rate_granularity_seconds`: (default: `1`) granualarity of the aggregated requests for the request rate calculation.
- `request_rate_target_value`: (default: `100`) target value for the request rate.
- `request_rate_window_seconds`: (default: `60`) aggregation window for the request rate calculation.
- `concurrency_target_value`: (default: `100`) target value for the request concurrency.
Note that due to Keda limitations, scaling is done by _either_ `concurrency` or `request_rate`.
#### Workload Autoscaling Authentication
Most Keda triggers require some form of authentication to query for data. In the Kubernetes API, they are represented by `TriggerAuthentication` and `ClusterTriggerAuthentication` resources. Dokku can manage these via the `scheduler-k3s:autoscaling-auth` commands, and includes generated resources with each helm release generated by a deploy.