Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

K8S - Add data volume for distributing test data and configmap for user-properties #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion k8s/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "1.0"
description: A Distributed JMeter Helm chart
name: distributed-jmeter
version: 0.1.0
version: 0.1.1
home: http://jmeter.apache.org/
icon: http://jmeter.apache.org/images/logo.svg
sources:
Expand Down
13 changes: 7 additions & 6 deletions k8s/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ JMeter is now starting.

To get get a shell session on the master you only need to run:

$ export MASTER_NAME=$(kubectl get pods -l role=master -o jsonpath='{.items[*].metadata.name}')
$ kubectl exec -it $MASTER_NAME -- /bin/bash
$ export MASTER_NAME=$(kubectl get pods -l role=master --namespace {{ .Release.Namespace }} -o jsonpath='{.items[*].metadata.name}')
$ kubectl exec -it $MASTER_NAME --namespace {{ .Release.Namespace }} -- /bin/bash


To copy your test plans to the master pod:
$ kubectl cp sample.jmx $MASTER_NAME:/jmeter
To copy your test plans & data to the master pod:
$ kubectl cp sample.jmx $MASTER_NAME:/jmeter/data --namespace {{ .Release.Namespace }}
$ kubectl cp sample.csv $MASTER_NAME:/jmeter/data --namespace {{ .Release.Namespace }}


To run your test in all servers you need first a list of all servers IPs (comma-separated) and then you can run your test:
$ export SERVER_IPS=$(kubectl get pods -lrole=server -o jsonpath='{.items[*].status.podIP}' | tr ' ' ',')
$ kubectl exec -it $MASTER_NAME -- jmeter -n -t /jmeter/sample.jmx -R $SERVER_IPS
$ export SERVER_IPS=$(kubectl get pods -l role=server --namespace {{ .Release.Namespace }} -o jsonpath='{.items[*].status.podIP}' | tr ' ' ',')
$ kubectl exec -it $MASTER_NAME --namespace {{ .Release.Namespace }} -- jmeter -n -t /jmeter/sample.jmx -R $SERVER_IPS
14 changes: 14 additions & 0 deletions k8s/templates/jmeter-data-volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.dataVolume.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Release.Name }}-data
namespace: {{ .Release.Namespace }}
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: {{ .Values.dataVolume.size }}
storageClassName: {{ .Values.dataVolume.storageClassName }}
{{- end -}}
19 changes: 19 additions & 0 deletions k8s/templates/jmeter-master-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@ spec:
args: ["master"]
ports:
- containerPort: 60000
volumeMounts:
- name: user-properties
mountPath: /jmeter/bin/user.properties
readOnly: true
subPath: "user.properties"
- name: data
mountPath: /jmeter/data
subPath: "data"
volumes:
- name: user-properties
configMap:
name: {{ .Release.Name }}-user-properties
- name: data
{{- if .Values.dataVolume.enabled }}
persistentVolumeClaim:
claimName: {{ .Release.Name }}-data
{{ else }}
emptyDir: {}
{{ end }}
19 changes: 19 additions & 0 deletions k8s/templates/jmeter-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,22 @@ spec:
ports:
- containerPort: 50000
- containerPort: 1099
volumeMounts:
- name: user-properties
mountPath: /jmeter/bin/user.properties
readOnly: true
subPath: "user.properties"
- name: data
mountPath: /jmeter/data
subPath: "data"
volumes:
- name: user-properties
configMap:
name: {{ .Release.Name }}-user-properties
- name: data
{{- if .Values.dataVolume.enabled }}
persistentVolumeClaim:
claimName: {{ .Release.Name }}-data
{{ else }}
emptyDir: {}
{{ end }}
13 changes: 13 additions & 0 deletions k8s/templates/jmeter-user-properties.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-user-properties
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" }}
app: {{ template "distributed-jmeter.name" . }}
data:
user.properties: |-
jmeter.save.saveservice.default_delimiter=\t
jmeter.save.saveservice.print_field_names=true
5 changes: 5 additions & 0 deletions k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ image:
## The tag for the image
## ref: https://hub.docker.com/r/pedrocesarti/jmeter-docker/tags/
tag: 3.3

dataVolume:
enabled: true
storageClassName: readwritemany
size: 100Mi