-
Notifications
You must be signed in to change notification settings - Fork 8
/
jmeter_cluster_create.sh
executable file
·111 lines (63 loc) · 2.3 KB
/
jmeter_cluster_create.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env bash
#Create multiple Jmeter namespaces on an existing kuberntes cluster
#Started On January 23, 2018
working_dir=`pwd`
echo "checking if oc is present"
if ! hash oc 2>/dev/null
then
echo "'oc' was not found in PATH"
echo "Kindly ensure that you can acces an existing OpenShift cluster via oc"
exit
fi
oc version
echo "Current list of projects on the OpenShift cluster:"
echo
oc get project | grep -v NAME | awk '{print $1}'
echo
echo "Enter the name of the new project unique name, this will be used to create the namespace"
read tenant
echo
#Check If namespace exists
oc get project $tenant > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "Project $tenant already exists, please select a unique name"
echo "Current list of projects on the OpenShift cluster"
sleep 2
oc get project | grep -v NAME | awk '{print $1}'
exit 1
fi
echo
echo "Creating project: $tenant"
oc new-project $tenant --description="jmeter cluster for loadtesting" --display-name="loadtesting"
echo "Project $tenant has been created"
oc project $tenant
echo
echo "Creating Jmeter slave nodes"
# nodes=`kubectl get no | egrep -v "master|NAME" | wc -l`
# echo
# echo "Number of worker nodes on this cluster is " $nodes
echo
#echo "Creating $nodes Jmeter slave replicas and service"
echo
oc create -f $working_dir/jmeter_slaves_deploymentconfig.yaml
oc create -f $working_dir/jmeter_slaves_svc.yaml
echo "Creating Jmeter Master"
oc create -f $working_dir/jmeter_master_configmap.yaml
oc create -f $working_dir/jmeter_master_deploymentconfig.yaml
echo "Creating Influxdb and the service"
oc create -f $working_dir/jmeter_influxdb_configmap.yaml
oc create -f $working_dir/jmeter_influxdb_openshift_deploymentconfig_ephemeral.yaml
oc create -f $working_dir/jmeter_influxdb_svc.yaml
echo "Creating privileged service account"
oc create serviceaccount useroot
oc adm policy add-scc-to-user anyuid -z useroot
oc patch dc/jmeter-master --patch '{"spec":{"template":{"spec":{"serviceAccountName": "useroot"}}}}'
echo "Creating Grafana Deployment"
oc create -f $working_dir/jmeter_grafana_deploy.yaml
oc create -f $working_dir/jmeter_grafana_svc.yaml
oc create -f $working_dir/jmeter_grafana_route.yaml
echo "Printout Of the $tenant Objects"
echo
oc get all -o wide
echo project= $tenant > $working_dir/tenant_export