From 60d51fa3de39ff0575e3dbfd3f8a8e203bcb76c5 Mon Sep 17 00:00:00 2001 From: garland Date: Thu, 20 Sep 2018 19:33:52 -0700 Subject: [PATCH 01/13] updating to work with the soon to be official locus docker container Signed-off-by: garland --- stable/locust/README.md | 4 +-- stable/locust/tasks/tasks.py | 42 +++++++++++++++++----- stable/locust/templates/master-deploy.yaml | 2 +- stable/locust/templates/worker-deploy.yaml | 12 ++++--- stable/locust/values.yaml | 6 ++-- 5 files changed, 47 insertions(+), 19 deletions(-) diff --git a/stable/locust/README.md b/stable/locust/README.md index 45d3eb95a715..fe8b3e622edd 100644 --- a/stable/locust/README.md +++ b/stable/locust/README.md @@ -21,7 +21,7 @@ This chart will do the following: To install the chart with the release name `locust-nymph` in the default namespace: ```bash -helm install -n locust-nymph --set master.config.target-host=http://site.example.com stable/locust +helm install -n locust-nymph --set master.config.target-url=http://site.example.com stable/locust ``` | Parameter | Description | Default | @@ -34,7 +34,7 @@ helm install -n locust-nymph --set master.config.target-host=http://site.example | `service.nodePort` | Port on cluster to expose master | `0` | | `service.annotations` | KV containing custom annotations | `{}` | | `service.extraLabels` | KV containing extra labels | `{}` | -| `master.config.target-host` | locust target host | `http://site.example.com` | +| `master.config.target-url` | locust target host | `http://site.example.com` | | `worker.config.locust-script`| locust script to run | `/locust-tasks/tasks.py` | | `worker.replicaCount` | Number of workers to run | `2` | diff --git a/stable/locust/tasks/tasks.py b/stable/locust/tasks/tasks.py index ea9ef9878ef9..a049e948c948 100644 --- a/stable/locust/tasks/tasks.py +++ b/stable/locust/tasks/tasks.py @@ -1,11 +1,37 @@ +# from locust import HttpLocust, TaskSet, task +# +# class ElbTasks(TaskSet): +# @task +# def status(self): +# self.client.get('/api?action=setUserAttributes&apiVersion=1.0.6.&appId=app_WHWSfAt5LCeLRxWuRaBEiawqkr2vhSG62ZbfyyqAPcE&clientKey=dev_XeURceHkZ4jEfzOBAQD7Fv9j148eByWfxxvzr7eqlrE&userId=99e4f0ee79b3680e&userAttributes={"email":"praveen+20180806@leanplum.com", "horoscope_sign":"leo", "plum_pod":"dataPlatform", "favorite_color":"turquoise"}') +# +# class ElbWarmer(HttpLocust): +# task_set = ElbTasks +# min_wait = 1000 +# max_wait = 3000 + from locust import HttpLocust, TaskSet, task -class ElbTasks(TaskSet): - @task - def status(self): - self.client.get("/status") +class WebsiteTasks(TaskSet): + # def on_start(self): + # self.client.post("/login", { + # "username": "test_user", + # "password": "" + # }) + + @task + def index(self): + self.client.get("/") + + @task + def tour(self): + self.client.get("/tour") + + @task + def api(self): + self.client.get('/api?action=setUserAttributes&apiVersion=1.0.6.&appId=app_WHWSfAt5LCeLRxWuRaBEiawqkr2vhSG62ZbfyyqAPcE&clientKey=dev_XeURceHkZ4jEfzOBAQD7Fv9j148eByWfxxvzr7eqlrE&userId=99e4f0ee79b3680e&userAttributes={"email":"praveen+20180806@leanplum.com", "horoscope_sign":"leo", "plum_pod":"dataPlatform", "favorite_color":"turquoise"}') -class ElbWarmer(HttpLocust): - task_set = ElbTasks - min_wait = 1000 - max_wait = 3000 \ No newline at end of file +class WebsiteUser(HttpLocust): + task_set = WebsiteTasks + min_wait = 5000 + max_wait = 15000 diff --git a/stable/locust/templates/master-deploy.yaml b/stable/locust/templates/master-deploy.yaml index 68fff7e4f7cb..d2b117b04605 100644 --- a/stable/locust/templates/master-deploy.yaml +++ b/stable/locust/templates/master-deploy.yaml @@ -39,7 +39,7 @@ spec: {{- end }} - name: LOCUST_MODE value: "master" - - name: LOCUST_SCRIPT + - name: LOCUSTFILE_PATH value: {{ index .Values.worker.config "locust-script" | quote }} ports: - containerPort: {{ .Values.service.internalPort }} diff --git a/stable/locust/templates/worker-deploy.yaml b/stable/locust/templates/worker-deploy.yaml index e77279ce1eef..4fb89be4ba4c 100644 --- a/stable/locust/templates/worker-deploy.yaml +++ b/stable/locust/templates/worker-deploy.yaml @@ -38,13 +38,15 @@ spec: value: {{ $value | quote }} {{- end }} - name: LOCUST_MODE - value: "worker" - - name: LOCUST_MASTER + value: "slave" + - name: LOCUST_MASTER_HOST value: {{ template "locust.master-svc" . }} - name: LOCUST_MASTER_WEB - value: "{{ .Values.service.internalPort }}" - - name: TARGET_HOST - value: {{ index .Values.master.config "target-host" | quote }} + value: {{ .Values.service.internalPort }}" + - name: TARGET_URL + value: {{ index .Values.master.config "target-url" | quote }} + - name: LOCUSTFILE_PATH + value: {{ index .Values.worker.config "locust-script" | quote }} resources: {{ toYaml .Values.worker.resources | indent 10 }} restartPolicy: Always diff --git a/stable/locust/values.yaml b/stable/locust/values.yaml index 12a5d2d557fb..dff82fd4e8ab 100644 --- a/stable/locust/values.yaml +++ b/stable/locust/values.yaml @@ -1,8 +1,8 @@ Name: locust image: - repository: quay.io/honestbee/locust - tag: 0.7.5 + repository: garland/locust + tag: 0.9.0 pullPolicy: IfNotPresent pullSecrets: [] @@ -16,7 +16,7 @@ service: extraLabels: {} master: config: - target-host: https://site.example.com + target-url: https://site.example.com resources: limits: cpu: 100m From a94603162e4610b23e3e25d0b060792970bd7380 Mon Sep 17 00:00:00 2001 From: garland Date: Thu, 20 Sep 2018 19:35:46 -0700 Subject: [PATCH 02/13] updating to work with the soon to be official locus docker container Signed-off-by: garland --- stable/locust/tasks/tasks.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stable/locust/tasks/tasks.py b/stable/locust/tasks/tasks.py index a049e948c948..036eae026fbf 100644 --- a/stable/locust/tasks/tasks.py +++ b/stable/locust/tasks/tasks.py @@ -27,10 +27,6 @@ def index(self): def tour(self): self.client.get("/tour") - @task - def api(self): - self.client.get('/api?action=setUserAttributes&apiVersion=1.0.6.&appId=app_WHWSfAt5LCeLRxWuRaBEiawqkr2vhSG62ZbfyyqAPcE&clientKey=dev_XeURceHkZ4jEfzOBAQD7Fv9j148eByWfxxvzr7eqlrE&userId=99e4f0ee79b3680e&userAttributes={"email":"praveen+20180806@leanplum.com", "horoscope_sign":"leo", "plum_pod":"dataPlatform", "favorite_color":"turquoise"}') - class WebsiteUser(HttpLocust): task_set = WebsiteTasks min_wait = 5000 From fdb5c2221a3cec640862d76b75885302495c6bfd Mon Sep 17 00:00:00 2001 From: garland Date: Fri, 21 Sep 2018 12:35:24 -0700 Subject: [PATCH 03/13] adding flag to enable the creation of the test script or not Signed-off-by: garland --- stable/locust/tasks/tasks.py | 38 ++++++-------------------- stable/locust/templates/worker-cm.yaml | 3 ++ stable/locust/values.yaml | 3 ++ 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/stable/locust/tasks/tasks.py b/stable/locust/tasks/tasks.py index 036eae026fbf..1e44d459b773 100644 --- a/stable/locust/tasks/tasks.py +++ b/stable/locust/tasks/tasks.py @@ -1,33 +1,11 @@ -# from locust import HttpLocust, TaskSet, task -# -# class ElbTasks(TaskSet): -# @task -# def status(self): -# self.client.get('/api?action=setUserAttributes&apiVersion=1.0.6.&appId=app_WHWSfAt5LCeLRxWuRaBEiawqkr2vhSG62ZbfyyqAPcE&clientKey=dev_XeURceHkZ4jEfzOBAQD7Fv9j148eByWfxxvzr7eqlrE&userId=99e4f0ee79b3680e&userAttributes={"email":"praveen+20180806@leanplum.com", "horoscope_sign":"leo", "plum_pod":"dataPlatform", "favorite_color":"turquoise"}') -# -# class ElbWarmer(HttpLocust): -# task_set = ElbTasks -# min_wait = 1000 -# max_wait = 3000 - from locust import HttpLocust, TaskSet, task -class WebsiteTasks(TaskSet): - # def on_start(self): - # self.client.post("/login", { - # "username": "test_user", - # "password": "" - # }) - - @task - def index(self): - self.client.get("/") - - @task - def tour(self): - self.client.get("/tour") +class ElbTasks(TaskSet): + @task + def status(self): + self.client.get("/status") -class WebsiteUser(HttpLocust): - task_set = WebsiteTasks - min_wait = 5000 - max_wait = 15000 +class ElbWarmer(HttpLocust): + task_set = ElbTasks + min_wait = 1000 + max_wait = 3000 diff --git a/stable/locust/templates/worker-cm.yaml b/stable/locust/templates/worker-cm.yaml index e4d20117aa17..a0f9034ea68b 100644 --- a/stable/locust/templates/worker-cm.yaml +++ b/stable/locust/templates/worker-cm.yaml @@ -1,3 +1,5 @@ +{{ if .Values.createTestScripts }} +--- apiVersion: v1 kind: ConfigMap metadata: @@ -9,3 +11,4 @@ metadata: app: {{ template "locust.fullname" . }} data: {{ (.Files.Glob "tasks/*").AsConfig | indent 2 }} +{{ end }} diff --git a/stable/locust/values.yaml b/stable/locust/values.yaml index dff82fd4e8ab..c5d3dede6211 100644 --- a/stable/locust/values.yaml +++ b/stable/locust/values.yaml @@ -37,3 +37,6 @@ worker: requests: cpu: 100m memory: 128Mi + +# Flag to create the test script from this chart or not. +createTestScripts: true From 85366658d3a79ed13608dae47ffaad8ffc0d1fea Mon Sep 17 00:00:00 2001 From: garland Date: Fri, 21 Sep 2018 13:23:55 -0700 Subject: [PATCH 04/13] updating chart versions Signed-off-by: garland --- stable/locust/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stable/locust/Chart.yaml b/stable/locust/Chart.yaml index 1dbcfa662aab..990d0fdb0634 100644 --- a/stable/locust/Chart.yaml +++ b/stable/locust/Chart.yaml @@ -1,7 +1,7 @@ name: locust description: A modern load testing framework -version: 0.3.0 -appVersion: 0.7.5 +version: 0.4.0 +appVersion: 0.9.0 maintainers: - name: so0k email: vincent.drl@gmail.com From d2d215892ab33672e98775a961ecb3a237a33e4b Mon Sep 17 00:00:00 2001 From: garland Date: Fri, 21 Sep 2018 14:05:13 -0700 Subject: [PATCH 05/13] adding ingress options Signed-off-by: garland --- stable/locust/templates/_helpers.tpl | 4 ++++ stable/locust/templates/ingres.yaml | 33 ++++++++++++++++++++++++++++ stable/locust/values.yaml | 9 ++++++++ 3 files changed, 46 insertions(+) create mode 100644 stable/locust/templates/ingres.yaml diff --git a/stable/locust/templates/_helpers.tpl b/stable/locust/templates/_helpers.tpl index 97d5e0a7e8c1..7805a0469743 100644 --- a/stable/locust/templates/_helpers.tpl +++ b/stable/locust/templates/_helpers.tpl @@ -19,6 +19,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- printf "%s-%s" .Release.Name "worker" | trunc 63 -}} {{- end -}} +{{- define "locust.ingress" -}} +{{- printf "%s-%s" .Release.Name "ingress" | trunc 63 -}} +{{- end -}} + {{/* Create fully qualified configmap name. */}} diff --git a/stable/locust/templates/ingres.yaml b/stable/locust/templates/ingres.yaml new file mode 100644 index 000000000000..b79d9dde2f64 --- /dev/null +++ b/stable/locust/templates/ingres.yaml @@ -0,0 +1,33 @@ +{{ if .Values.ingress.enable }} +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "locust.ingress" . }} + namespace: {{ .Values.namespace }} + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app: {{ template "locust.fullname" . }} + component: "ingress" + annotations: + kubernetes.io/ingress.class: "{{ .Values.ingress.ingressClass }}" + # Setup Let's Encrypt Certificates + kubernetes.io/tls-acme: "{{ .Values.ingress.enableTlsAcme }}" + {{ if .Values.ingress.annotations.enable }} + nginx.ingress.kubernetes.io/whitelist-source-range: "{{ .Values.ingress.annotations.whitelistSourceRange }}" + {{ end }} +spec: + tls: + - hosts: + - "{{ .Values.ingress.hostname }}" + secretName: {{ .Values.namePrefix }}-locust-tls + rules: + - host: "{{ .Values.ingress.hostname }}" + http: + paths: + - path: / + backend: + serviceName: {{ template "locust.master-svc" . }} + servicePort: {{ .Values.service.internalPort }} +{{ end }} diff --git a/stable/locust/values.yaml b/stable/locust/values.yaml index c5d3dede6211..bd20cc7e8e23 100644 --- a/stable/locust/values.yaml +++ b/stable/locust/values.yaml @@ -40,3 +40,12 @@ worker: # Flag to create the test script from this chart or not. createTestScripts: true + +ingress: + enable: false + ingressClass: nginx + enableTlsAcme: false + hostname: locust.example.com + annotations: + enable: false + whitelistSourceRange: "1.1.1.1/32,2.2.2.2/32" From 4fab0fca08c6a577b0b88d5163e5a71c88869ecb Mon Sep 17 00:00:00 2001 From: garland Date: Mon, 24 Sep 2018 12:57:25 -0700 Subject: [PATCH 06/13] adding node selector and tolerances Signed-off-by: garland --- stable/locust/templates/master-deploy.yaml | 14 +++++++++++++- stable/locust/templates/worker-deploy.yaml | 14 +++++++++++++- stable/locust/values.yaml | 22 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/stable/locust/templates/master-deploy.yaml b/stable/locust/templates/master-deploy.yaml index d2b117b04605..cdf89ba1dfe3 100644 --- a/stable/locust/templates/master-deploy.yaml +++ b/stable/locust/templates/master-deploy.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "locust.master" . }} @@ -10,6 +10,10 @@ metadata: component: master spec: replicas: 1 + selector: + matchLabels: + component: master + app: {{ template "locust.fullname" . }} strategy: type: RollingUpdate rollingUpdate: @@ -64,6 +68,14 @@ spec: httpGet: path: / port: {{ .Values.service.internalPort }} + {{ if .Values.master.nodeSelectors.enable }} + nodeSelector: +{{ toYaml .Values.master.nodeSelectors.items | indent 8 }} + {{- end }} + {{ if .Values.master.tolerations.enable }} + tolerations: +{{ toYaml .Values.master.tolerations.items | indent 6 }} + {{- end }} volumes: - name: "locust-tasks" configMap: diff --git a/stable/locust/templates/worker-deploy.yaml b/stable/locust/templates/worker-deploy.yaml index 4fb89be4ba4c..40e246e32ba9 100644 --- a/stable/locust/templates/worker-deploy.yaml +++ b/stable/locust/templates/worker-deploy.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "locust.worker" . }} @@ -10,6 +10,10 @@ metadata: component: worker spec: replicas: {{ default 2 .Values.worker.replicaCount }} + selector: + matchLabels: + component: worker + app: {{ template "locust.fullname" . }} strategy: type: RollingUpdate rollingUpdate: @@ -49,6 +53,14 @@ spec: value: {{ index .Values.worker.config "locust-script" | quote }} resources: {{ toYaml .Values.worker.resources | indent 10 }} + {{ if .Values.worker.nodeSelectors.enable }} + nodeSelector: +{{ toYaml .Values.worker.nodeSelectors.items | indent 8 }} + {{- end }} + {{ if .Values.worker.tolerations.enable }} + tolerations: +{{ toYaml .Values.worker.tolerations.items | indent 6 }} + {{- end }} restartPolicy: Always volumes: - name: "locust-tasks" diff --git a/stable/locust/values.yaml b/stable/locust/values.yaml index bd20cc7e8e23..1fa4412bdaff 100644 --- a/stable/locust/values.yaml +++ b/stable/locust/values.yaml @@ -24,6 +24,17 @@ master: requests: cpu: 100m memory: 128Mi + nodeSelectors: + enable: false + items: + k8s.info/application: locust + tolerations: + enable: false + items: + - key: "application" + operator: "Equal" + value: "locust" + effect: "NoSchedule" worker: config: @@ -37,6 +48,17 @@ worker: requests: cpu: 100m memory: 128Mi + nodeSelectors: + enable: false + items: + k8s.info/application: locust + tolerations: + enable: false + items: + - key: "application" + operator: "Equal" + value: "locust" + effect: "NoSchedule" # Flag to create the test script from this chart or not. createTestScripts: true From 3e545f6de5ec60ea94221a319528d7f7f85b6ce8 Mon Sep 17 00:00:00 2001 From: garland Date: Mon, 24 Sep 2018 13:28:24 -0700 Subject: [PATCH 07/13] updating README with new params Signed-off-by: garland --- stable/locust/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stable/locust/README.md b/stable/locust/README.md index fe8b3e622edd..65bcda86123a 100644 --- a/stable/locust/README.md +++ b/stable/locust/README.md @@ -5,7 +5,7 @@ testing using Kubernetes. ## Pre Requisites: -* Requires (and tested with) helm `v2.1.2` or above. +* Requires (and tested with) helm `v2.10.0` or above. ## Chart details @@ -27,14 +27,18 @@ helm install -n locust-nymph --set master.config.target-url=http://site.example. | Parameter | Description | Default | | ---------------------------- | ---------------------------------- | ----------------------------------------------------- | | `Name` | Locust master name | `locust` | +| 'createTestScripts' | Use Helm to create the test scripts | 'true' | | `image.repository` | Locust container image name | `quay.io/honestbee/locust` | | `image.tag` | Locust Container image tag | `0.7.5` | | `image.pullSecrets` | Locust Container image registry secret | `None` | +| 'ingress.enable' | Enable ingress to expose the master | 'false' | +| `master.config.target-url` | locust target host | `http://site.example.com` | +| 'master.nodeSelectors.enable'| Enable nodeSelector usage | 'false' | +| 'master.tolerations.enable' | Enable tolerations/taint usage | 'false' | | `service.type` | k8s service type exposing master | `NodePort` | | `service.nodePort` | Port on cluster to expose master | `0` | | `service.annotations` | KV containing custom annotations | `{}` | | `service.extraLabels` | KV containing extra labels | `{}` | -| `master.config.target-url` | locust target host | `http://site.example.com` | | `worker.config.locust-script`| locust script to run | `/locust-tasks/tasks.py` | | `worker.replicaCount` | Number of workers to run | `2` | From 98761145c88cab4bbbc2924c0139e25c343785b3 Mon Sep 17 00:00:00 2001 From: garland Date: Tue, 25 Sep 2018 10:50:25 -0700 Subject: [PATCH 08/13] updating to use the docker image from master Signed-off-by: garland --- stable/locust/templates/master-deploy.yaml | 3 +++ stable/locust/templates/worker-deploy.yaml | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/stable/locust/templates/master-deploy.yaml b/stable/locust/templates/master-deploy.yaml index cdf89ba1dfe3..cd0baeb79dbd 100644 --- a/stable/locust/templates/master-deploy.yaml +++ b/stable/locust/templates/master-deploy.yaml @@ -34,6 +34,7 @@ spec: - name: locust image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + args: ["-f", "$(LOCUSTFILE_PATH)", "-H", "$(TARGET_URL)", "--master", "--loglevel=DEBUG"] resources: {{ toYaml .Values.worker.resources | indent 10 }} env: @@ -43,6 +44,8 @@ spec: {{- end }} - name: LOCUST_MODE value: "master" + - name: TARGET_URL + value: {{ index .Values.master.config "target-url" | quote }} - name: LOCUSTFILE_PATH value: {{ index .Values.worker.config "locust-script" | quote }} ports: diff --git a/stable/locust/templates/worker-deploy.yaml b/stable/locust/templates/worker-deploy.yaml index 40e246e32ba9..7f24ffce6fc8 100644 --- a/stable/locust/templates/worker-deploy.yaml +++ b/stable/locust/templates/worker-deploy.yaml @@ -33,6 +33,7 @@ spec: - name: locust image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + args: ["-f", "$(LOCUSTFILE_PATH)", "-H", "$(TARGET_URL)", "--slave", "--master-host=$(LOCUST_MASTER_HOST)", "--master-port=5557", "--loglevel=DEBUG"] volumeMounts: - name: locust-tasks mountPath: /locust-tasks/ @@ -46,7 +47,7 @@ spec: - name: LOCUST_MASTER_HOST value: {{ template "locust.master-svc" . }} - name: LOCUST_MASTER_WEB - value: {{ .Values.service.internalPort }}" + value: "{{ .Values.service.internalPort }}" - name: TARGET_URL value: {{ index .Values.master.config "target-url" | quote }} - name: LOCUSTFILE_PATH From efd8be68969263766b7b1a5af861dcce21d46a8a Mon Sep 17 00:00:00 2001 From: garland Date: Tue, 25 Sep 2018 10:55:03 -0700 Subject: [PATCH 09/13] removing unused envars Signed-off-by: garland --- stable/locust/templates/master-deploy.yaml | 2 -- stable/locust/templates/worker-deploy.yaml | 4 ---- 2 files changed, 6 deletions(-) diff --git a/stable/locust/templates/master-deploy.yaml b/stable/locust/templates/master-deploy.yaml index cd0baeb79dbd..4dd69ca30969 100644 --- a/stable/locust/templates/master-deploy.yaml +++ b/stable/locust/templates/master-deploy.yaml @@ -42,8 +42,6 @@ spec: - name: {{ $key | upper | replace "-" "_" }} value: {{ $value | quote }} {{- end }} - - name: LOCUST_MODE - value: "master" - name: TARGET_URL value: {{ index .Values.master.config "target-url" | quote }} - name: LOCUSTFILE_PATH diff --git a/stable/locust/templates/worker-deploy.yaml b/stable/locust/templates/worker-deploy.yaml index 7f24ffce6fc8..27fccdc76902 100644 --- a/stable/locust/templates/worker-deploy.yaml +++ b/stable/locust/templates/worker-deploy.yaml @@ -42,12 +42,8 @@ spec: - name: {{ $key | upper | replace "-" "_" }} value: {{ $value | quote }} {{- end }} - - name: LOCUST_MODE - value: "slave" - name: LOCUST_MASTER_HOST value: {{ template "locust.master-svc" . }} - - name: LOCUST_MASTER_WEB - value: "{{ .Values.service.internalPort }}" - name: TARGET_URL value: {{ index .Values.master.config "target-url" | quote }} - name: LOCUSTFILE_PATH From dafd9cc973eca2702d0d427bdf352b06e00fb0b3 Mon Sep 17 00:00:00 2001 From: garland Date: Tue, 25 Sep 2018 11:13:17 -0700 Subject: [PATCH 10/13] adding logging flag Signed-off-by: garland --- stable/locust/templates/master-deploy.yaml | 6 +++--- stable/locust/templates/worker-deploy.yaml | 6 +++--- stable/locust/values.yaml | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/stable/locust/templates/master-deploy.yaml b/stable/locust/templates/master-deploy.yaml index 4dd69ca30969..aef78e795dc6 100644 --- a/stable/locust/templates/master-deploy.yaml +++ b/stable/locust/templates/master-deploy.yaml @@ -34,7 +34,7 @@ spec: - name: locust image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - args: ["-f", "$(LOCUSTFILE_PATH)", "-H", "$(TARGET_URL)", "--master", "--loglevel=DEBUG"] + args: ["-f", "$(LOCUSTFILE_PATH)", "-H", "$(TARGET_URL)", "--master", "--loglevel=$(LOGLEVEL)"] resources: {{ toYaml .Values.worker.resources | indent 10 }} env: @@ -42,10 +42,10 @@ spec: - name: {{ $key | upper | replace "-" "_" }} value: {{ $value | quote }} {{- end }} - - name: TARGET_URL - value: {{ index .Values.master.config "target-url" | quote }} - name: LOCUSTFILE_PATH value: {{ index .Values.worker.config "locust-script" | quote }} + - name: LOGLEVEL + value: {{ .Values.master.logLevel }} ports: - containerPort: {{ .Values.service.internalPort }} name: loc-master-web diff --git a/stable/locust/templates/worker-deploy.yaml b/stable/locust/templates/worker-deploy.yaml index 27fccdc76902..eed1b7ac4a30 100644 --- a/stable/locust/templates/worker-deploy.yaml +++ b/stable/locust/templates/worker-deploy.yaml @@ -33,7 +33,7 @@ spec: - name: locust image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - args: ["-f", "$(LOCUSTFILE_PATH)", "-H", "$(TARGET_URL)", "--slave", "--master-host=$(LOCUST_MASTER_HOST)", "--master-port=5557", "--loglevel=DEBUG"] + args: ["-f", "$(LOCUST_SCRIPT)", "-H", "$(TARGET_URL)", "--slave", "--master-host=$(LOCUST_MASTER_HOST)", "--master-port=5557", "--loglevel=$(LOGLEVEL)"] volumeMounts: - name: locust-tasks mountPath: /locust-tasks/ @@ -46,8 +46,8 @@ spec: value: {{ template "locust.master-svc" . }} - name: TARGET_URL value: {{ index .Values.master.config "target-url" | quote }} - - name: LOCUSTFILE_PATH - value: {{ index .Values.worker.config "locust-script" | quote }} + - name: LOGLEVEL + value: {{ .Values.worker.logLevel }} resources: {{ toYaml .Values.worker.resources | indent 10 }} {{ if .Values.worker.nodeSelectors.enable }} diff --git a/stable/locust/values.yaml b/stable/locust/values.yaml index 1fa4412bdaff..f76f6d630690 100644 --- a/stable/locust/values.yaml +++ b/stable/locust/values.yaml @@ -17,6 +17,7 @@ service: master: config: target-url: https://site.example.com + logLevel: INFO resources: limits: cpu: 100m @@ -40,6 +41,7 @@ worker: # all files from tasks folder are mounted under `/locust-tasks` locust-script: "/locust-tasks/tasks.py" + logLevel: INFO replicaCount: 2 resources: limits: From ede98b83e469a5cad19e0ec68c3b7be9cb8d85ad Mon Sep 17 00:00:00 2001 From: garland Date: Thu, 27 Sep 2018 14:00:55 -0700 Subject: [PATCH 11/13] Updating docker repo Signed-off-by: garland --- stable/locust/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable/locust/README.md b/stable/locust/README.md index 65bcda86123a..91f67a45a4a1 100644 --- a/stable/locust/README.md +++ b/stable/locust/README.md @@ -28,7 +28,7 @@ helm install -n locust-nymph --set master.config.target-url=http://site.example. | ---------------------------- | ---------------------------------- | ----------------------------------------------------- | | `Name` | Locust master name | `locust` | | 'createTestScripts' | Use Helm to create the test scripts | 'true' | -| `image.repository` | Locust container image name | `quay.io/honestbee/locust` | +| `image.repository` | Locust container image name | `garland/locust ` | | `image.tag` | Locust Container image tag | `0.7.5` | | `image.pullSecrets` | Locust Container image registry secret | `None` | | 'ingress.enable' | Enable ingress to expose the master | 'false' | From d5fb95188880cd5b6a0cb752dbf3576edf12e7ef Mon Sep 17 00:00:00 2001 From: garland Date: Fri, 28 Sep 2018 11:04:21 -0700 Subject: [PATCH 12/13] fixing ingress tls name --- stable/locust/templates/ingres.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable/locust/templates/ingres.yaml b/stable/locust/templates/ingres.yaml index b79d9dde2f64..a088e21eb1f0 100644 --- a/stable/locust/templates/ingres.yaml +++ b/stable/locust/templates/ingres.yaml @@ -21,7 +21,7 @@ spec: tls: - hosts: - "{{ .Values.ingress.hostname }}" - secretName: {{ .Values.namePrefix }}-locust-tls + secretName: {{ template "locust.ingress" . }}-locust-tls rules: - host: "{{ .Values.ingress.hostname }}" http: From e7a7c83bb025e8c3680c8829fcf49b954d11f576 Mon Sep 17 00:00:00 2001 From: garland Date: Sun, 30 Sep 2018 11:56:42 -0700 Subject: [PATCH 13/13] adding flag to enable/disable TLS --- stable/locust/templates/ingres.yaml | 4 ++++ stable/locust/values.yaml | 1 + 2 files changed, 5 insertions(+) diff --git a/stable/locust/templates/ingres.yaml b/stable/locust/templates/ingres.yaml index a088e21eb1f0..44b17e6141e7 100644 --- a/stable/locust/templates/ingres.yaml +++ b/stable/locust/templates/ingres.yaml @@ -13,15 +13,19 @@ metadata: annotations: kubernetes.io/ingress.class: "{{ .Values.ingress.ingressClass }}" # Setup Let's Encrypt Certificates + {{ if .Values.ingress.enableTLS }} kubernetes.io/tls-acme: "{{ .Values.ingress.enableTlsAcme }}" + {{ end }} {{ if .Values.ingress.annotations.enable }} nginx.ingress.kubernetes.io/whitelist-source-range: "{{ .Values.ingress.annotations.whitelistSourceRange }}" {{ end }} spec: + {{ if .Values.ingress.enableTLS }} tls: - hosts: - "{{ .Values.ingress.hostname }}" secretName: {{ template "locust.ingress" . }}-locust-tls + {{ end }} rules: - host: "{{ .Values.ingress.hostname }}" http: diff --git a/stable/locust/values.yaml b/stable/locust/values.yaml index f76f6d630690..8230e7b7d927 100644 --- a/stable/locust/values.yaml +++ b/stable/locust/values.yaml @@ -67,6 +67,7 @@ createTestScripts: true ingress: enable: false + enableTLS: false ingressClass: nginx enableTlsAcme: false hostname: locust.example.com