From 069cb9efadd3623cedeb1c33df87755adf490666 Mon Sep 17 00:00:00 2001 From: Eliise S Date: Fri, 13 Mar 2020 18:05:52 +0000 Subject: [PATCH] Reduce space used by load tests --- Dockerfile | 5 +++- Makefile | 10 +++---- kind-cluster.yaml | 6 ---- locust/manifests/deployment.yaml | 46 +++++++++++++++++-------------- mockapi/Dockerfile | 5 +++- mockapi/manifests/deployment.yaml | 36 +++++++++++++----------- 6 files changed, 58 insertions(+), 50 deletions(-) delete mode 100644 kind-cluster.yaml diff --git a/Dockerfile b/Dockerfile index a457ef5..ce1613e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ # Build the manager binary -FROM golang:1.12.5 as builder +FROM golang:1.12.5-alpine3.9 as builder + +# Install certs, git, and mercurial +RUN apk add --no-cache ca-certificates git mercurial WORKDIR /workspace # Copy the Go Modules manifests diff --git a/Makefile b/Makefile index 6f81003..a00e3b8 100644 --- a/Makefile +++ b/Makefile @@ -155,7 +155,7 @@ delete-kindcluster: create-kindcluster: delete-kindcluster @echo "$(shell tput setaf 10)$(shell tput bold)Creating kind cluster $(shell tput sgr0)" - kind create cluster --name ${KIND_CLUSTER_NAME} --config ./kind-cluster.yaml + kind create cluster --name ${KIND_CLUSTER_NAME} set-kindcluster: install-kind make create-kindcluster @@ -290,7 +290,7 @@ create-db-mock-secret: create-namespace --from-literal=DatabricksHost="http://databricks-mock-api.databricks-mock-api:8080" \ --from-literal=DatabricksToken="dummy" -deploy-cluster-for-load-testing: create-kindcluster install-prometheus create-db-mock-secret deploy-kindcluster deploy-mock-api +deploy-cluster-for-load-testing: create-kindcluster install-prometheus create-db-mock-secret deploy-kindcluster deploy-mock-api deploy-locust @echo "$(shell tput setaf 10)$(shell tput bold)Deploying grafana dashboards $(shell tput sgr0)" # deploy service monitor @@ -301,11 +301,11 @@ deploy-cluster-for-load-testing: create-kindcluster install-prometheus create-db kubectl apply -f ./config/prometheus/grafana-dashboard-load-test-configmap.yaml kubectl apply -f ./config/prometheus/grafana-dashboard-mockapi-configmap.yaml -run-load-testing: deploy-cluster-for-load-testing deploy-locust port-forward - @echo "$(shell tput setaf 10)$(shell tput bold)Verify load tests $(shell tput sgr0)" - go run hack/verify_load_tests/main.go +run-load-testing: deploy-cluster-for-load-testing port-forward run-load-testing-auto-start: set-auto-start run-load-testing + @echo "$(shell tput setaf 10)$(shell tput bold)Verify load tests $(shell tput sgr0)" + go run hack/verify_load_tests/main.go set-auto-start: # Args passed to locust must be in CSV format as passed in "command" section of yaml doc diff --git a/kind-cluster.yaml b/kind-cluster.yaml deleted file mode 100644 index 583886c..0000000 --- a/kind-cluster.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Cluster -apiVersion: kind.x-k8s.io/v1alpha4 -nodes: -- role: control-plane -- role: worker -- role: worker \ No newline at end of file diff --git a/locust/manifests/deployment.yaml b/locust/manifests/deployment.yaml index 7d77e1e..c3d6a36 100644 --- a/locust/manifests/deployment.yaml +++ b/locust/manifests/deployment.yaml @@ -21,27 +21,31 @@ spec: spec: affinity: podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: control-plane - operator: In - values: - - controller-manager - topologyKey: kubernetes.io/hostname - namespaces: - - azure-databricks-operator-system - - default - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - databricks-mock-api - topologyKey: kubernetes.io/hostname - namespaces: - - azure-databricks-operator-system - - default + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: control-plane + operator: In + values: + - controller-manager + topologyKey: kubernetes.io/hostname + namespaces: + - azure-databricks-operator-system + - default + - weight: 99 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - databricks-mock-api + topologyKey: kubernetes.io/hostname + namespaces: + - azure-databricks-operator-system + - default containers: - name: loadtestrunner image: locust:latest diff --git a/mockapi/Dockerfile b/mockapi/Dockerfile index 95a1967..05205b9 100644 --- a/mockapi/Dockerfile +++ b/mockapi/Dockerfile @@ -3,7 +3,10 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -FROM golang:1.12-stretch as builder +FROM golang:1.12-alpine3.9 as builder + +# Install certs, git, and mercurial +RUN apk add --no-cache ca-certificates git mercurial WORKDIR /workspace diff --git a/mockapi/manifests/deployment.yaml b/mockapi/manifests/deployment.yaml index 67e9099..c84b3df 100644 --- a/mockapi/manifests/deployment.yaml +++ b/mockapi/manifests/deployment.yaml @@ -19,23 +19,27 @@ spec: spec: affinity: podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: control-plane - operator: In - values: - - controller-manager - topologyKey: kubernetes.io/hostname - namespaces: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: control-plane + operator: In + values: + - controller-manager + topologyKey: kubernetes.io/hostname + namespaces: - azure-databricks-operator-system - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - locust-loadtest - topologyKey: kubernetes.io/hostname + - weight: 99 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - locust-loadtest + topologyKey: kubernetes.io/hostname containers: - name: databricks-mock-api image: mockapi:latest