Skip to content

Commit 9583e2e

Browse files
committed
loadgenerator able to support LB URL
1 parent 9335df2 commit 9583e2e

3 files changed

Lines changed: 7 additions & 25 deletions

File tree

helm/templates/frontend.yaml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -149,28 +149,7 @@ spec:
149149
port: 80
150150
targetPort: 8080
151151

152-
{{/*{{- if .Values.frontend.tls }}*/}}
153-
{{/*apiVersion: cert-manager.io/v1*/}}
154-
{{/*kind: Issuer*/}}
155-
{{/*metadata:*/}}
156-
{{/* name: {{ .Values.frontend.name }}-external*/}}
157-
{{/* namespace: {{ .Release.Namespace }}*/}}
158-
{{/*spec:*/}}
159-
{{/* # ACME issuer configuration*/}}
160-
{{/* # `email` - the email address to be associated with the ACME account (make sure it's a valid one)*/}}
161-
{{/* # `server` - the URL used to access the ACME server’s directory endpoint*/}}
162-
{{/* # `privateKeySecretRef` - Kubernetes Secret to store the automatically generated ACME account private key*/}}
163-
{{/* acme:*/}}
164-
{{/* email: <YOUR_VALID_EMAIL_ADDRESS_HERE>*/}}
165-
{{/* server: https://acme-v02.api.letsencrypt.org/directory*/}}
166-
{{/* privateKeySecretRef:*/}}
167-
{{/* name: letsencrypt-{{ .Values.frontend.name }}-external-private-key*/}}
168-
{{/* solvers:*/}}
169-
{{/* # Use the HTTP-01 challenge provider*/}}
170-
{{/* - http01:*/}}
171-
{{/* ingress:*/}}
172-
{{/* class: cilium*/}}
173-
{{/*{{- end }}*/}}
152+
174153
{{- if .Values.devDeployment }}
175154
# Dev deployment: Expose via LoadBalancer Service
176155
---

helm/templates/loadgenerator.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ spec:
7474
RETRY_INTERVAL=10
7575
for i in $(seq 1 $MAX_RETRIES); do
7676
echo "Attempt $i: Pinging frontend: ${FRONTEND_ADDR}..."
77-
STATUSCODE=$(wget --server-response http://${FRONTEND_ADDR} 2>&1 | awk '/^ HTTP/{print $2}')
77+
STATUSCODE=$(wget --server-response ${FRONTEND_ADDR} 2>&1 | awk '/^ HTTP/{print $2}')
7878
if [ $STATUSCODE -eq 200 ]; then
7979
echo "Frontend is reachable."
8080
exit 0
@@ -95,7 +95,7 @@ spec:
9595
image: busybox:latest@sha256:37f7b378a29ceb4c551b1b5582e27747b855bbfaa73fa11914fe0df028dc581f
9696
env:
9797
- name: FRONTEND_ADDR
98-
value: "{{ .Values.frontend.name }}:80"
98+
value: "{{ default .Values.frontend.name .Values.frontend.fqdn }}"
9999
{{- end }}
100100
containers:
101101
- name: main

src/loadgenerator/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ COPY requirements.txt .
2525
RUN pip install --prefix="/install" -r requirements.txt
2626

2727
FROM base
28+
ENV USERS=10
29+
ENV RATE=1
2830

2931
RUN apk update \
3032
&& apk add --no-cache libstdc++ \
@@ -40,4 +42,5 @@ COPY locustfile.py .
4042
# enable gevent support in debugger
4143
ENV GEVENT_SUPPORT=True
4244

43-
ENTRYPOINT locust --host="http://${FRONTEND_ADDR}" --headless -u "${USERS:-10}" -r "${RATE:-1}" 2>&1
45+
ENTRYPOINT ["/bin/sh", "-c", "locust --host=\"$FRONTEND_ADDR\" --headless -u \"${USERS}\" -r \"${RATE}\""]
46+

0 commit comments

Comments
 (0)