From 44bb2754a7f974fc86f9014200b19bf103c8e3cd Mon Sep 17 00:00:00 2001 From: Byron Mansfield Date: Wed, 20 Nov 2024 19:10:35 +0000 Subject: [PATCH] [stable/locust]: Updates the service and ingress to accept more port 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> --- stable/locust/Chart.yaml | 2 +- stable/locust/README.md | 17 ++++++- .../locust/templates/master-deployment.yaml | 36 +++++++-------- stable/locust/templates/master-ingress.yaml | 4 +- stable/locust/templates/master-service.yaml | 7 ++- stable/locust/values.yaml | 46 +++++++++++++++++++ 6 files changed, 87 insertions(+), 25 deletions(-) diff --git a/stable/locust/Chart.yaml b/stable/locust/Chart.yaml index 8356b105..c6f68d98 100644 --- a/stable/locust/Chart.yaml +++ b/stable/locust/Chart.yaml @@ -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 diff --git a/stable/locust/README.md b/stable/locust/README.md index b05d9295..35968b25 100644 --- a/stable/locust/README.md +++ b/stable/locust/README.md @@ -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. @@ -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`: @@ -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 | `""` | | @@ -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 | diff --git a/stable/locust/templates/master-deployment.yaml b/stable/locust/templates/master-deployment.yaml index eafbe18b..89776903 100644 --- a/stable/locust/templates/master-deployment.yaml +++ b/stable/locust/templates/master-deployment.yaml @@ -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 @@ -132,7 +135,7 @@ spec: {{- end }} {{- end }} ports: - - containerPort: 8089 + - containerPort: {{ .Values.service.targetPort }} name: loc-master-web protocol: TCP - containerPort: 5557 @@ -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 }} diff --git a/stable/locust/templates/master-ingress.yaml b/stable/locust/templates/master-ingress.yaml index 87c2110e..b7d9399d 100644 --- a/stable/locust/templates/master-ingress.yaml +++ b/stable/locust/templates/master-ingress.yaml @@ -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 }} diff --git a/stable/locust/templates/master-service.yaml b/stable/locust/templates/master-service.yaml index 716dae3a..e2c59d27 100644 --- a/stable/locust/templates/master-service.yaml +++ b/stable/locust/templates/master-service.yaml @@ -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 }} diff --git a/stable/locust/values.yaml b/stable/locust/values.yaml index 55e03918..c6d77224 100644 --- a/stable/locust/values.yaml +++ b/stable/locust/values.yaml @@ -46,6 +46,9 @@ service: annotations: {} extraLabels: {} loadBalancerIP: "" + port: 8089 + targetPort: 8089 + # nodePort: 8089 master: # master.image -- A custom docker image including tag @@ -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