locust

by Delivery Hero

Helm chartv0.35.0App 2.32.2Verified publisher

A chart to install Locust, a scalable load testing tool written in Python. This chart will setup everything required to run a full distributed locust environment with any amount of workers. This chart will also create configmaps for storing the locust files in Kubernetes, this way there is no need to build custom docker images. By default it will install using an example locustfile and lib from [stable/locust/locustfiles/example](https://github.com/deliveryhero/helm-charts/tree/master/stable/locust/locustfiles/example). When you want to provide your own locustfile, you will need to create 2 configmaps using the structure from that example: ```console kubectl create configmap my-loadtest-locustfile --from-file path/to/your/main.py kubectl create configmap my-loadtest-lib --from-file path/to/your/lib/ ``` And then install the chart passing the names of those configmaps as values: ```console helm install locust oci://ghcr.io/deliveryhero/helm-charts/locust \ --set loadtest.name=my-loadtest \ --set loadtest.locust_locustfile_configmap=my-loadtest-locustfile \ --set loadtest.locust_lib_configmap=my-loadtest-lib ```

About this chart

locust

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

This chart will setup everything required to run a full distributed locust environment with any amount of workers.

This chart will also create configmaps for storing the locust files in Kubernetes, this way there is no need to build custom docker images.

By default it will install using an example locustfile and lib from stable/locust/locustfiles/example. When you want to provide your own locustfile, you will need to create 2 configmaps using the structure from that example:

kubectl create configmap my-loadtest-locustfile --from-file path/to/your/main.py
kubectl create configmap my-loadtest-lib --from-file path/to/your/lib/

And then install the chart passing the names of those configmaps as values:

helm install locust oci://ghcr.io/deliveryhero/helm-charts/locust \
  --set loadtest.name=my-loadtest \
  --set loadtest.locust_locustfile_configmap=my-loadtest-locustfile \
  --set loadtest.locust_lib_configmap=my-loadtest-lib

Homepage: https://github.com/locustio/locust

How to install this chart

A simple install with default values, latest chart version and generated name:

helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/locust

To install a specific version of this chart:

helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/locust --version 0.35.0

To install the chart with the release name my-release:

helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust

To install with some set values:

helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust --set values_key1=value1 --set values_key2=value2

To install with custom values file:

helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust -f values.yaml

Values

KeyTypeDefaultDescription
affinityobject{}
extraConfigMapsobject{}Any extra configmaps to mount for the master and worker. Can be used for extra python packages
extraLabelsobject{}Any extra labels to apply to all resources
extraObjectslist[]Any extra manifests to deploy alongside locust. Can be used for external secret providers
fullnameOverridestring""
hostAliaseslist[]List of entries added to the /etc/hosts file on the pod to resolve custom hosts
image.pullPolicystring"IfNotPresent"
image.repositorystring"locustio/locust"
image.tagstring"2.32.2"
imagePullSecretslist[]
ingress.annotationsobject{}
ingress.classNamestring""
ingress.enabledboolfalse
ingress.hosts[0].hoststring"chart-example.local"
ingress.hosts[0].pathstring"/"
ingress.hosts[0].pathTypestring"ImplementationSpecific"
ingress.tlslist[]
loadtest.environmentobject{}environment variables used in the load test for both master and workers
loadtest.environment_external_secretobject{}environment variables used in the load test for both master and workers, stored in secrets created outside this chart. Each secret contains a list of values in it. Usage: secret_name: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY]
loadtest.environment_load_from_secretslist[]environment variables used in the load test for both master and workers, stored in secrets created outside this chart. All variables from each secret are loaded. Usage: [secret_name1, secret_name2]
loadtest.environment_secretobject{}environment variables used in the load test for both master and workers, stored as secrets
loadtest.excludeTagsstring""whether to run locust with --exclude-tags [TAG [TAG ...]] options, so only tasks with no matching tags will be executed
loadtest.headlessboolfalsewhether to run locust with headless settings
loadtest.locustCmdstring"/opt/venv/bin/locust"The command to run Locust
loadtest.locust_hoststring"https://www.google.com"the host you will load test
loadtest.locust_lib_configmapstring"example-lib"name of a configmap containing your lib (default uses the example lib)
loadtest.locust_locustfilestring"main.py"the name of the locustfile
loadtest.locust_locustfile_configmapstring"example-locustfile"name of a configmap containing your locustfile (default uses the example locustfile)
loadtest.locust_locustfile_pathstring"/mnt/locust"the path of the locustfile (without trailing backslash)
loadtest.locust_requirementsfile_pathstring"/packages"the path of the requirements file (without trailing backslash)
loadtest.mount_external_secretobject{}additional mount used in the load test for both master and workers, stored in secrets created outside this chart. Each secret contains a list of values in it. Usage: mountPath: yourMountLocation, files: { secret_name: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY] }
loadtest.namestring"example"a name used for resources and settings in this load test
loadtest.pip_packageslist[]a list of extra python pip packages to install
loadtest.pip_requirementsfilestring"requirements.txt"
loadtest.pip_requirementsfile_configmapstring""name of a configmap containing your extra python pip packages
loadtest.tagsstring""whether to run locust with --tags [TAG [TAG ...]] options, so only tasks with any matching tags will be executed
master.affinityobject{}Overwrites affinity from global
master.argslist[]Any extra command args for the master
master.auth.enabledboolfalseWhen enabled using image tag 2.21.0 or later you do not need username or pass word. Older image tags you are required to
master.auth.passwordstring""
master.auth.usernamestring""
master.command[0]string"sh"
master.command[1]string"/config/docker-entrypoint.sh"
master.deploymentAnnotationsobject{}Annotations on the deployment for master
master.environmentobject{}environment variables for the master
master.envs_include_defaultbooltrueWhether to include default environment variables
master.extraPortsstringnil
master.extraVolumeMountslist[]
master.extraVolumeslist[]
master.imagestring""A custom docker image including tag
master.initContainerslist[]Init containers to run before the master container starts Useful for cloning repos, preparing data, or setting up dependencies
master.lifecycleobject{}Automated to execute a command before the main container process receives the SIGTERM
master.livenessProbeobject{}
master.logLevelstring"INFO"Log level. Can be INFO or DEBUG
master.nodeSelectorobject{}Overwrites nodeSelector from global
master.pdb.enabledboolfalseWhether to create a PodDisruptionBudget for the master pod
master.readinessProbe.failureThresholdint2
master.readinessProbe.httpGet.pathstring"/"
master.readinessProbe.httpGet.portint8089
master.readinessProbe.httpGet.schemestring"HTTP"
master.readinessProbe.initialDelaySecondsint5
master.readinessProbe.periodSecondsint30
master.readinessProbe.successThresholdint1
master.readinessProbe.timeoutSecondsint30
master.replicasint1Should be set to either 0 or 1.
master.resourcesobject{}resources for the locust master
master.restartPolicystring"Always"master pod's restartPolicy. Can be Always, OnFailure, or Never.
master.revisionHistoryLimitint10Number of old ReplicaSets to retain to allow rollback
master.serviceAccountAnnotationsobject{}
master.startupProbeobject{}
master.strategy.typestring"RollingUpdate"
master.terminationGracePeriodSecondsint30Give your pod more time to shut down by increasing its terminationGracePeriodSeconds
master.tolerationslist[]Overwrites tolerations from global
nameOverridestring""
nodeSelectorobject{}
podSecurityContextobject{}
securityContextobject{}
service.annotationsobject{}
service.extraLabelsobject{}
service.loadBalancerIPstring""
service.portint8089
service.targetPortint8089
service.typestring"ClusterIP"
tolerationslist[]
worker.affinityobject{}Overwrites affinity from global
worker.argslist[]Any extra command args for the workers
worker.command[0]string"sh"
worker.command[1]string"/config/docker-entrypoint.sh"
worker.deploymentAnnotationsobject{}Annotations on the deployment for workers
worker.environmentobject{}environment variables for the workers
worker.envs_include_defaultbooltrueWhether to include default environment variables
worker.extraVolumeMountslist[]
worker.extraVolumeslist[]
worker.hpa.enabledboolfalse
worker.hpa.maxReplicasint100
worker.hpa.minReplicasint1
worker.hpa.targetCPUUtilizationPercentageint40
worker.imagestring""A custom docker image including tag
worker.initContainerslist[]Init containers to run before the worker container starts Useful for cloning repos, preparing data, or setting up dependencies
worker.keda.cooldownPeriodint30
worker.keda.enabledboolfalse
worker.keda.pollingIntervalint15
worker.keda.triggersstring"# 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.logLevelstring"INFO"Log level. Can be INFO or DEBUG
worker.nodeSelectorobject{}Overwrites nodeSelector from global
worker.pdb.enabledboolfalseWhether to create a PodDisruptionBudget for the worker pods
worker.portsobject{}ports for the locust worker
worker.replicasint1
worker.resourcesobject{}resources for the locust worker
worker.restartPolicystring"Always"worker pod's restartPolicy. Can be Always, OnFailure, or Never.
worker.revisionHistoryLimitint10Number of old ReplicaSets to retain to allow rollback
worker.serviceAccountAnnotationsobject{}
worker.strategy.typestring"RollingUpdate"
worker.tolerationslist[]Overwrites tolerations from global

Maintainers

NameEmailUrl
max-rocket-internethttps://github.com/max-rocket-internet

Chart source and versions

Chart source: github.com/deliveryhero/helm-charts/locust

Older chart versions: github.com/deliveryhero/helm-charts/pkgs/container/helm-charts/locust

Deploy locust with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has locust on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartlocust is pinned at v0.35.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply