From 20af17fc7ed20ec6f26b02ed7839805bc293bdf0 Mon Sep 17 00:00:00 2001 From: sugiish Date: Sun, 5 Apr 2020 17:51:02 +0900 Subject: [PATCH 1/7] Add .gcloudignore --- sample-webapp/.gcloudignore | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sample-webapp/.gcloudignore diff --git a/sample-webapp/.gcloudignore b/sample-webapp/.gcloudignore new file mode 100644 index 0000000..a987f11 --- /dev/null +++ b/sample-webapp/.gcloudignore @@ -0,0 +1,19 @@ +# This file specifies files that are *not* uploaded to Google Cloud Platform +# using gcloud. It follows the same syntax as .gitignore, with the addition of +# "#!include" directives (which insert the entries of the given .gitignore-style +# file at that point). +# +# For more information, run: +# $ gcloud topic gcloudignore +# +.gcloudignore +# If you would like to upload your .git directory, .gitignore file or files +# from your .gitignore file, remove the corresponding line +# below: +.git +.gitignore + +# Python pycache: +__pycache__/ +# Ignored by the build system +/setup.cfg \ No newline at end of file From 3d9ac22ffa293d6ae06f6e82f652d50e4a909c95 Mon Sep 17 00:00:00 2001 From: sugiish Date: Sun, 5 Apr 2020 19:21:10 +0900 Subject: [PATCH 2/7] Update locustio v0.14.5 with requirements --- docker-image/locust-tasks/requirements.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docker-image/locust-tasks/requirements.txt b/docker-image/locust-tasks/requirements.txt index 14c17cf..1f758c1 100644 --- a/docker-image/locust-tasks/requirements.txt +++ b/docker-image/locust-tasks/requirements.txt @@ -2,17 +2,16 @@ certifi==2019.3.9 chardet==3.0.4 Click==7.0 Flask==1.0.2 -gevent==1.4.0 +gevent==1.5a3 greenlet==0.4.15 idna==2.8 itsdangerous==1.1.0 Jinja2==2.10.1 -locustio==0.11.0 +locustio==0.14.5 MarkupSafe==1.1.1 -msgpack==0.6.1 -msgpack-python==0.5.6 +msgpack==1.0.0 pyzmq==18.0.1 requests==2.21.0 six==1.12.0 urllib3==1.24.2 -Werkzeug==0.15.1 +Werkzeug==0.15.5 From 6a337e57458aca546a2b0ffb8fafed898f6e9ec8 Mon Sep 17 00:00:00 2001 From: sugiish Date: Sun, 5 Apr 2020 19:21:25 +0900 Subject: [PATCH 3/7] Add wait_time --- docker-image/locust-tasks/tasks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-image/locust-tasks/tasks.py b/docker-image/locust-tasks/tasks.py index 6e6fc55..05df230 100644 --- a/docker-image/locust-tasks/tasks.py +++ b/docker-image/locust-tasks/tasks.py @@ -18,7 +18,7 @@ import uuid from datetime import datetime -from locust import HttpLocust, TaskSet, task +from locust import HttpLocust, TaskSet, task, between class MetricsTaskSet(TaskSet): @@ -39,4 +39,5 @@ def post_metrics(self): class MetricsLocust(HttpLocust): - task_set = MetricsTaskSet \ No newline at end of file + task_set = MetricsTaskSet + wait_time = between(5, 10) From 18053975a6971ac4caca98dbb8e1cbbe6b82797a Mon Sep 17 00:00:00 2001 From: sugiish Date: Sun, 5 Apr 2020 19:37:44 +0900 Subject: [PATCH 4/7] Rename LOCUST_MASTER -> LOCUST_MASTER_HOST --- docker-image/locust-tasks/run.sh | 4 ++-- kubernetes-config/locust-worker-controller.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-image/locust-tasks/run.sh b/docker-image/locust-tasks/run.sh index ba5f684..4693cc0 100644 --- a/docker-image/locust-tasks/run.sh +++ b/docker-image/locust-tasks/run.sh @@ -22,9 +22,9 @@ LOCUST_MODE=${LOCUST_MODE:-standalone} if [[ "$LOCUST_MODE" = "master" ]]; then LOCUS_OPTS="$LOCUS_OPTS --master" elif [[ "$LOCUST_MODE" = "worker" ]]; then - LOCUS_OPTS="$LOCUS_OPTS --slave --master-host=$LOCUST_MASTER" + LOCUS_OPTS="$LOCUS_OPTS --slave --master-host=$LOCUST_MASTER_HOST" fi echo "$LOCUST $LOCUS_OPTS" -$LOCUST $LOCUS_OPTS \ No newline at end of file +$LOCUST $LOCUS_OPTS diff --git a/kubernetes-config/locust-worker-controller.yaml b/kubernetes-config/locust-worker-controller.yaml index 7c1a682..753065d 100644 --- a/kubernetes-config/locust-worker-controller.yaml +++ b/kubernetes-config/locust-worker-controller.yaml @@ -34,7 +34,7 @@ spec: env: - name: LOCUST_MODE value: worker - - name: LOCUST_MASTER + - name: LOCUST_MASTER_HOST value: locust-master - name: TARGET_HOST value: https://[TARGET_HOST] From 235d7b38556202f95f841ea044aa71e137f83186 Mon Sep 17 00:00:00 2001 From: sugiish Date: Sun, 5 Apr 2020 19:39:02 +0900 Subject: [PATCH 5/7] Use Python 3.8.2 image --- docker-image/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-image/Dockerfile b/docker-image/Dockerfile index 230756a..568a222 100644 --- a/docker-image/Dockerfile +++ b/docker-image/Dockerfile @@ -13,8 +13,8 @@ # limitations under the License. -# Start with a base Python 3.7.2 image -FROM python:3.7.2 +# Start with a base Python 3.8.2 image +FROM python:3.8.2 # Add the licenses for third party software and libraries ADD licenses /licenses From 9723d70512e46875b26a8f6266ad2b04d3c85d57 Mon Sep 17 00:00:00 2001 From: sugiish Date: Sun, 5 Apr 2020 19:46:32 +0900 Subject: [PATCH 6/7] Remove unneeded port 5558 --- docker-image/Dockerfile | 4 ++-- kubernetes-config/locust-master-controller.yaml | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docker-image/Dockerfile b/docker-image/Dockerfile index 568a222..5b66ddc 100644 --- a/docker-image/Dockerfile +++ b/docker-image/Dockerfile @@ -26,10 +26,10 @@ ADD locust-tasks /locust-tasks RUN pip install -r /locust-tasks/requirements.txt # Expose the required Locust ports -EXPOSE 5557 5558 8089 +EXPOSE 5557 8089 # Set script to be executable RUN chmod 755 /locust-tasks/run.sh # Start Locust using LOCUS_OPTS environment variable -ENTRYPOINT ["/locust-tasks/run.sh"] +ENTRYPOINT ["/locust-tasks/run.sh"] diff --git a/kubernetes-config/locust-master-controller.yaml b/kubernetes-config/locust-master-controller.yaml index 63466f1..a369a33 100644 --- a/kubernetes-config/locust-master-controller.yaml +++ b/kubernetes-config/locust-master-controller.yaml @@ -44,6 +44,3 @@ spec: - name: loc-master-p1 containerPort: 5557 protocol: TCP - - name: loc-master-p2 - containerPort: 5558 - protocol: TCP From 1af3119b04005c3f1a40e88ae71deaef3c4b3d16 Mon Sep 17 00:00:00 2001 From: sugiish Date: Sun, 5 Apr 2020 20:04:29 +0900 Subject: [PATCH 7/7] Set the enableServiceLinks flag to false --- kubernetes-config/locust-master-controller.yaml | 1 + kubernetes-config/locust-worker-controller.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/kubernetes-config/locust-master-controller.yaml b/kubernetes-config/locust-master-controller.yaml index a369a33..dc9cdf1 100644 --- a/kubernetes-config/locust-master-controller.yaml +++ b/kubernetes-config/locust-master-controller.yaml @@ -44,3 +44,4 @@ spec: - name: loc-master-p1 containerPort: 5557 protocol: TCP + enableServiceLinks: false diff --git a/kubernetes-config/locust-worker-controller.yaml b/kubernetes-config/locust-worker-controller.yaml index 753065d..30b4d72 100644 --- a/kubernetes-config/locust-worker-controller.yaml +++ b/kubernetes-config/locust-worker-controller.yaml @@ -38,3 +38,4 @@ spec: value: locust-master - name: TARGET_HOST value: https://[TARGET_HOST] + enableServiceLinks: false