Skip to content

Commit

Permalink
[stable/locust]: Updates the service and ingress to accept more port …
Browse files Browse the repository at this point in the history
…configurability (#631)

* Updates the service and ingress to accept more port configurability

* Updates the readiness and liveness probes to just be an object

* Adds in missing readme updates for locust

* Updates probes with fix for failing test and add startupProbe

---------

Co-authored-by: Max Williams <8859277+max-rocket-internet@users.noreply.github.com>
  • Loading branch information
byronmansfield and max-rocket-internet authored Nov 20, 2024
1 parent 9d7ba6e commit 44bb275
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 25 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.31.9"
version: "0.32.0"
appVersion: 2.32.2
home: https://github.com/locustio/locust
icon: https://locust.io/static/img/logo.png
Expand Down
17 changes: 15 additions & 2 deletions stable/locust/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# locust

![Version: 0.31.9](https://img.shields.io/badge/Version-0.31.9-informational?style=flat-square) ![AppVersion: 2.32.2](https://img.shields.io/badge/AppVersion-2.32.2-informational?style=flat-square)
![Version: 0.32.0](https://img.shields.io/badge/Version-0.32.0-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.31.9
helm install --generate-name oci://ghcr.io/deliveryhero/helm-charts/locust --version 0.32.0
```

To install the chart with the release name `my-release`:
Expand Down Expand Up @@ -104,14 +104,25 @@ helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust -f values.
| master.deploymentAnnotations | object | `{}` | Annotations on the deployment for master |
| master.environment | object | `{}` | environment variables for the master |
| master.envs_include_default | bool | `true` | Whether to include default environment variables |
| master.extraPorts | string | `nil` | |
| master.image | string | `""` | A custom docker image including tag |
| master.livenessProbe | object | `{}` | |
| master.logLevel | string | `"INFO"` | Log level. Can be INFO or DEBUG |
| master.nodeSelector | object | `{}` | Overwrites nodeSelector from global |
| master.pdb.enabled | bool | `false` | Whether to create a PodDisruptionBudget for the master pod |
| master.readinessProbe.failureThreshold | int | `2` | |
| master.readinessProbe.httpGet.path | string | `"/"` | |
| master.readinessProbe.httpGet.port | int | `8089` | |
| master.readinessProbe.httpGet.scheme | string | `"HTTP"` | |
| master.readinessProbe.initialDelaySeconds | int | `5` | |
| master.readinessProbe.periodSeconds | int | `30` | |
| master.readinessProbe.successThreshold | int | `1` | |
| master.readinessProbe.timeoutSeconds | int | `30` | |
| master.replicas | int | `1` | Should be set to either 0 or 1. |
| master.resources | object | `{}` | resources for the locust master |
| master.restartPolicy | string | `"Always"` | master pod's restartPolicy. Can be Always, OnFailure, or Never. |
| master.serviceAccountAnnotations | object | `{}` | |
| master.startupProbe | object | `{}` | |
| master.strategy.type | string | `"RollingUpdate"` | |
| master.tolerations | list | `[]` | Overwrites tolerations from global |
| nameOverride | string | `""` | |
Expand All @@ -121,6 +132,8 @@ helm install my-release oci://ghcr.io/deliveryhero/helm-charts/locust -f values.
| service.annotations | object | `{}` | |
| service.extraLabels | object | `{}` | |
| service.loadBalancerIP | string | `""` | |
| service.port | int | `8089` | |
| service.targetPort | int | `8089` | |
| service.type | string | `"ClusterIP"` | |
| tolerations | list | `[]` | |
| worker.affinity | object | `{}` | Overwrites affinity from global |
Expand Down
36 changes: 18 additions & 18 deletions stable/locust/templates/master-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ spec:
{{- if .Values.loadtest.headless }}
- --headless
{{- end }}
{{- if ne (.Values.service.targetPort | toString) "8089" }}
- --web-port {{ .Values.service.targetPort }}
{{- end }}
{{- if .Values.master.auth.enabled }}
{{- if or (semverCompare ">=2.21.0" .Values.image.tag) (semverCompare ">=2.21.0" .Values.master.image.tag) (semverCompare ">=2.21.0" .Values.worker.image.tag)}}
- --web-login
Expand Down Expand Up @@ -132,7 +135,7 @@ spec:
{{- end }}
{{- end }}
ports:
- containerPort: 8089
- containerPort: {{ .Values.service.targetPort }}
name: loc-master-web
protocol: TCP
- containerPort: 5557
Expand All @@ -141,24 +144,21 @@ spec:
- containerPort: 5558
name: loc-master-p2
protocol: TCP
{{- if .Values.master.extraPorts -}}
{{ toYaml .Values.master.extraPorts | nindent 10 }}
{{- end }}
{{- if .Values.master.readinessProbe }}
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 30
timeoutSeconds: 30
failureThreshold: 2
{{- if .Values.loadtest.headless }}
tcpSocket:
port: 5557
{{ else }}
httpGet:
path: /
port: 8089
{{- if .Values.master.auth.enabled }}
httpHeaders:
- name: Authorization
value: Basic {{ printf "%s:%s" .Values.master.auth.username .Values.master.auth.password | b64enc }}
{{- end }}
{{- end }}
{{- toYaml .Values.master.readinessProbe | nindent 12 }}
{{- end }}
{{- if .Values.master.livenessProbe }}
livenessProbe:
{{- toYaml .Values.master.livenessProbe | nindent 12 }}
{{- end }}
{{- if .Values.master.startupProbe }}
startupProbe:
{{- toYaml .Values.master.startupProbe | nindent 12 }}
{{- end }}
restartPolicy: {{ .Values.master.restartPolicy }}
volumes:
{{- if .Values.loadtest.locust_lib_configmap }}
Expand Down
4 changes: 2 additions & 2 deletions stable/locust/templates/master-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ spec:
service:
name: {{ $fullName }}
port:
number: 8089
number: {{ $.Values.service.port }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: 8089
servicePort: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}
7 changes: 5 additions & 2 deletions stable/locust/templates/master-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ spec:
protocol: TCP
targetPort: 5558
- name: master-p3
port: 8089
port: {{ .Values.service.port }}
protocol: TCP
targetPort: 8089
targetPort: {{ .Values.service.targetPort }}
{{- if and (.Values.service.nodePort) (eq (.Values.service.type | toString) "NodePort") }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
selector:
component: master
{{- include "locust.selectorLabels" . | nindent 4 }}
46 changes: 46 additions & 0 deletions stable/locust/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ service:
annotations: {}
extraLabels: {}
loadBalancerIP: ""
port: 8089
targetPort: 8089
# nodePort: 8089

master:
# master.image -- A custom docker image including tag
Expand Down Expand Up @@ -85,6 +88,49 @@ master:
enabled: false
username: ""
password: ""

# extraPorts is a list of extra ports. Specified as a YAML list.
# This is useful if you need to add additional ports for monitoring.
extraPorts: null
# - containerPort: 8080
# name: http-monitoring

# Used to define readinessProbe for the pod
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 30
timeoutSeconds: 30
failureThreshold: 2
successThreshold: 1
httpGet:
path: /
port: 8089
scheme: HTTP

# Used to define livenessProbe for the pod
livenessProbe: {}
# initialDelaySeconds: 60
# periodSeconds: 30
# timeoutSeconds: 30
# failureThreshold: 2
# successThreshold: 1
# httpGet:
# path: /
# port: 8089
# scheme: HTTP

# Used to define startupProbe for the pod
startupProbe: {}
# initialDelaySeconds: 60
# periodSeconds: 30
# timeoutSeconds: 30
# failureThreshold: 2
# successThreshold: 1
# httpGet:
# path: /
# port: 8089
# scheme: HTTP

# master.restartPolicy -- master pod's restartPolicy. Can be Always, OnFailure, or Never.
restartPolicy: Always
# master.nodeSelector -- Overwrites nodeSelector from global
Expand Down

0 comments on commit 44bb275

Please sign in to comment.