Skip to content

Commit

Permalink
Merge pull request #6 from ragul28/feature/upgrade
Browse files Browse the repository at this point in the history
Feature/upgrade
  • Loading branch information
ragul28 committed Dec 29, 2023
2 parents a15d5bf + 211fb1c commit 328bb77
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_REPO }}/jmeter-base:${{ env.RELEASE_VERSION }},${{ env.GHCR_REPO }}/jmeter-base:latest
${{ env.GHCR_REPO }}/jmeter-base:${{ env.RELEASE_VERSION }},${{ env.GHCR_REPO }}/jmeter-slave:latest
if: github.event_name != 'pull_request'

- name: Build master docker image
Expand Down
22 changes: 22 additions & 0 deletions cluster/eksctl-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
piVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
name: jmeter-cluster
region: us-west-1

nodeGroups:
- name: nodegroup-1
instanceType: t3a.small
desiredCapacity: 3
volumeSize: 80
ssh:
allow: true # will use ~/.ssh/id_rsa.pub as the default ssh key
iam:
withAddonPolicies:
autoScaler: true
ebs: true
efs: true
albIngress: true
xRay: false
cloudWatch: true
8 changes: 8 additions & 0 deletions cluster/kind-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# three node (two workers) cluster config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
9 changes: 2 additions & 7 deletions dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,9 @@ influxdb_pod=`kubectl get po -n $tenant | grep influxdb-jmeter | awk '{print $1}
kubectl exec -ti -n $tenant $influxdb_pod -- influx -execute 'CREATE DATABASE jmeter'
## Create the influxdb datasource in Grafana
echo "Creating the Influxdb data source"
grafana_pod=`kubectl get po -n $tenant | grep jmeter-grafana | awk '{print $1}'`
# echo "Creating the Influxdb data source"
# grafana_pod=`kubectl get po -n $tenant | grep jmeter-grafana | awk '{print $1}'`
## Make load test script in Jmeter master pod executable
#Get Master pod details
master_pod=`kubectl get po -n $tenant | grep jmeter-master | awk '{print $1}'`
kubectl exec -ti -n $tenant $master_pod -- cp -r /load_test /jmeter/load_test
kubectl exec -ti -n $tenant $master_pod -- chmod 755 /jmeter/load_test
# kubectl exec -ti -n $tenant $grafana_pod -c grafana -- curl 'http://admin:admin@127.0.0.1:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary \
# '{"name":"jmeterdb","type":"influxdb","url":"http://jmeter-influxdb:8086","access":"proxy","isDefault":true,"database":"jmeter","user":"admin","password":"admin"}'
4 changes: 2 additions & 2 deletions grafana-dashboard/jmeter_grafana_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: grafana
image: grafana/grafana:6.7
image: grafana/grafana:6.7.5
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
Expand Down Expand Up @@ -50,7 +50,7 @@ spec:
mountPath: /var/lib/grafana/dashboards/jmeter-metric.json
subPath: jmeter-metric.json
- name: jmreporter
image: kubernautslabs/jmeter-reporter:latest
image: izakmarais/grafana-reporter:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8686
Expand Down
2 changes: 1 addition & 1 deletion grafana-dashboard/jmeter_influxdb_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
app: influxdb-jmeter
spec:
containers:
- image: influxdb
- image: influxdb:1.8
imagePullPolicy: IfNotPresent
name: influxdb
volumeMounts:
Expand Down
1 change: 1 addition & 0 deletions jmeter-cluster/jmeter_master_configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ data:
else
mkdir csv report
fi
ln -s /jmeter/apache-jmeter-* /jmeter/apache-jmeter
/jmeter/apache-jmeter-*/bin/jmeter -n -t $1 -Dserver.rmi.ssl.disable=true -R `getent ahostsv4 jmeter-slaves-svc | cut -d' ' -f1 | sort -u | awk -v ORS=, '{print $1}' | sed 's/,$//'` -l /csv/Res.csv -e -o /report
if [ -d "report" ]; then
TIMESTAMP=`date +%Y-%m-%d_%H-%M-%S`
Expand Down
2 changes: 1 addition & 1 deletion jmeter-cluster/jmeter_slaves_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
jmeter_mode: slave
spec:
replicas: 2
replicas: 2
selector:
matchLabels:
jmeter_mode: slave
Expand Down
1 change: 1 addition & 0 deletions jmeter-cluster/load_test
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if [ -d "report" ]; then
else
mkdir csv report
fi
ln -s /jmeter/apache-jmeter-* /jmeter/apache-jmeter
/jmeter/apache-jmeter-*/bin/jmeter -n -t $1 -Dserver.rmi.ssl.disable=true -R `getent ahostsv4 jmeter-slaves-svc | cut -d' ' -f1 | sort -u | awk -v ORS=, '{print $1}' | sed 's/,$//'` -l /csv/Res.csv -e -o /report
if [ -d "report" ]; then
TIMESTAMP=`date +%Y-%m-%d_%H-%M-%S`
Expand Down
26 changes: 12 additions & 14 deletions jmeter_cluster_create.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
#Create multiple Jmeter namespaces on an existing kuberntes cluster
#Create Jmeter cluster on existing kuberntes cluster namespace

working_dir=`pwd`

Expand All @@ -12,49 +12,47 @@ then
exit
fi

kubectl version --short
kubectl version --client

echo "Enter the namespace [default]:"
read tenant

if [[ -z $tenant ]]
then
tenant=default
echo "Using $tenant namespace"
else
kubectl create ns $tenant
echo "Using $tenant namespace has been created"
fi

echo "Using $tenant namespace has been created"
echo

echo "Creating Jmeter slave nodes"
nodes=`kubectl get no | egrep -v "master|NAME" | wc -l`
nodes=`kubectl get no | egrep -v "master|control|NAME" | wc -l`

echo "Number of worker nodes on this cluster is " $nodes

echo "Enter the number of jmeter-slaves [$nodes]:"
echo "Enter the number of jmeter-slaves [$((nodes - 1))]:"
read num_slaves

if [[ -z $num_slaves ]]
then
num_slaves=$nodes
num_slaves=$((nodes - 1))
fi
echo "Creating $num_slaves Jmeter slave replicas and service"
echo

echo "Creating $num_slaves Jmeter slave replicas and service"
sed -i "s~^\([[:blank:]]*\)replicas:.*$~\1replicas: $num_slaves~" $working_dir/jmeter-cluster/jmeter_slaves_deploy.yaml

kubectl create -n $tenant -f $working_dir/jmeter-cluster/jmeter_slaves_deploy.yaml

kubectl create -n $tenant -f $working_dir/jmeter-cluster/jmeter_slaves_svc.yaml

echo
echo "Creating Jmeter Master"

kubectl create -n $tenant -f $working_dir/jmeter-cluster/jmeter_master_configmap.yaml

kubectl create -n $tenant -f $working_dir/jmeter-cluster/jmeter_master_deploy.yaml


echo "Printout Of the $tenant Objects"
echo
kubectl get -n $tenant all

echo namespace = $tenant > $working_dir/jmeter-cluster/tenant_export
echo namespace = $tenant > $working_dir/tenant_export
4 changes: 3 additions & 1 deletion jmeter_stop.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

set -eo pipefail

working_dir=`pwd`

#Get namesapce variable
tenant=`awk '{print $NF}' $working_dir/tenant_export`

master_pod=`kubectl get po -n $tenant | grep jmeter-master | awk '{print $1}'`
kubectl -n $tenant exec -ti $master_pod bash /jmeter/apache-jmeter-5.0/bin/stoptest.sh
kubectl -n $tenant exec -ti $master_pod -- /jmeter/apache-jmeter/bin/stoptest.sh

0 comments on commit 328bb77

Please sign in to comment.