Bring up load generator (locust) UI (#2)

This commit also changes the way how image is constructed: slash after ${REPO_PREFIX} is dropped because quya.io doesn't support grouped repositories.
This commit is contained in:
Dmitrii Anoshin 2020-04-29 20:18:45 -07:00 committed by GitHub
parent d492f30997
commit 32c4429dc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 49 additions and 48 deletions

View file

@ -27,7 +27,7 @@ REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified}"
while IFS= read -d $'\0' -r dir; do
# build image
svcname="$(basename "${dir}")"
image="${REPO_PREFIX}/$svcname:$TAG"
image="${REPO_PREFIX}$svcname:$TAG"
(
cd "${dir}"
log "Building: ${image}"

View file

@ -25,7 +25,7 @@ log() { echo "$1" >&2; }
TAG="${TAG:?TAG env variable must be specified}"
REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified}"
FRONTEND_URL="${FRONTEND_URL:?FRONTEND_URL env variable must be specified}"
DOMAIN="${DOMAIN:?DOMAIN env variable must be specified}"
OUT_DIR="${OUT_DIR:-${SCRIPTDIR}/../release}"
print_license_header() {
@ -71,7 +71,7 @@ mk_kubernetes_manifests() {
for dir in ./src/*/
do
svcname="$(basename "${dir}")"
image="$REPO_PREFIX/$svcname:$TAG"
image="$REPO_PREFIX$svcname:$TAG"
pattern="^(\s*)image:\s.*$svcname(.*)(\s*)"
replace="\1image: $image\3"

View file

@ -112,7 +112,7 @@ metadata:
service.beta.kubernetes.io/aws-load-balancer-healthcheck-interval: "5"
service.beta.kubernetes.io/aws-load-balancer-healthcheck-timeout: "3"
service.beta.kubernetes.io/aws-load-balancer-healthcheck-unhealthy-threshold: "2"
external-dns.alpha.kubernetes.io/hostname: ${FRONTEND_URL}
external-dns.alpha.kubernetes.io/hostname: demo.${DOMAIN}
spec:
type: LoadBalancer
selector:

View file

@ -38,6 +38,8 @@ spec:
restartPolicy: Always
containers:
- name: main
ports:
- containerPort: 8089
image: loadgenerator
env:
- name: FRONTEND_ADDR
@ -51,3 +53,37 @@ spec:
limits:
cpu: 500m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: loadgenerator
namespace: demo-env
spec:
type: ClusterIP
selector:
app: loadgenerator
ports:
- name: http
port: 80
targetPort: 8089
---
apiVersion: v1
kind: Service
metadata:
name: loadgenerator-external
namespace: demo-env
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
service.beta.kubernetes.io/aws-load-balancer-healthcheck-interval: "5"
service.beta.kubernetes.io/aws-load-balancer-healthcheck-timeout: "3"
service.beta.kubernetes.io/aws-load-balancer-healthcheck-unhealthy-threshold: "2"
external-dns.alpha.kubernetes.io/hostname: demo-load.${DOMAIN}
spec:
type: LoadBalancer
selector:
app: loadgenerator
ports:
- name: http
port: 80
targetPort: 8089

View file

@ -1,21 +1,11 @@
FROM python:3-slim as base
FROM base as builder
RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends \
g++
COPY requirements.txt .
RUN pip install --install-option="--prefix=/install" -r requirements.txt
FROM base
COPY --from=builder /install /usr/local
FROM locustio/locust:0.14.6
WORKDIR /app
COPY . .
USER root
RUN chmod +x ./loadgen.sh
RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends \
curl
RUN apk add bash curl
USER locust
ENTRYPOINT ./loadgen.sh

View file

@ -32,4 +32,4 @@ if test $STATUSCODE -ne 200; then
fi
# else, run loadgen
locust --host="http://${FRONTEND_ADDR}" --no-web -c "${USERS:-10}" 2>&1
locust --host="http://${FRONTEND_ADDR}" -c "${USERS:-10}"

View file

@ -1 +0,0 @@
locustio==0.13.0

View file

@ -1,24 +0,0 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements.txt requirements.in
#
certifi==2018.11.29 # via geventhttpclient-wheels, requests
chardet==3.0.4 # via requests
click==7.0 # via flask
flask==1.0.2 # via locustio
gevent==1.4.0 # via geventhttpclient-wheels, locustio
geventhttpclient-wheels==1.3.1.dev2 # via locustio
greenlet==0.4.15 # via gevent
idna==2.8 # via requests
itsdangerous==1.1.0 # via flask
jinja2==2.10 # via flask
locustio==0.13.0 # via -r requirements.in
markupsafe==1.1.0 # via jinja2
msgpack-python==0.5.6 # via locustio
pyzmq==17.0.0 # via locustio
requests==2.21.0 # via locustio
six==1.12.0 # via geventhttpclient-wheels, locustio
urllib3==1.24.2 # via requests
werkzeug==0.14.1 # via flask