-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new shell script - deploy csv config files to jmeter slaves
Signed-off-by: itamar <itc404@gmail.com>>
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
#Script created to copy csv config file to jmeter slave pods | ||
#It requires that you supply the path to the csv file and destination path in the jmeter pods | ||
|
||
namespace="$1" | ||
|
||
[ -n "$namespace" ] || read -p 'Enter the Jmeter Namespace: ' namespace | ||
|
||
kubectl get namespace | grep $namespace >> /dev/null | ||
|
||
if [ $? != 0 ]; | ||
then | ||
echo "Namespace does not exist in the kubernetes cluster" | ||
echo "" | ||
echo "Below is the list of namespaces in the kubernetes cluster" | ||
|
||
kubectl get namespaces | ||
echo "" | ||
echo "Please check and try again" | ||
exit | ||
fi | ||
|
||
csv="$2" | ||
[ -n "$csv" ] || read -p 'Enter path to the csv file:' csv | ||
|
||
if [ ! -f "$csv" ]; | ||
then | ||
echo "csv file was not found in PATH" | ||
echo "Kindly check and input the correct file path" | ||
exit | ||
fi | ||
|
||
csv_name="$(basename "$csv")" | ||
|
||
path="$3" | ||
[ -n "$path" ] || read -p 'Enter destination path:' path | ||
|
||
|
||
|
||
#Get Master pod details | ||
|
||
kubectl -n $namespace get po | grep jmeter-slave | grep Running | awk '{print $1}' | while read -r slave_pod ; do | ||
echo "Deploying $csv_name to: $slave_pod" | ||
kubectl -n $namespace cp "$csv" "$slave_pod:$path/$csv_name" | ||
done | ||
|
||
|
||
|