Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable/locust]: Updates the service and ingress to accept more port configurability #631

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
25 changes: 23 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,10 +104,29 @@ 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.enabled | bool | `false` | |
| master.livenessProbe.failureThreshold | int | `2` | |
| master.livenessProbe.initialDelaySeconds | int | `60` | |
| master.livenessProbe.path | string | `"/"` | |
| master.livenessProbe.periodSeconds | int | `30` | |
| master.livenessProbe.port | int | `8089` | |
| master.livenessProbe.scheme | string | `"HTTP"` | |
| master.livenessProbe.successThreshold | int | `1` | |
| master.livenessProbe.timeoutSeconds | int | `30` | |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These probe values are quite complicated now.

Do you think it would be simpler to just make master.livenessProbe an object? And put some commented examples in values.yaml for a user to see?

For example, like what is commonly done with securityContext. Then if someone wants to deviate from the defaults, like change the container port, it's on them to update the probe config. And if someone wants to disable a probe, then they need to set it to master.livenessProbe: {} in values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Yes, the thought had also crossed my mind to do it this way. I've seen it done this way in other public charts too. I'll refactor this later to fit your suggestion. Thanks for your time in reviewing this and making solid suggestions. I know doing this for all the charts you have in here probably is no trivial task.

One last question before I make this change later. Do you want me to additionally make master.readinessProbe to also be one object? I'm ok with it either way. But I'd say keep them similar.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to additionally make master.readinessProbe to also be one object?

I would say yes, for consistency 🙂

| 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.enabled | bool | `true` | |
| master.readinessProbe.failureThreshold | int | `2` | |
max-rocket-internet marked this conversation as resolved.
Show resolved Hide resolved
| master.readinessProbe.initialDelaySeconds | int | `5` | |
| master.readinessProbe.path | string | `"/"` | |
| master.readinessProbe.periodSeconds | int | `30` | |
| master.readinessProbe.port | int | `8089` | |
| master.readinessProbe.scheme | string | `"HTTP"` | |
| 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. |
Expand All @@ -121,6 +140,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
67 changes: 53 additions & 14 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,60 @@ spec:
- containerPort: 5558
name: loc-master-p2
protocol: TCP
{{- if .Values.master.extraPorts -}}
{{ toYaml .Values.master.extraPorts | nindent 10 }}
{{- end }}
{{- if .Values.master.readinessProbe.enabled }}
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 30
timeoutSeconds: 30
failureThreshold: 2
{{- if .Values.loadtest.headless }}
{{- if .Values.loadtest.headless }}
tcpSocket:
port: 5557
{{ else }}
{{- else if .Values.master.readinessProbe.execCommand }}
exec:
command:
{{- range (.Values.master.readinessProbe.execCommand) }}
- {{ . | quote }}
{{- end }}
{{- else }}
httpGet:
path: /
port: 8089
{{- if .Values.master.auth.enabled }}
path: {{ .Values.master.readinessProbe.path | quote }}
port: {{ .Values.master.readinessProbe.port }}
scheme: {{ .Values.master.readinessProbe.scheme }}
{{- if and (.Values.master.auth.enabled) (semverCompare "<=2.20.0" .Values.image.tag) }}
httpHeaders:
- name: Authorization
value: Basic {{ printf "%s:%s" .Values.master.auth.username .Values.master.auth.password | b64enc }}
{{- end }}
{{- end }}
- name: Authorization
value: Basic {{ printf "%s:%s" .Values.master.auth.username .Values.master.auth.password | b64enc }}
{{- end }}
{{- end }}
initialDelaySeconds: {{ .Values.master.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.master.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.master.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.master.readinessProbe.failureThreshold }}
successThreshold: {{ .Values.master.readinessProbe.successThreshold }}
{{- end }}
{{- if .Values.master.livenessProbe.enabled }}
livenessProbe:
{{- if .Values.loadtest.headless }}
tcpSocket:
port: 5557
{{- else if .Values.master.livenessProbe.execCommand }}
exec:
command:
{{- range (.Values.master.livenessProbe.execCommand) }}
- {{ . | quote }}
{{- end }}
{{- else }}
httpGet:
path: {{ .Values.master.livenessProbe.path | quote }}
port: {{ .Values.master.livenessProbe.port }}
scheme: {{ .Values.master.livenessProbe.scheme }}
{{- end }}
failureThreshold: {{ .Values.master.livenessProbe.failureThreshold }}
initialDelaySeconds: {{ .Values.master.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.master.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.master.livenessProbe.successThreshold }}
timeoutSeconds: {{ .Values.master.livenessProbe.timeoutSeconds }}
{{- 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 }}
42 changes: 42 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,45 @@ 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 custom readinessProbe settings
readinessProbe:
enabled: true
# execCommand: []
# - /bin/sh
# - -c
# - /mnt/locust/myreadinessscript.sh
path: "/"
port: 8089
scheme: "HTTP"
initialDelaySeconds: 5
periodSeconds: 30
timeoutSeconds: 30
failureThreshold: 2
successThreshold: 1

# Used to enable a livenessProbe for the pods
livenessProbe:
enabled: false
# execCommand: []
# - /bin/sh
# - -c
# - /mnt/locust/mylivenessscript.sh
path: "/"
port: 8089
scheme: "HTTP"
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 30
failureThreshold: 2
successThreshold: 1

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