Commit aff2c5dc authored by Jerico Moeyersons's avatar Jerico Moeyersons 🏘
Browse files

Merge remote-tracking branch 'origin/2021'

parents f4273d86 bcc5ed04
File added
......@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM python:3.7-slim as base
FROM python:3.8-slim as base
FROM base as builder
......@@ -25,11 +25,15 @@ COPY requirements.txt .
RUN pip install --prefix="/install" -r requirements.txt
FROM base
WORKDIR /loadgen
COPY --from=builder /install /usr/local
COPY . .
RUN chmod +x ./loadgen.sh
RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends \
curl
ENTRYPOINT ./loadgen.sh
# Add application code.
COPY locustfile.py .
# enable gevent support in debugger
ENV GEVENT_SUPPORT=True
ENTRYPOINT locust --host="http://${FRONTEND_ADDR}" --headless -u "${USERS:-10}" 2>&1
# loadgenerator
#!/bin/bash
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
trap "exit" TERM
if [[ -z "${FRONTEND_ADDR}" ]]; then
echo >&2 "FRONTEND_ADDR not specified"
exit 1
fi
set -x
# if one request to the frontend fails, then exit
STATUSCODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" http://${FRONTEND_ADDR})
if test $STATUSCODE -ne 200; then
echo "Error: Could not reach frontend - Status code: ${STATUSCODE}"
exit 1
fi
# else, run loadgen
locust --host="http://${FRONTEND_ADDR}" --headless -u "${USERS:-10}" 2>&1
apiVersion: apps/v1
kind: Deployment
metadata:
name: loadgenerator
spec:
selector:
matchLabels:
app: loadgenerator
replicas: 1
template:
metadata:
labels:
app: loadgenerator
annotations:
sidecar.istio.io/rewriteAppHTTPProbers: "true"
spec:
terminationGracePeriodSeconds: 5
restartPolicy: Always
containers:
- name: main
image: gitlab.ilabt.imec.be:4567/lab-pds-microservices/loadgenerator
env:
- name: FRONTEND_ADDR
value: "frontend:80"
- name: USERS
value: "10"
resources:
requests:
cpu: 300m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
\ No newline at end of file
locust==1.0.2
locust==1.2.3
\ No newline at end of file
......@@ -4,29 +4,29 @@
#
# pip-compile --output-file=requirements.txt requirements.in
#
certifi==2018.11.29 # via geventhttpclient, requests
certifi==2020.12.5 # via geventhttpclient, requests
chardet==3.0.4 # via requests
click==7.0 # via flask
click==7.1.2 # via flask
configargparse==1.2.3 # via locust
flask-basicauth==0.2.0 # via locust
flask==1.1.2 # via flask-basicauth, locust
gevent==20.5.2 # via geventhttpclient, locust
geventhttpclient==1.4.2 # via locust
greenlet==0.4.15 # via gevent
idna==2.8 # via requests
gevent==20.12.1 # via geventhttpclient, locust
geventhttpclient==1.4.4 # via locust
greenlet==0.4.17 # via gevent
idna==2.10 # via requests
itsdangerous==1.1.0 # via flask
jinja2==2.11.2 # via flask
locust==1.0.2 # via -r requirements.in
markupsafe==1.1.0 # via jinja2
jinja2==2.11.3 # via flask
locust==1.3.1 # via -r requirements.in
markupsafe==1.1.1 # via jinja2
msgpack==1.0.0 # via locust
psutil==5.7.0 # via locust
pyzmq==17.0.0 # via locust
requests==2.21.0 # via locust
six==1.12.0 # via geventhttpclient
urllib3==1.24.2 # via requests
werkzeug==1.0.1 # via flask
zope.event==4.4 # via gevent
psutil==5.7.2 # via locust
pyzmq==19.0.2 # via locust
requests==2.24.0 # via locust
six==1.15.0 # via geventhttpclient
urllib3==1.25.10 # via requests
werkzeug==1.0.1 # via flask, locust
zope.event==4.5.0 # via gevent
zope.interface==5.1.0 # via gevent
# The following packages are considered to be unsafe in a requirements file:
# setuptools
# setuptools
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment