Skip to content

Commit

Permalink
Support Keda scaled object
Browse files Browse the repository at this point in the history
  • Loading branch information
ekirmayer committed Dec 16, 2024
1 parent ecacadf commit d3b3442
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stable/locust/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: locust
version: "0.32.2"
version: "0.32.3"
appVersion: 2.32.2
home: https://github.com/locustio/locust
icon: https://locust.io/static/img/logo.png
Expand Down
8 changes: 6 additions & 2 deletions stable/locust/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# locust

![Version: 0.32.2](https://img.shields.io/badge/Version-0.32.2-informational?style=flat-square) ![AppVersion: 2.32.2](https://img.shields.io/badge/AppVersion-2.32.2-informational?style=flat-square)
![Version: 0.32.3](https://img.shields.io/badge/Version-0.32.3-informational?style=flat-square) ![AppVersion: 2.32.2](https://img.shields.io/badge/AppVersion-2.32.2-informational?style=flat-square)

A chart to install Locust, a scalable load testing tool written in Python.

Expand Down Expand Up @@ -37,7 +37,7 @@ helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/locust
To install a specific version of this chart:

```console
helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/locust --version 0.32.2
helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/locust --version 0.32.3
```

To install the chart with the release name `my-release`:
Expand Down Expand Up @@ -148,6 +148,10 @@ helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust -f values.
| worker.hpa.minReplicas | int | `1` | |
| worker.hpa.targetCPUUtilizationPercentage | int | `40` | |
| worker.image | string | `""` | A custom docker image including tag |
| worker.keda.cooldownPeriod | int | `30` | |
| worker.keda.enabled | bool | `false` | |
| worker.keda.pollingInterval | int | `15` | |
| worker.keda.triggers | string | `"# https://keda.sh/docs/latest/scalers/metrics-api/\n- type: metrics-api\n metadata:\n activationTargetValue: \"0\"\n targetValue: \"50\" # Scale pods based on target users\n url: \"http://{{ template \"locust.fullname\" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ $.Values.service.port }}/stats/requests\"\n format: json\n valueLocation: 'user_count'\n"` | |
| worker.logLevel | string | `"INFO"` | Log level. Can be INFO or DEBUG |
| worker.nodeSelector | object | `{}` | Overwrites nodeSelector from global |
| worker.pdb.enabled | bool | `false` | Whether to create a PodDisruptionBudget for the worker pods |
Expand Down
27 changes: 27 additions & 0 deletions stable/locust/templates/worker-keda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.worker.keda.enabled }}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ template "locust.fullname" . }}
labels:
{{ include "locust.labels" . | indent 4 }}
component: "worker"
{{- with .Values.worker.keda.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
name: {{ template "locust.fullname" . }}-worker
pollingInterval: {{ .Values.worker.keda.pollingInterval }}
cooldownPeriod: {{ .Values.worker.keda.cooldownPeriod }}
minReplicaCount: {{ .Values.worker.hpa.minReplicas }}
maxReplicaCount: {{ .Values.worker.hpa.maxReplicas }}
fallback:
failureThreshold: {{ .Values.worker.keda.failureThreshold | default 3 }}
replicas: {{ .Values.worker.keda.fallbackReplicas | default .Values.worker.hpa.minReplicas }}
triggers:
{{- tpl .Values.worker.keda.triggers . | nindent 4}}
{{- end }}
14 changes: 14 additions & 0 deletions stable/locust/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,20 @@ worker:
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 40
keda:
enabled: false
pollingInterval: 15
cooldownPeriod: 30
# worker.keda,triggers - Allow passing required triggers to scale upon as string template for complex triggering
triggers: |
# https://keda.sh/docs/latest/scalers/metrics-api/
- type: metrics-api
metadata:
activationTargetValue: "0"
targetValue: "50" # Scale pods based on target users
url: "http://{{ template "locust.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ $.Values.service.port }}/stats/requests"
format: json
valueLocation: 'user_count'
# worker.resources -- resources for the locust worker
resources: {}
# limits:
Expand Down

0 comments on commit d3b3442

Please sign in to comment.